Hi;
What I am trying to do is :
1. in mod_muc_room.erl
there is -->
normal_state({route, From, ToNick, {xmlelement, "iq", Attrs, _Els} = Packet}, StateData) ->
Lang = xml:get_attr_s("xml:lang", Attrs),
StanzaId = xml:get_attr_s("id", Attrs),
and I'm trying to definition OS
so I do it like this -->
normal_state({route, From, ToNick, {xmlelement, "iq", Attrs, _Els} = Packet}, StateData) ->
Lang = xml:get_attr_s("xml:lang", Attrs),
StanzaId = xml:get_attr_s("id", Attrs),
OS = xml:get_subtag_cdata(Packet, "os"),
but it isn't work, how can I do it ? tnx.
What does not work ? What are
What does not work ? What are you trying to achieve ?
mremond wrote: What does not
What does not work ? What are you trying to achieve ?
I'm trying to define OS in mod_muc_room to get user's OS before joining room and print it.
More specifically: Is your
More specifically: Is your code crashing ? Is your OS tag not found ? What is your original XMPP packet looking like exactly ?
mremond wrote: More
More specifically: Is your code crashing ? Is your OS tag not found ? What is your original XMPP packet looking like exactly ?
Hi;
yes, OS tag not found. because nothing shown on terminal when I join.
I think this :
OS = xml:get_subtag_cdata(Packet, "os"),
not the correct way to definition the OSIt would be easier to help if
It would be easier to help if you could show the XMPP packet you are trying to parse. Can you please do that ?
mremond wrote: It would be
It would be easier to help if you could show the XMPP packet you are trying to parse. Can you please do that ?
Hi;
The idea is like any bot (iSida, gluxi, sulci ... etc) if u type to him this :
version mremond
it'll send u your version information like -->
name : Psi+
ver : 1.1
os : windows 8.1
Example --> I need this os :
windows 8.1
to print it when mremond joining the room, I need to definition the OSI don't know what do u mean the XMPP packet in this case can u explain me with some example please!
thank u
An XMPP Packet is the basis
An XMPP Packet is the basis of XMPP protocol. You should read more on xmpp.org.
Hi; Sorry for late. Xmpp
Hi;
Sorry for late.
Xmpp packet like this :
<query xmlns='http://jabber.org/protocol/disco#info'
node='http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w='>
<identity xml:lang='en' category='client' name='Psi 0.11' type='pc'/>
<identity xml:lang='el' category='client' name='Ψ 0.11' type='pc'/>
<feature var='http://jabber.org/protocol/caps'/>
<feature var='http://jabber.org/protocol/disco#info'/>
<feature var='http://jabber.org/protocol/disco#items'/>
<feature var='http://jabber.org/protocol/muc'/>
<x xmlns='jabber:x:data' type='result'>
<field var='FORM_TYPE' type='hidden'>
<value>urn:xmpp:dataforms:softwareinfo</value>
</field>
<field var='ip_version'>
<value>ipv4</value>
<value>ipv6</value>
</field>
<field var='os'>
<value>Windows 8.1</value>
</field>
<field var='os_version'>
<value>10.5.1</value>
</field>
<field var='software'>
<value>Psi</value>
</field>
<field var='software_version'>
<value>0.11</value>
</field>
</x>
</query>
What I'm looking for is get os like : Windows 8.1
<field var='os'>
<value>Windows 8.1</value><
I'm using ejabberd 15.09. The
I'm using ejabberd 15.09. The code is similar for older versions, you can reuse it.
This patch:
And I get something like this in the log:
Hi; Thank u I edited
Hi;
Thank u
I edited
mod_muc_room
like what u sayand add get_os function
%% get OS
get_os(Packet) ->
Q = xml:get_subtag(Packet, "query"),
O = xml:get_subtag(Q, "os"),
{ok, xml:get_tag_cdata(O)}.
trying :
Os = case catch get_os(Packet) of
{ok, Result} -> Result;
_ -> not_iq_version
end,
?INFO_MSG("OS is : ~p", [OS]),
also trying :
Os = case catch get_os(Packet) of
{ok, Result} -> Result;
_ -> not_iq_version
end,
?WARNING_MSG("OS is : ~p", [OS]),
so I run Ejabberd :
ejabberdctl live
. and when I'm joining to room no thing show to me in terminal.I'm using Ejabberd 2.1.x
How can I do it? thnx.
How can I do it? thnx.