Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
AliVireTechnologies1 #1
Member since Jun 2013 · 58 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to get last logout time of contact
I am using matrix library for windows phone i want to show last logout time of the user, can any one tell me.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You can use XEP-0012: Last Activity for this.
Just send a LastIq to the jid
Avatar
AliVireTechnologies1 #3
Member since Jun 2013 · 58 posts
Group memberships: Members
Show profile · Link to this post
em using this code for showing contact list, and want last logout time for every contact . how can i able to find the logout time for every user onrosteritem

  1. void xmppClient_OnRosterItem(object sender, Matrix.Xmpp.Roster.RosterEventArgs e)
  2. {
  3.     if (!Utility.papulationcontacts.ContainsKey(e.RosterItem.Jid))
  4.     {
  5.         if (e.RosterItem.Subscription != Matrix.Xmpp.Roster.Subscription.remove)
  6.         {
  7.             Utility.Contacts.Add(
  8.                 new Contact
  9.                 {
  10.                     Name = e.RosterItem.Name.First().ToString().ToUpper() + String.Join("", e.RosterItem.Name.Skip(1)) ?? e.RosterItem.Jid,
  11.                     Jid = e.RosterItem.Jid
  12.                 });
  13.         }
  14.         else
  15.         {
  16.             var contact = Utility.Contacts.FirstOrDefault(c => c.Jid == e.RosterItem.Jid);
  17.             if (contact != null)
  18.                 Utility.Contacts.Remove(contact);
  19.         }
  20.  
  21.         int count = Utility.indexcontacts.Count+1;
  22.  
  23.         Utility.papulationcontacts.Add(e.RosterItem.Jid, e.RosterItem.Name);
  24.         Utility.indexcontacts.Add(count, new Contact { Name = e.RosterItem.Name, Jid = e.RosterItem.Jid });
  25.     }
  26.     if (Utility.papulationcontacts.ContainsKey(e.RosterItem.Jid))
  27.     {
  28.  
  29.         txttotalcontact.Text = "Total No of Contact(s) are " + Utility.Contacts.Count.ToString();
  30.     }
  31. }
This post was edited on 2013-06-25, 00:42 by Alex.
Avatar
AliVireTechnologies1 #4
Member since Jun 2013 · 58 posts
Group memberships: Members
Show profile · Link to this post
how can i send lastiq to jid from matrix library.
Avatar
Alex #5
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
  1. var lastIq = new LastIq
  2.                 {
  3.                     Type = Matrix.Xmpp.IqType.get,
  4.                     To = "user@server.com"
  5.                 };
  6. xmppClient.IqFilter.SendIq(riq, LastResponse);
  7.  
  8. private void LastResponse(object sender, IqEventArgs e)
  9. {
  10.     var iq = e.Iq;
  11.  
  12.     if (iq.Type == IqType.result)
  13.     {
  14.         // process result here
  15.     }
  16.     else if (iq.Type == IqType.error)
  17.     {
  18.         // process errors here
  19.     }
  20. }
Avatar
AliVireTechnologies1 #6
Member since Jun 2013 · 58 posts
Group memberships: Members
Show profile · Link to this post
LastIq is not finding in matrix library.
Avatar
Alex #7
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
forgot to add this class to the Windows Phone version. It will be in the next release. You can use IqQuery<Last> in the meantime.

Alex
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: MatriX RSS