|
1 /* |
|
2 * send.c |
|
3 * |
|
4 * Copyrigth (C) 2010 Nicolas Cornu <nicolas.cornu@ensi-bourges.fr> |
|
5 * |
|
6 * This program is free software; you can redistribute it and/or modify |
|
7 * it under the terms of the GNU General Public License as published by |
|
8 * the Free Software Foundation; either version 2 of the License, or (at |
|
9 * your option) any later version. |
|
10 * |
|
11 * This program is distributed in the hope that it will be useful, but |
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 * General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU General Public License |
|
17 * along with this program; if not, write to the Free Software |
|
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
|
19 * USA |
|
20 */ |
|
21 |
|
22 #include <glib.h> |
|
23 #include <loudmouth/loudmouth.h> |
|
24 |
|
25 #include <jingle/send.h> |
|
26 |
|
27 void jingle_send_session_terminate(const LmMessage *m, const gchar *reason) { |
|
28 LmMessage *r; |
|
29 LmMessageNode *err; |
|
30 |
|
31 r = lm_message_new_iq_from_query(m, LM_MESSAGE_SUB_TYPE_SET); |
|
32 |
|
33 if(reason != NULL) { |
|
34 err = lm_message_node_add_child(r->node, "reason", NULL); |
|
35 lm_message_node_add_child(err, reason, NULL); |
|
36 } |
|
37 |
|
38 // TODO vérifier que reason est connu |
|
39 |
|
40 if (r) { |
|
41 lm_connection_send(lconnection, r, NULL); |
|
42 lm_message_unref(r); |
|
43 } |
|
44 } |