Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
gauravbr #1
Member since Mar 2009 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: Which event is raised on Joining Chat room
Hi Alex,

I am writing a code where an user logs in the jabber server should be directly diverted to a chat room by default.

So I have written a code
private void JoinChatRoom()
        {
            MucManager muc = new MucManager(_xmppClient);
            string roomId = "room1@conference.machine1";
            Jid m_RoomJid = new Jid(roomId);
            muc.EnterRoom(m_RoomJid, _jid.User,true);
            Presence pres = new Presence();
            pres.To = m_RoomJid;
            pres.Add(muc);
            _xmppClient.Send(pres);
        }

I am calling the above code on
void _xmppClient_OnRosterEnd(object sender, Matrix.EventArgs e)
        {
               JoinChatRoom();
}

I want to know what event is raised when a user is authenticated and joined to a Chat Room.

Thanks in advance.

-Gaurav
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
  1. private void JoinChatRoom()
  2. {
  3.     MucManager muc = new MucManager(_xmppClient);
  4.     string roomId = "room1@conference.machine1";
  5.     Jid m_RoomJid = new Jid(roomId);
  6.     muc.EnterRoom(m_RoomJid, _jid.User,true);           
  7. }

I fixed your code. This is how you join a conference.

Quote by gauravbr:
I want to know what event is raised when a user is authenticated and joined to a Chat Room.

there is no direct event because joining a room is based on presence. Presence is no request-response mechanism like Iq. On success you get back all presences from participants in the room. On failure you get an error presence packet from the room. SO you logic must be in the OnPresence handler. You have to filter presences from the Muc room. I suggest the BareJidComparer for this.

Alex
Avatar
MohamedMonem #3
Member since Jun 2009 · 1 post
Group memberships: Members
Show profile · Link to this post
MucManager does not contain a definition for 'EnterRoom' , what can I do ?!!!!!
Avatar
Alex #4
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
it's EnterRoom in MatriX and JoinRoom in agsXMPP.
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