Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
ramtin #1
User title: RamTin
Member since Mar 2013 · 26 posts
Group memberships: Members
Show profile · Link to this post
Subject: Send Message To all users in contact list
I Want Make A Section In My Software For This : Send Message For All Contact List With Set Timer Like : 3second or 4second

How can i make this ?

Thank you
This post was edited on 2013-03-28, 10:17 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
there is no feature in XMPP which allows you to broadcast a message to all your contacts automatically at once.
You need a list where you store all your contacts. Then you can create a loop over your list and create a new message object for each entry and send the message.
Avatar
neoXMPP #3
Member since May 2013 · 14 posts
Group memberships: Members
Show profile · Link to this post
While not possible directly, you can store the roster items in a List and send messages to List items every 3 seconds.
Avatar
Alex #4
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
There are also extensions for this which I forgot to mention.
e.g. XEP-0033: Extended Stanza Addressing

When you server supports this then you can add multiple to addresses to a message for example.
Avatar
atmchuck #5
Member since Jul 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
Alex,
I see your reference here to Multicast, and am wondering if you have a simple example? I'm looking through the documentation (and VS Intellisense) now, and will post a sample here if I get something working. Any help is appreciated.
Thanks,
Chuck
Avatar
Alex #6
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
here is an example for XEP-0033: Extended Stanza Addressing:

  1. var addresses = new Addresses();
  2. addresses.AddAddress(new Address
  3.               {
  4.                   Type = Type.to,
  5.                   Jid = "hildjj@jabber.org/Work",
  6.                   Description = "Joe Hildebrand"
  7.               });
  8.  
  9. addresses.AddAddress(new Address
  10.         {
  11.             Type = Type.cc,
  12.             Jid = "jer@jabber.org/Home",
  13.             Description = "Jeremie Miller"
  14.         });
  15.  
  16. var msg = new Matrix.Xmpp.Client.Message();
  17.  
  18. msg.Add(addresses);
  19. msg.To = "multicast.jabber.org";
  20. msg.Body = "Hello, world!";

builds the following Xml:

  1. <message to='multicast.jabber.org'>
  2.    <addresses xmlns='http://jabber.org/protocol/address'>
  3.        <address type='to' jid='hildjj@jabber.org/Work' desc='Joe Hildebrand'/>
  4.        <address type='cc' jid='jer@jabber.org/Home' desc='Jeremie Miller'/>
  5.    </addresses>
  6.    <body>Hello, world!</body>
  7. </message>
Avatar
atmchuck #7
Member since Jul 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
Alex,
Thanks very much for the reply! I was only one line of code away from what you had; I was missing the msg.Add. So, I'm getting closer, but am still not seeing my message sent. Can you tell me the significance of the property To on the Message Class? You are setting the value to "multicast.jabber.org". I've tried a few different values for the To property, and suspect that this is where my problem lies. I've included the XML for my message below. Can you offer any advice?
Thanks,
Chuck

  1. <message to="jig.asdf.com"><addresses xmlns="http://jabber.org/protocol/address"><address jid="cmiller@jig.asdf.com/" type="to" /><address jid="anotheruser@jig.asdf.com/" type="cc" /></addresses><body>Hey12</body></message>
Avatar
Alex #8
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You need a server software which supports this special extension.

Normally when your server domain is mydomain.com and your server supports this extension then this extension has its own address  in form of a XMPP Jid (subdomain) e.g. multicast.mydomain.com. And you have to send the message to this Jid.

So you have to figure out if:
a) your server supports this extension
b) what the jid of yours server multicast component is

Alex
Avatar
atmchuck #9
Member since Jul 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
Great, and thanks for the very quick reply. I should have mentioned that I am using OpenFire. I'll go dig in to that to find more about Multicast, and re-post what I find. Again, I appreciate the quick response.
Avatar
Alex #10
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
according to this page its supported by Openfire:
http://www.igniterealtime.org/builds/openfire/docs/latest/…
Avatar
atmchuck #11
Member since Jul 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
I'd found the same post, and initially expected that I needed to do nothing for OpenFire to support a Multicast message. However, I'm still seeing a non-response from Openfire when I send the message shown below. I've posted a question to the OpenFire forum. That said, I see alot of unanswered posts there referencing XEP-0033, we'll see. Thanks for your replies.

EDIT: I got it to work. Once I found my way through the server logs, I see that my Address value were missing the Resource property, causing the JID string value to end with a "/". The trailing slash made OpenFire unhappy. Once I specified a value for Resource on the Jid constructor, it began to work. Thanks for your help.
This post was edited on 2013-07-17, 19:33 by atmchuck.
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: