author | Nicolas Cornu <nicolas.cornu@ensi-bourges.fr> |
Tue, 25 May 2010 16:44:52 +0200 | |
changeset 5 | 2155c65c7455 |
parent 3 | 46a9e1c8181f |
child 6 | a035ec60dc7f |
permissions | -rw-r--r-- |
1
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
1 |
/* |
2
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
2 |
* jingle.c -- Base jingle functions |
1
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
3 |
* |
2
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
4 |
* Copyrigth (C) 2010 Nicolas Cornu <nicolas.cornu@ensi-bourges.fr> |
1
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
5 |
* |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
7 |
* it under the terms of the GNU General Public License as published by |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
8 |
* the Free Software Foundation; either version 2 of the License, or (at |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
9 |
* your option) any later version. |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
10 |
* |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
11 |
* This program is distributed in the hope that it will be useful, but |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
12 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
14 |
* General Public License for more details. |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
15 |
* |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
17 |
* along with this program; if not, write to the Free Software |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
19 |
* USA |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
20 |
*/ |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
21 |
|
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
22 |
#include <glib.h> |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
23 |
#include <loudmouth/loudmouth.h> |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
24 |
#include <string.h> |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
25 |
|
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
26 |
#include <mcabber/xmpp.h> |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
27 |
#include <mcabber/hooks.h> |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
28 |
#include <mcabber/modules.h> |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
29 |
#include <mcabber/logprint.h> |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
30 |
|
2
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
31 |
#include "jingle.h" |
3 | 32 |
#include "parse.h" |
2
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
33 |
|
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
34 |
|
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
35 |
static void mcjingle_init (void); |
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
36 |
static void mcjingle_uninit(void); |
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
37 |
|
1
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
38 |
|
2
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
39 |
LmMessageHandler* jingle_iq_handler = NULL; |
1
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
40 |
|
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
41 |
|
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
42 |
module_info_t info_jingle = { |
3 | 43 |
.branch = MCABBER_BRANCH, |
44 |
.api = MCABBER_API_VERSION, |
|
45 |
.version = MCABBER_VERSION, |
|
46 |
.description = "Main Jingle module\n" |
|
47 |
" required for file transport, voip...\n", |
|
48 |
.requires = NULL, |
|
49 |
.init = mcjingle_init, |
|
50 |
.uninit = mcjingle_uninit, |
|
51 |
.next = NULL, |
|
1
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
52 |
}; |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
53 |
|
2
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
54 |
|
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
55 |
LmHandlerResult jingle_iq_event_handler(LmMessageHandler *handler, |
3 | 56 |
LmConnection *connection, |
57 |
LmMessage *message, |
|
58 |
gpointer user_data) |
|
2
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
59 |
{ |
3 | 60 |
LmMessageNode *test = lm_message_get_node(message)->children; |
61 |
struct info_iq ii; |
|
62 |
struct info_jingle ij; |
|
63 |
||
64 |
parse_iq(lm_message_get_node(message), &ii); |
|
65 |
||
66 |
if (parse_jingle(test, &ij) == PARSE_ERROR_NAME) |
|
67 |
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; |
|
68 |
||
69 |
if (strcmp(lm_message_node_get_attribute(test, "xmlns"), NS_JINGLE)) { |
|
70 |
scr_log_print(LPRINT_NORMAL, "jingle : Namespace inconnu (%s)", lm_message_node_get_attribute(test, "xmlns")); |
|
71 |
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; |
|
72 |
} |
|
2
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
73 |
|
3 | 74 |
if (!strcmp(ij.action, "content-accept")) { |
75 |
} else if (!strcmp(ij.action, "content-add")) { |
|
76 |
} else if (!strcmp(ij.action, "content-modify")) { |
|
77 |
} else if (!strcmp(ij.action, "content-reject")) { |
|
78 |
} else if (!strcmp(ij.action, "content-remove")) { |
|
79 |
} else if (!strcmp(ij.action, "description-info")) { |
|
80 |
} else if (!strcmp(ij.action, "security-info")) { |
|
81 |
} else if (!strcmp(ij.action, "session-accept")) { |
|
82 |
} else if (!strcmp(ij.action, "session-info")) { |
|
83 |
} else if (!strcmp(ij.action, "session-initiate")) { |
|
84 |
} else if (!strcmp(ij.action, "session-terminate")) { |
|
85 |
} else if (!strcmp(ij.action, "transport-accept")) { |
|
86 |
} else if (!strcmp(ij.action, "transport-info")) { |
|
87 |
} else if (!strcmp(ij.action, "transport-reject")) { |
|
88 |
} else if (!strcmp(ij.action, "transport-replace")) { |
|
89 |
} |
|
1
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
90 |
} |
2
a48121a74017
Clean up the code, fix the coding style and improve the CMakeLists
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
1
diff
changeset
|
91 |
|
1
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
92 |
static void mcjingle_init(void) |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
93 |
{ |
3 | 94 |
jingle_iq_handler = lm_message_handler_new(jingle_iq_event_handler, NULL, NULL); |
95 |
lm_connection_register_message_handler(lconnection, jingle_iq_handler, LM_MESSAGE_TYPE_IQ, LM_HANDLER_PRIORITY_FIRST); |
|
1
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
96 |
} |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
97 |
|
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
98 |
static void mcjingle_uninit(void) |
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
99 |
{ |
3 | 100 |
lm_connection_unregister_message_handler(lconnection, jingle_iq_handler, LM_MESSAGE_TYPE_IQ); |
101 |
lm_message_handler_invalidate(jingle_iq_handler); |
|
102 |
lm_message_handler_unref(jingle_iq_handler); |
|
1
6a9a25d32364
Add the parser of node and the CMakeList.txt
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
103 |
} |