Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
yiesha2010 #1
Member since Sep 2013 · 5 posts
Group memberships: Members
Show profile · Link to this post
Subject: agsxmmp
Hi Sir Alex


It is possible to get/retrieve user's name in openfire through agsxmmp using c# then how?
thanks....
Avatar
ramtin #2
User title: RamTin
Member since Mar 2013 · 26 posts
Group memberships: Members
Show profile · Link to this post
Hi,
you can use Presence or Item.Rosters Codes for get the usernames or Full jid

  1. using agsXMPP.protocol.iq.roster;
  2.  
  3. XmppCon.OnRosterItem        += new agsXMPP.XmppClientConnection.RosterHandler(XmppCon_OnRosterItem);
  4.  
  5.  
  6.  
  7.         private void XmppCon_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item)
  8.         {
  9.             if (InvokeRequired)
  10.             {  
  11.                 BeginInvoke(new agsXMPP.XmppClientConnection.RosterHandler(XmppCon_OnRosterItem), new object[]{this, item});
  12.                 return;
  13.             }
  14.  
  15.             if (item.Subscription != SubscriptionType.remove)
  16.             {
  17.                             listBox1.Items.Add(item.Jid.User);
  18.             }
  19.             else
  20.                             listBox1.Items.Remove(item.Jid.User);      
  21.         }

if you Download Samples source codes from agsXMPP , you can see that !
This post was edited on 2013-09-28, 08:40 by Alex.
Avatar
Alex #3
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
As ramtin said you get the names with the roster.
If you need more details then request the vcard. There are also examples for this in the MiniClient.

Alex
Avatar
yiesha2010 #4
Member since Sep 2013 · 5 posts
Group memberships: Members
Show profile · Link to this post
HI Sir Alex and Ramtin,


Can you give me a complete example on how to request for a vcard/ how to used vcard, specially for getting names, below is my code for getting username in openfire and i want to add also the names of all the online user's. Thanks for the reply sir...

  1. private void XmppCon_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item)
  2. {
  3.     if (InvokeRequired)
  4.     {
  5.         BeginInvoke(new agsXMPP.XmppClientConnection.RosterHandler(XmppCon_OnRosterItem), new object[] { sender, item });
  6.         return;
  7.     }
  8.     if (!(item.Subscription == SubscriptionType.remove))
  9.     {
  10.         ListViewItem lvi = null;
  11.         lvi = FindRosterListViewItem(item.Jid);
  12.         if (lvi == null)
  13.         {
  14.             lvi = new ListViewItem();
  15.             lvi.Text = (item.Name != null) ? item.Name : item.Jid.ToString();
  16.             lvi.ImageIndex = 0;
  17.             lvi.Tag = item.Jid.ToString();
  18.             lvi.SubItems.AddRange(new string[] { "", "" });
  19.             contactList.Add(item.Jid.Bare);
  20.             lvwRoster.Items.Add(lvi);
  21.         }
  22.         else
  23.         {
  24.             lvi.Text = (item.Name != null) ? item.Name : item.Jid.ToString();
  25.         }
  26.     }
  27. }
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
please look in the MiniClient example which comes with the download in frmVcard.cs. There is all you need.
Avatar
yiesha2010 #6
Member since Sep 2013 · 5 posts
Group memberships: Members
Show profile · Link to this post
Hi sir Alex,

I've already looked the example you said, but it is very hard for me to get can you give some some codes on how to start...

i have a user in openfire.

username:1675@openfire
password:675
name: Jack
email:null


i want to send some file to Jack

but my problem is i dont how to get Jack...

-----------Sample output: Sending Files to Jack------How can i come up this output sir? and i want to display my out put in         richtextbox,,please help me sir....Thank you..
Avatar
yiesha2010 #7
Member since Sep 2013 · 5 posts
Group memberships: Members
Show profile · Link to this post
Sir Alex


I have attached a picture for my output...

ML Lapu-Lapu is one user of my openfire...

Thank you..
The author has attached one file to this post:
ra.jpg 126.9 kBytes
You have no permission to open this file.
Avatar
Alex #8
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
sorry, but I don't understand your question. This is also not related to this thread about usernames.
For other topics please find the correct topic to ask your questions or open a new thread.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS