Home
XmppDotNet
MatriX XMPP SDK ▼
Forum
About us ▼
Contact
Not logged in.
·
Lost password
·
Registration disabled
Forum
Search
Members
Forum:
agsXMPP
muc invitation to join
join room
rhaibi
2015-06-24, 15:59
#1
Member since Jun 2015 ·
5
posts
Group memberships:
Members
Show profile
·
Link to this post
Subject:
muc invitation to join
how to invite a user to join a room and which event catch the invitation when it received by the other user?
thanks
Alex
2015-06-25, 02:01
#2
Member since Feb 2003 ·
4449
posts · Location: Germany
Group memberships:
Administrators, Members
Show profile
·
Link to this post
see here:
http://forum.ag-software.net/thread/1762-Force-join-JIDs-t…
the invite is coming in as a message in the OnMessage event.
rhaibi
2015-06-30, 18:41
#3
Member since Jun 2015 ·
5
posts
Group memberships:
Members
Show profile
·
Link to this post
Thanks for your replay
I successfully invited a user but when I try to join to user to the conference it seems that it's not working
this the code for the invitation :
MucManager muc
=
new
MucManager
(
GlobalVar
.
XmppCon
)
;
String
roomname
=
GlobalVar
.
userconnected
.
UserName
+
GlobalVar
.
rdm
.
Next
(
3000
)
.
ToString
(
)
+
"@conference.srvopenfire.local"
;
Jid m_RoomJid
=
new
Jid
(
roomname
)
;
muc
.
JoinRoom
(
m_RoomJid, GlobalVar
.
userconnected
.
UserName
)
;
muc
.
CreateReservedRoom
(
m_RoomJid
)
;
string
toInvite
;
foreach
(
string
user
in
usersSelected
)
{
toInvite
=
user
+
"@srvopenfire.local"
;
muc
.
Invite
(
new
Jid
(
toInvite
)
, m_RoomJid,
"Reason"
)
;
}
in the other hand i try to catch up the invitation in the OnMessage as u said with this code :
MucManager muc
=
new
MucManager
(
GlobalVar
.
XmppCon
)
;
Jid m_RoomJid
=
msg
.
From
;
muc
.
JoinRoom
(
m_RoomJid, GlobalVar
.
userconnected
.
UserName
)
;
this is the xml debug when i try to join the room
RECV:
<message
from
=
"admin1192@conference.srvopenfire.local"
to
=
"yrhaibi@srvopenfire.local"
>
<x
xmlns
=
"http://jabber.org/protocol/muc#user"
>
<invite
from
=
"admin@srvopenfire.local"
>
<reason
>
Reason
</reason
>
</invite
>
</x
>
<x
xmlns
=
"jabber:x:conference"
jid
=
"admin1192@conference.srvopenfire.local"
/>
</message
>
SEND:
<presence
to
=
"admin1192@conference.srvopenfire.local/yrhaibi"
>
<x
xmlns
=
"http://jabber.org/protocol/muc"
/>
</presence
>
RECV:
<presence
to
=
"yrhaibi@srvopenfire.local/TAO"
from
=
"admin1192@conference.srvopenfire.local/yrhaibi"
type
=
"error"
>
<x
xmlns
=
"http://jabber.org/protocol/muc"
/>
<error
code
=
"404"
type
=
"cancel"
>
<item-not-found
xmlns
=
"urn:ietf:params:xml:ns:xmpp-stanzas"
/>
</error
>
</presence
>
This post was edited
3
times, last on 2015-06-30, 23:26 by
Alex
.
Alex
2015-07-01, 00:17
#4
Member since Feb 2003 ·
4449
posts · Location: Germany
Group memberships:
Administrators, Members
Show profile
·
Link to this post
looks to me like oyu try to enter the room which its not ready yet, still locked.
See also here:
http://xmpp.org/extensions/xep-0045.html#enter-locked
Alex
rhaibi
2015-07-01, 17:57
#5
Member since Jun 2015 ·
5
posts
Group memberships:
Members
Show profile
·
Link to this post
Alex Thank u so much you are life saver
indeed the room wasn't configured when I tried to join a user to it, so this how I configured the room :
private
void
OnRequestConfiguration
(
object
sender, IQ iq,
object
obj
)
{
OwnerIq oIq
=
new
OwnerIq
(
)
;
oIq
.
Type
=
IqType
.
set
;
oIq
.
To
=
new
Jid
(
roomName
)
;
Data xForm
=
new
Data
(
XDataFormType
.
form
)
;
xForm
.
Type
=
XDataFormType
.
submit
;
Field f_form
=
new
Field
(
FieldType
.
Hidden
)
;
f_form
.
Var
=
"FORM_TYPE"
;
f_form
.
Value
=
"http://jabber.org/protocol/muc#roomconfig"
;
xForm
.
AddField
(
f_form
)
;
//Field f_title = new Field(FieldType.Text_Single);
//f_title.Var = "muc#roomconfig_roomname";
//f_title.Value = "VS2013-1";
//xForm.AddField(f_title);
Field f_roomdesc
=
new
Field
(
FieldType
.
Text_Single
)
;
f_roomdesc
.
Var
=
"muc#roomconfig_roomdesc"
;
f_roomdesc
.
Value
=
GlobalVar
.
userconnected
.
UserName
+
" Created Room"
;
xForm
.
AddChild
(
f_roomdesc
)
;
Field f_changesubject
=
new
Field
(
FieldType
.
Boolean
)
;
f_changesubject
.
Var
=
"muc#roomconfig_changesubject"
;
f_changesubject
.
Value
=
"0"
;
xForm
.
AddChild
(
f_changesubject
)
;
Field f_public
=
new
Field
(
FieldType
.
Boolean
)
;
f_public
.
Var
=
"muc#roomconfig_publicroom"
;
f_public
.
Value
=
"0"
;
xForm
.
AddChild
(
f_public
)
;
Field f_moderatedroom
=
new
Field
(
FieldType
.
Boolean
)
;
f_moderatedroom
.
Var
=
"muc#roomconfig_moderatedroom"
;
f_moderatedroom
.
Value
=
"0"
;
xForm
.
AddChild
(
f_moderatedroom
)
;
Field f_allowinvites
=
new
Field
(
FieldType
.
Boolean
)
;
f_allowinvites
.
Var
=
"muc#roomconfig_allowinvites"
;
f_allowinvites
.
Value
=
"1"
;
xForm
.
AddChild
(
f_allowinvites
)
;
oIq
.
Query
.
AddChild
(
xForm
)
;
GlobalVar
.
XmppCon
.
IqGrabber
.
SendIq
(
oIq,
new
IqCB
(
OnRoomConfigResult
)
,
null
)
;
}
public
void
OnRoomConfigResult
(
object
sender, IQ iq,
object
data
)
{
if
(
iq
.
Type
==
IqType
.
result
)
{
//success
}
else
if
(
iq
.
Type
==
IqType
.
error
)
{
//error
}
}
after getting those methods done I called the RequestConfigurationForm method of the MucManager :
MucManager muc
=
new
MucManager
(
GlobalVar
.
XmppCon
)
;
string
roomID
=
GlobalVar
.
rdm
.
Next
(
3000
)
.
ToString
(
)
;
id
=
roomID
;
roomname
=
GlobalVar
.
userconnected
.
UserName
+
roomID
+
"@conference.srvopenfire.local"
;
Jid m_RoomJid
=
new
Jid
(
roomname
)
;
muc
.
JoinRoom
(
m_RoomJid,GlobalVar
.
userconnected
.
UserName
)
;
muc
.
RequestConfigurationForm
(
m_RoomJid,
new
IqCB
(
OnRequestConfiguration
)
YOUSSEF
This post was edited on 2015-07-01, 20:23 by
Alex
.
Close
Smaller –
Larger +
Reply to this post:
Verification code:
Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys:
Special characters:
Forum:
agsXMPP