2
* $Id: oob.c,v 1.3 2009/04/03 11:21:35 cdidier Exp $
4
* Copyright (C) 2007,2008,2009 Colin DIDIER
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License along
16
* with this program; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
* XEP-0066: Out of Band Data
27
#include "xmpp-servers.h"
31
#define XMLNS_OOB_X "jabber:x:oob"
32
#define XMLNS_OOB_IQ "jabber:iq:oob"
35
sig_recv_x(XMPP_SERVER_REC *server, LmMessage *lmsg, const int type,
36
const char *id, const char *from, const char *to)
38
LmMessageNode *node, *child;
39
const char *url, *desc;
40
char *url_recoded, *desc_recoded, *str;
42
node = lm_find_node(lmsg->node, "x", XMLNS, XMLNS_OOB_X);
44
child = lm_message_node_get_child(node, "url");
45
if (child == NULL || child->value == NULL)
48
child = lm_message_node_get_child(node, "desc");
49
desc = child != NULL ? child->value : NULL;
50
url_recoded = xmpp_recode_in(url);
52
desc_recoded = xmpp_recode_in(desc);
53
str = g_strconcat(desc_recoded, ": ", url_recoded);
58
signal_emit("message private", 4, server, str, from, from);
66
disco_add_feature(XMLNS_OOB_X);
67
signal_add("xmpp recv message", sig_recv_x);
68
signal_add("xmpp recv presence", sig_recv_x);
74
signal_remove("xmpp recv message", sig_recv_x);
75
signal_remove("xmpp recv presence", sig_recv_x);