Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
.net_developer #1
Member since Sep 2015 · 41 posts
Group memberships: Members
Show profile · Link to this post
Subject: Edit sent message
Hello,sorry for asking same thing again,but i found this link http://www.xmpp.org/extensions/xep-0308.html which indicates edit last message,but how can i implement it in agsxmpp?please help.
Avatar
Alex #2
Member since Feb 2003 · 4295 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This extensions is not implemented in agsXMPP, only in MatriX.

Just take a look at the agsXMPP sources how all the other protocol classes are implemented, or study the custom packet tutorial.
Then it should be pretty easy for you to add support for this extension.

Alex
Avatar
.net_developer #3
Member since Sep 2015 · 41 posts
Group memberships: Members
Show profile · Link to this post
thank you,i tried to add custom packet by doing

  1. public class replace : Element
  2.     {
  3.         public replace()
  4.         {
  5.             this.TagName = "replace";
  6.             this.Namespace = "urn:xmpp:message-correct:0";
  7.         }
  8.         public replace(string xmlns,string id)
  9.             : this()
  10.         {
  11.               this.id = id;
  12.             this.xmlns = xmlns;
  13.         }
  14.         public string xmlns
  15.         {
  16.             get { return GetTag("xmlns"); }
  17.             set { SetTag("xmlns", value.ToString()); }
  18.         }
  19.         public string id
  20.         {
  21.             get { return GetTag("id"); }
  22.             set { SetTag("id", value.ToString()); }
  23.         }
  24.  
  25.     }

and adding this line

  1. agsXMPP.Factory.ElementFactory.AddElementType("replace", "urn:xmpp:message-correct:0", typeof(replace));

but still i can't generate stanza of this type:-

  1. <message to='juliet@capulet.net/balcony' id='good1'>
  2.  <body>But soft, what light through yonder window breaks?</body>
  3.  <replace id='bad1' xmlns='urn:xmpp:message-correct:0'/>
  4. </message>

instead stanza is like this:-

  1. <message id="8955" to="60016@server" type="chat" from="60006@server/60006">
  2.    <replace xmlns="urn:xmpp:message-correct:0">
  3.       <id>8955</id>
  4.       <xmlns>urn:xmpp:message-correct:0</xmlns>
  5.    </replace>
  6.    <body>dfghjj787&lt;img width="20" height="20" src="Resources/typing.png"&gt;</body>
  7. </message>

this is because i have to add id and xmlns as new property,there is no defeult id property as there is for "message",and due to this on server no message is updated,but new entry is created for updated message,so how can i make this work?
This post was edited 5 times, last on 2016-01-22, 11:30 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4295 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you don't need your second constructor and the xmlns property, remove it.
Also id is an attribute, not a tag, so change this.

Alex
Avatar
.net_developer #5
Member since Sep 2015 · 41 posts
Group memberships: Members
Show profile · Link to this post
Thank you,for your response,i updated my code as you told,and now my stanza appears as like this:-

  1. <message xmlns="jabber:client" from="60006@server/60006" to="60016@server" type="chat" id="4216d4a9-d9e5-4a2b-8870-7d48c007efc7">
  2.    <replace xmlns="urn:xmpp:message-correct:0" id="f2d12a5b-0def-4586-b6ef-62a4ef185b87" />
  3.    <body>dfddgdgdfgwww&lt;img width="20" height="20" src="Resources/typing.png"&gt;</body>
  4. </message>

but on server it has two entries one is of old message and other is of new edited message,is it the correct flow? is server meant to save both messages?or i have mistaken somewhere due to which there are two messages in server instead of one edited message?please guide..
This post was edited on 2016-01-22, 12:07 by Alex.
Avatar
Alex #6
Member since Feb 2003 · 4295 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The extensions is mean for end to end.
 For example you had a type in a previous message, you edit the previous message and then send the replace. When the client retrieves it it can adjust adjust it in the view.
With archiving the server stored all messages, so you would have the full history, also with all edits.

Alex
Avatar
.net_developer #7
Member since Sep 2015 · 41 posts
Group memberships: Members
Show profile · Link to this post
so,you mean both old copy and new copy of message is saved on server?and client has to sort it?right?
Avatar
Alex #8
Member since Feb 2003 · 4295 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by .net_developer:
so,you mean both old copy and new copy of message is saved on server?and client has to sort it?right?

yes, until your server also supports XEP-0308 to delete the old messages. But according to your tests it does not.

Alex
Avatar
.net_developer #9
Member since Sep 2015 · 41 posts
Group memberships: Members
Show profile · Link to this post
Thank you so much alex..you saved me..really appriciate your help :-)
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