jabberd2
2.2.17
Main Page
Data Structures
Files
File List
Globals
sx
address.c
Go to the documentation of this file.
1
/*
2
* jabberd - Jabber Open Source Server
3
* Copyright (c) 2007 Tomasz Sterna
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; version 2 of the License
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
17
*/
18
19
/*
20
* this sx plugin implements My IP Address extension
21
* as described in http://delta.affinix.com/specs/xmppstream.html#myip
22
*/
23
24
#include "
sx.h
"
25
27
static
void
_sx_address_features
(
sx_t
s,
sx_plugin_t
p,
nad_t
nad) {
28
int
ns;
29
30
/* offer feature only when not authenticated yet */
31
if
(s->
state
>=
state_OPEN
)
32
return
;
33
34
_sx_debug
(
ZONE
,
"adding address feature"
);
35
36
ns =
nad_add_namespace
(nad,
uri_ADDRESS_FEATURE
, NULL);
37
nad_append_elem
(nad, ns,
"address"
, 1);
38
nad_append_cdata
(nad, s->
ip
, strlen(s->
ip
), 2);
39
}
40
42
int
sx_address_init
(
sx_env_t
env,
sx_plugin_t
p, va_list args) {
43
log_debug
(
ZONE
,
"initialising address sx plugin"
);
44
45
p->
features
=
_sx_address_features
;
46
47
return
0;
48
}
Generated by
1.8.1.1