libpurple/protocols/msnp9/table.c

Sun, 11 Nov 2007 12:57:52 +0000

author
Stu Tomlinson <nosnilmot@pidgin.im>
date
Sun, 11 Nov 2007 12:57:52 +0000
changeset 21481
d52b697eaae7
permissions
-rw-r--r--

Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
old fools like me who prefer the stability of our MSNP9 code over the
features of MSNP14 can enable this using the --disable-msnp14 ./configure
option.

If we want to release from i.p.p and MSN stability is the only blocker, we
can trivially flick the default to use MSNP9 in configure.ac

21481
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
1 /**
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
2 * @file table.c MSN helper structure
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
3 *
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
4 * purple
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
5 *
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
8 * source distribution.
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
9 *
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
13 * (at your option) any later version.
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
14 *
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
18 * GNU General Public License for more details.
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
19 *
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
23 */
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
24 #include "msn.h"
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
25 #include "table.h"
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
26
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
27 static void
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
28 null_cmd_cb(MsnCmdProc *cmdproc, MsnCommand *cmd)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
29 {
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
30 }
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
31
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
32 static void
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
33 null_error_cb(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
34 {
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
35 }
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
36
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
37 MsnTable *
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
38 msn_table_new()
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
39 {
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
40 MsnTable *table;
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
41
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
42 table = g_new0(MsnTable, 1);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
43
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
44 table->cmds = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)g_hash_table_destroy);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
45 table->msgs = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
46 table->errors = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
47
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
48 table->async = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
49 table->fallback = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
50
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
51 return table;
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
52 }
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
53
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
54 void
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
55 msn_table_destroy(MsnTable *table)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
56 {
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
57 g_return_if_fail(table != NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
58
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
59 g_hash_table_destroy(table->cmds);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
60 g_hash_table_destroy(table->msgs);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
61 g_hash_table_destroy(table->errors);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
62
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
63 g_hash_table_destroy(table->async);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
64 g_hash_table_destroy(table->fallback);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
65
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
66 g_free(table);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
67 }
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
68
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
69 void
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
70 msn_table_add_cmd(MsnTable *table,
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
71 char *command, char *answer, MsnTransCb cb)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
72 {
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
73 GHashTable *cbs;
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
74
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
75 g_return_if_fail(table != NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
76 g_return_if_fail(answer != NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
77
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
78 cbs = NULL;
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
79
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
80 if (command == NULL)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
81 {
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
82 cbs = table->async;
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
83 }
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
84 else if (strcmp(command, "fallback") == 0)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
85 {
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
86 cbs = table->fallback;
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
87 }
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
88 else
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
89 {
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
90 cbs = g_hash_table_lookup(table->cmds, command);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
91
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
92 if (cbs == NULL)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
93 {
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
94 cbs = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
95 g_hash_table_insert(table->cmds, command, cbs);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
96 }
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
97 }
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
98
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
99 if (cb == NULL)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
100 cb = null_cmd_cb;
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
101
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
102 g_hash_table_insert(cbs, answer, cb);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
103 }
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
104
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
105 void
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
106 msn_table_add_error(MsnTable *table,
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
107 char *answer, MsnErrorCb cb)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
108 {
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
109 g_return_if_fail(table != NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
110 g_return_if_fail(answer != NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
111
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
112 if (cb == NULL)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
113 cb = null_error_cb;
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
114
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
115 g_hash_table_insert(table->errors, answer, cb);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
116 }
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
117
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
118 void
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
119 msn_table_add_msg_type(MsnTable *table,
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
120 char *type, MsnMsgTypeCb cb)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
121 {
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
122 g_return_if_fail(table != NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
123 g_return_if_fail(type != NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
124 g_return_if_fail(cb != NULL);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
125
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
126 #if 0
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
127 if (cb == NULL)
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
128 cb = null_msg_cb;
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
129 #endif
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
130
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
131 g_hash_table_insert(table->msgs, type, cb);
d52b697eaae7 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff changeset
132 }

mercurial