1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/*
Jabber Protocol Plugin for Miranda IM
Copyright ( C ) 2002-04 Santithorn Bunchua
Copyright ( C ) 2005-06 George Hazan
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or ( at your option ) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
File name : $Source: /cvsroot/miranda/miranda/protocols/JabberG/jabber_xmlns.cpp,v $
Revision : $Revision: 3651 $
Last change on : $Date: 2006-08-30 16:54:52 +0400 (Срд, 30 Авг 2006) $
Last change by : $Author: ghazan $
*/
#include "jabber.h"
/////////////////////////////////////////////////////////////////////////////////////////
// JabberXmlnsBrowse
void JabberXmlnsBrowse( XmlNode *iqNode, void *userdata )
{
XmlNode *queryNode;
TCHAR *xmlns, *iqFrom, *iqType;
if ( iqNode == NULL ) return;
if (( iqFrom=JabberXmlGetAttrValue( iqNode, "from" )) == NULL ) return;
if (( iqType=JabberXmlGetAttrValue( iqNode, "type" )) == NULL ) return;
if (( queryNode=JabberXmlGetChild( iqNode, "query" )) == NULL ) return;
if (( xmlns=JabberXmlGetAttrValue( queryNode, "xmlns" )) == NULL ) return;
if ( !_tcscmp( iqType, _T("get"))) {
XmlNodeIq iq( "result", JabberXmlGetAttrValue( iqNode, "id" ), iqFrom );
XmlNode* user = iq.addChild( "user" ); user->addAttr( "jid", jabberJID ); user->addAttr( "type", "client" ); user->addAttr( "xmlns", xmlns );
user->addChild( "ns", "http://jabber.org/protocol/disco#info" );
user->addChild( "ns", "http://jabber.org/protocol/muc" );
user->addChild( "ns", "jabber:iq:agents" );
user->addChild( "ns", "jabber:iq:browse" );
user->addChild( "ns", "jabber:iq:oob" );
user->addChild( "ns", "jabber:iq:version" );
user->addChild( "ns", "jabber:x:data" );
user->addChild( "ns", "jabber:x:event" );
user->addChild( "ns", "vcard-temp" );
JabberSend( jabberThreadInfo->s, iq );
} }
/////////////////////////////////////////////////////////////////////////////////////////
// JabberXmlnsDisco
static void sttAddFeature( XmlNode* n, char* text )
{
XmlNode* f = n->addChild( "feature" ); f->addAttr( "var", text );
}
void JabberXmlnsDisco( XmlNode *iqNode, void *userdata )
{
XmlNode *queryNode;
TCHAR *xmlns, *p, *discoType;
TCHAR *iqFrom, *iqType;
if ( iqNode == NULL ) return;
if (( iqFrom = JabberXmlGetAttrValue( iqNode, "from" )) == NULL ) return;
if (( iqType = JabberXmlGetAttrValue( iqNode, "type" )) == NULL ) return;
if (( queryNode = JabberXmlGetChild( iqNode, "query" )) == NULL ) return;
if (( xmlns = JabberXmlGetAttrValue( queryNode, "xmlns" )) == NULL ) return;
p = _tcsrchr( xmlns, '/' );
discoType = _tcsrchr( xmlns, '#' );
if ( p==NULL || discoType==NULL || discoType < p )
return;
if ( !_tcscmp( iqType, _T("get"))) {
XmlNodeIq iq( "result", JabberXmlGetAttrValue( iqNode, "id" ), iqFrom );
if ( !_tcscmp( discoType, _T("#info"))) {
XmlNode* query = iq.addChild( "query" ); query->addAttr( "xmlns", xmlns );
XmlNode* ident = query->addChild( "identity" ); ident->addAttr( "category", "user" );
ident->addAttr( "type", "client" ); ident->addAttr( "name", "Miranda" );
sttAddFeature( query, "http://jabber.org/protocol/disco#info" );
sttAddFeature( query, "http://jabber.org/protocol/muc" );
sttAddFeature( query, "http://jabber.org/protocol/si" );
sttAddFeature( query, "http://jabber.org/protocol/si/profile/file-transfer" );
sttAddFeature( query, "http://jabber.org/protocol/bytestreams" );
sttAddFeature( query, "http://jabber.org/protocol/chatstates" );
sttAddFeature( query, "jabber:iq:agents" );
sttAddFeature( query, "jabber:iq:browse" );
sttAddFeature( query, "jabber:iq:oob" );
sttAddFeature( query, "jabber:iq:version" );
sttAddFeature( query, "jabber:x:data" );
sttAddFeature( query, "jabber:x:event" );
sttAddFeature( query, "vcard-temp" );
}
JabberSend( jabberThreadInfo->s, iq );
} }
|