Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
skhanna #1
Member since Jul 2016 · 73 posts · Location: Indore
Group memberships: Members
Show profile · Link to this post
Subject: Custom Attribute in Send Message Stanza
Hi Alex,

I want to add my custom attribute in send message stanza xml. How to do that through matrix library. Ex.



Thanks,
Khanna Khanna
Avatar
Alex #2
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
this is described here:
http://www.ag-software.net/matrix-xmpp-sdk/matrix-develope…
Avatar
skhanna #3
Member since Jul 2016 · 73 posts · Location: Indore
Group memberships: Members
Show profile · Link to this post
Hi Alex

Thanks! I read this link but not clear how to add my cusotome element in existing message stanza. Like
Default Message Stanza is

  1. <message xmlns="jabber:client" to="30f0b810-e009-4763-9925-4b461b6472dc@eworkplace0/7i7zur73u0" type="groupchat" from="41fc94d4-9aa9-4be9-bfb9-1dc10b2c3657@conference.eworkplace0/Sanjeev"><body>7777</body>
  2. </message>

I want to modify like (Add sendername element)

  1. <message xmlns="jabber:client" to="30f0b810-e009-4763-9925-4b461b6472dc@eworkplace0/7i7zur73u0" type="groupchat" from="41fc94d4-9aa9-4be9-bfb9-1dc10b2c3657@conference.eworkplace0/Sanjeev" sendername="sanjeev"><body>7777</body>
  2. </message>

Thanks,
Sanjeev
This post was edited 2 times, last on 2016-08-02, 15:47 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You should not add custom stuff to the root element message. In the link I posted before its described in detail.
Why do you need a sender name? You specify the name when you join the group chat room.

See your resource:
41fc94d4-9aa9-4be9-bfb9-1dc10b2c3657@conference.eworkplace0/Sanjeev
Avatar
skhanna #5
Member since Jul 2016 · 73 posts · Location: Indore
Group memberships: Members
Show profile · Link to this post
Alex,

sendername is just example. We want to add more elements like database messageId..... Our xml requirement is to add in root message  element. Is there any way, we can achieve it?

Thanks,
Sanjeev
Avatar
Alex #6
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by skhanna:
.... Our xml requirement is to add in root message  element. Is there any way, we can achieve it?

this is not a good idea.

You can do:
  1. msg.SetAttribute("foo", "bar");
  2.  
  3. var val = msg.GetAttribute("foo");
Avatar
skhanna #7
Member since Jul 2016 · 73 posts · Location: Indore
Group memberships: Members
Show profile · Link to this post
Thanks Alex.

In future I will remove and use separate tag for custom attribute.
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