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: request to server from client
i have scenario in which i create a chat dialogue at client side and i want to send information to the server that a dialogue has been created at client side.Create it's id and send back to me?

q1) xmpp provide any extension for sending info to the server and getting it back? i.e archiving XEP-0136: Message Archiving
q2) should i create my own IQ to send information that a dialogue is create with person x?

Thanks in advance :)
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I don't understand your use case.
Please elaborate.
Avatar
bilalkhan #3
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
creating_own_packet_types.pdf i have seen example to send custom iq. but in my scenario i don't need a class like weather, i have to create a custom iq with only attribute username and a name space how can i do it?

i have tried, however my stanza is not correct, i want to embed my information in query like this

  1. <iq from=’x to=’y’ type=’get’ id=’agsXMPP_1’>  
  2.    <query xmlns=’urn:xmpp:dialogue’>  
  3.       <userName>bilal</userName>  
  4.    </query>
  5. </iq>


----below is my code----- i want to carry the information username in my custom IQ??

  1. public class CustomDialogueIQ: agsXMPP.protocol.client.IQ
  2.     {
  3.  
  4.         public string UserName { get; set; }
  5.  
  6.    
  7.         public CustomDialogueIQ()
  8.         {
  9.             //base.Query=new agsXMPP.Xml.Dom.Element(); //here exception occurs
  10.             //base.Query.Namespace = "urn:xmpp:dialogue";
  11.         }
  12.      
  13.         public CustomDialogueIQ(agsXMPP.protocol.client.IqType type): this()
  14.         {
  15.             this.Type = type;
  16.         }
  17.         public new string Query
  18.         {
  19.             get
  20.             {
  21.                 return UserName;
  22.             }
  23.         }
  24.     }

what is the correct structure to create my custom iq ??

Thanks in advance.
This post was edited 2 times, last on 2016-11-21, 11:55 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This is how you build a class for the query Element:

  1. <query xmlns=’urn:xmpp:dialogue’>  
  2.     <userName>bilal</userName>  
  3. </query>

  1. public class Dialogue : Element
  2. {
  3.     public Dialogue()
  4.     {
  5.         TagName    = "query";
  6.         Namespace  = "urn:xmpp:dialogue";
  7.     }
  8.  
  9.     public string UserName
  10.     {
  11.         get { return GetTag("userName"); }
  12.         set { SetTag("userName", value); }
  13.     }
  14. }

Then you can just add a Dialogue as a child to an Iq Element.
When you register the Dialogue in the Factory you can easily retrieve it from an Iq
Avatar
bilalkhan #5
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
thanks alex you rock :)
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