Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
ayyrk #1
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Subject: Chat Time Stamp
Hi,

The users are asking for a chat time stamp.

They don't want every message time stamped; this has to do with offline messages.

When they finally log on with their WM device they receive offline messages that were stored on the server but they don't know when the message was GENERATED.

Anybody know how I can display the time a message was GENERATED for these offline messages?

-Ayyrk
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

this timestamp is generated automatically by your server for all offline messages.
All you have to is read the x:delay tag.

Here is the xml example of a offline message whic I traced on login this morning ;-)

  1. <message from="agsforums@jabber.org/UNB" type="normal" to="gnauck@jabber.org" id="msg4817c4a4b122e">
  2.     <subject>New post to: file transfer problem1</subject>
  3.     <body>Hello Alex, rose5178 has posted a reply in the thread “file transfer problem1” in the forum “Support”:
  4.     http://forum.ag-software.de/forum.php?req=thread&amp;postid=3183</body>
  5.     <x xmlns="jabber:x:delay" stamp="20080430T01:00:14" />
  6. </message>

this is the code we have in one of our custom clients to display the timestamp of messages:

  1. private DateTime GetTimestamp(agsXMPP.protocol.client.Message msg)
  2. {
  3.     try
  4.     {
  5.         DateTime timeStamp;
  6.         Delay delay = msg.XDelay;
  7.         if (delay != null)
  8.             timeStamp = delay.Stamp;
  9.         else
  10.             timeStamp = DateTime.Now;
  11.  
  12.         return timeStamp;
  13.     }
  14.     catch (Exception ex)
  15.     {
  16.         return DateTime.Now;
  17.     }           
  18. }

Alex
Avatar
ayyrk #3
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
In reply to post #1
Cool - thanks!

I ended up parsing the stamp myself because I did not prefer the conversion ToLocalTime() in the agsXMPP.util Date method.

Thanks again!
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