Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
bilalkhan #1
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
Subject: agsxmp Message Delivered or not
client1 send a message, how client1 will be acknowledge or get assured that message has been delivered to client2 or not?
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Look at message receipts. This was discussed here many times before.
Avatar
bilalkhan #3
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
ok thanks
i have found solution here but am little bit confuse with the implementation

http://forum.ag-software.net/thread/1799-How-to-use-agsxmp…

  1. public void OnMessage(object sender, agsXMPP.protocol.client.Message message)
  2. {
  3.  //when a message is recieve
  4.  //check tags
  5. SendMessage(message);
  6. }
  7.  
  8. public void SendMessage(agsXMPP.protocol.client.Message message)
  9. {
  10.     try
  11.     {
  12.         if (_xmppClientConnection != null)
  13.         {
  14.             switch(message.TagName)
  15.             {
  16. //when some one send me a request stanza xep-0184
  17.                 case "request":
  18.                     agsXMPP.protocol.client.Message acknowledgmentMessage = new agsXMPP.protocol.client.Message(message.From,
  19.                               message.To);
  20. //here is a compile time error no id belongs to recieved class????????
  21.                     acknowledgmentMessage.AddChild(new agsXMPP.protocol.extensions.msgreceipts.Received {Id = message.Id });
  22.                     _xmppClientConnection.Send(acknowledgmentMessage);
  23.                     break;
  24.                 default:
  25.                     break;
  26.             }
  27.         }
  28.     }
  29.     catch (Exception ex)
  30.     {
  31.  
  32.     }
  33. }



class defination of Received, there is no id exists?

  1. using agsXMPP.Xml.Dom;
  2.  
  3. namespace agsXMPP.protocol.extensions.msgreceipts
  4. {
  5.     public class Received : Element
  6.     {
  7.         public Received();
  8.     }
  9. }
This post was edited 6 times, last on 2016-11-07, 11:48 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
the id is there, please make sure hat you compile from the latest sources from SVN.
Avatar
bilalkhan #5
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
http://www.ag-software.net/download-directory/

i have tried CF2 and Net2 agsxmpp dll the problem still exsist?

their is no public property currently am using , kindly share any link which have latest version of agsxmpp?


following is the class definition in respective namepspace.
using agsXMPP.Xml.Dom;

namespace agsXMPP.protocol.extensions.msgreceipts
{
    public class Received : Element
    {
        public Request();
       //do not have public property call Id??
    }
}


//i can define my own logic for id need your assitance it will be a right direction?

public class MyRecieved:Received
{
     public string MessageId{get;set;}
}

//than i will use my class MyRequest

acknowledgmentMessage.AddChild(new MyRecieved {Id=message.Id }); // it will work fine here?




thanks
This post was edited 5 times, last on 2016-11-07, 13:28 by bilalkhan.
Avatar
Alex #6
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The link to the SVN repo is on the download page:
http://www.ag-software.net/agsxmpp-sdk/download/
Avatar
Alex #7
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
also the Id is in the Received class, not Request
This post was edited on 2016-11-07, 13:57 by Alex.
Avatar
bilalkhan #8
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
sorry my mistake, however received class does not have a property Id?
Avatar
bilalkhan #9
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
according to xep 0184

  1. <message
  2.     from='kingrichard@royalty.england.lit/throne'
  3.     id='bi29sg183b4v'
  4.     to='northumberland@shakespeare.lit/westminster'>
  5.  <received xmlns='urn:xmpp:receipts' id='richard2-4.1.247'/>
  6. </message>
it will work?? if i implement it like this

  1. public class MessageRecieveNotification: agsXMPP.protocol.extensions.msgreceipts.Request
  2. {
  3.    public string MessageId { set; get;}
  4. }
  5.  
  6. line1:
  7.   acknowledgmentMessage.AddChild(new Entities.MessageRecieveNotification() { MessageId = message.Id });
  8.  
  9. //line 1 is same to line 2 functionality wise?
  10.  
  11. line2: acknowledgmentMessage.AddChild(new agsXMPP.protocol.extensions.msgreceipts.Received() {Id=message.Id });

it will create the expected stanza?

  1. <received xmlns='urn:xmpp:receipts' id='richard2-4.1.247'/>
This post was edited on 2016-11-07, 13:57 by Alex.
Avatar
bilalkhan #10
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
after testing the above scenario with my class the result stanze is
i don't know why the id does not append into stanze
agsXMPP.protocol.client.Message acknowledgmentMessage = new agsXMPP.protocol.client.Message("bilal@192.168.0.151",
                                      "hafeez@192.168.0.151");
                acknowledgmentMessage.AddChild(new MessageRecieveNotification() { id ="123" });
                XmppCon.Send(acknowledgmentMessage);

----------------------------------------Stanza------------------------------------------------------
{
<message xmlns="jabber:client" to="bilal@192.168.0.151"><body>hafeez@192.168.0.151</body><request xmlns="urn:xmpp:receipts" /></message>
}
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