[JDEV] message format to create a chatgroup

rdeng rdeng at sttarfire.com
Tue Dec 5 01:59:08 CST 2000


Hi, Everybody:

I am using jabberbeans to implement a jabber chat client..
Now I finished the private chat and online/offline tracking thanks to jabberbeans classes.

But when I try to implement group chat, I got some problem.
I have attached my function implementation below.

when I start two clients to join the same group and each send a message to
the group, what happen is the group chat message is forwarded only to the
message creator himself ! (it seems the server does not broadcast the group
chat message).

Below is my code snippet:
(1) client dennis:

jb4im.joinGroupChat("sttarfire", "10.90.15.76", "dennis");
jb4im.sendGroupChatMsg("sttarfire", "10.90.15.76",
          "group-subject", "group message from " + "dennis");

(2)client smith:

jb4im.joinGroupChat("sttarfire", "10.90.15.76", "smith");
jb4im.sendGroupChatMsg("sttarfire", "10.90.15.76",
          "group-subject", "group message from " + "smith");

It turns out message "group message from smith" is only routed to smith
and message "group message from dennis" is routed only to dennis !

Would you please kindly help me: what is wrong with my implementation ?
Do I need to create the chat group before I join ? HOW ?

thanks

---Roger

below are the implementation of two functions:

(m_pb and m_cb are presence builder and connection builder respectively,
they are class private members and is initialized properly).

public boolean joinGroupChat(String groupName, String groupServer,
                                                String nickName)
{
    JID  to = null;
    to = new JID(groupName, groupServer, nickName);
    m_pb.reset();
    m_pb.setToAddress(to);
    m_pb.setType("available");

    m_cb.send(m_pb.build());
}

public boolean sendGroupChatMsg(String groupName, String groupServer,
         String subject, String body)
{
    m_mb.reset();
    m_mb.setToAddress(new JID(groupName, groupServer, null));
    m_mb.setType("groupchat");
    m_mb.setSubject(subject);
    m_mb.setBody(body);

    Message  msg=(Message)m_mb.build();
    m_cb.send(msg);
}



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.jabber.org/pipermail/jdev/attachments/20001205/0da07987/attachment-0002.htm>


More information about the JDev mailing list