Mercurial > pidgin.yaz
comparison pidgin/plugins/disco/xmppdisco.c @ 27158:abab554140b5
Make this whitespace a bit more consistent (I hope).
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 07 Jun 2009 22:07:07 +0000 |
parents | 0901c3662286 |
children | f5222e5ae468 |
comparison
equal
deleted
inserted
replaced
27157:c2c6ef44d66e | 27158:abab554140b5 |
---|---|
54 PurplePlugin *my_plugin = NULL; | 54 PurplePlugin *my_plugin = NULL; |
55 static GHashTable *iq_callbacks = NULL; | 55 static GHashTable *iq_callbacks = NULL; |
56 static gboolean iq_listening = FALSE; | 56 static gboolean iq_listening = FALSE; |
57 | 57 |
58 typedef void (*XmppIqCallback)(PurpleConnection *pc, const char *type, | 58 typedef void (*XmppIqCallback)(PurpleConnection *pc, const char *type, |
59 const char *id, const char *from, xmlnode *iq, | 59 const char *id, const char *from, xmlnode *iq, |
60 gpointer data); | 60 gpointer data); |
61 | 61 |
62 struct xmpp_iq_cb_data | 62 struct xmpp_iq_cb_data |
63 { | 63 { |
64 gpointer context; | 64 gpointer context; |
65 PurpleConnection *pc; | 65 PurpleConnection *pc; |
147 cbdata->pc = pc; | 147 cbdata->pc = pc; |
148 | 148 |
149 g_hash_table_insert(iq_callbacks, id, cbdata); | 149 g_hash_table_insert(iq_callbacks, id, cbdata); |
150 | 150 |
151 if (!iq_listening) { | 151 if (!iq_listening) { |
152 PurplePlugin *prpl = purple_plugins_find_with_id(XMPP_PLUGIN_ID); | 152 PurplePlugin *prpl = purple_plugins_find_with_id(XMPP_PLUGIN_ID); |
153 iq_listening = TRUE; | 153 iq_listening = TRUE; |
154 purple_signal_connect(prpl, "jabber-receiving-iq", my_plugin, | 154 purple_signal_connect(prpl, "jabber-receiving-iq", my_plugin, |
155 PURPLE_CALLBACK(xmpp_iq_received), NULL); | 155 PURPLE_CALLBACK(xmpp_iq_received), NULL); |
156 } | 156 } |
157 } | 157 } |
243 | 243 |
244 return XMPP_DISCO_SERVICE_TYPE_OTHER; | 244 return XMPP_DISCO_SERVICE_TYPE_OTHER; |
245 } | 245 } |
246 | 246 |
247 static const struct { | 247 static const struct { |
248 const char *from; | 248 const char *from; |
249 const char *to; | 249 const char *to; |
250 } disco_type_mappings[] = { | 250 } disco_type_mappings[] = { |
251 { "gadu-gadu", "gadu-gadu" }, /* the prpl is prpl-gg, but list_icon returns "gadu-gadu" */ | 251 { "gadu-gadu", "gadu-gadu" }, /* the prpl is prpl-gg, but list_icon returns "gadu-gadu" */ |
252 { "sametime", "meanwhile" }, | 252 { "sametime", "meanwhile" }, |
253 { "myspaceim", "myspace" }, | 253 { "myspaceim", "myspace" }, |
254 { "xmpp", "jabber" }, /* prpl-jabber (mentioned in case the prpl is renamed so this line will match) */ | 254 { "xmpp", "jabber" }, /* prpl-jabber (mentioned in case the prpl is renamed so this line will match) */ |
255 { NULL, NULL } | 255 { NULL, NULL } |
256 }; | 256 }; |
257 | 257 |
258 static const gchar * | 258 static const gchar * |
259 disco_type_from_string(const gchar *str) | 259 disco_type_from_string(const gchar *str) |
260 { | 260 { |
261 int i = 0; | 261 int i = 0; |
262 | 262 |
263 g_return_val_if_fail(str != NULL, ""); | 263 g_return_val_if_fail(str != NULL, ""); |
264 | 264 |
265 for ( ; disco_type_mappings[i].from; ++i) { | 265 for ( ; disco_type_mappings[i].from; ++i) { |
266 if (!strcasecmp(str, disco_type_mappings[i].from)) | 266 if (!strcasecmp(str, disco_type_mappings[i].from)) |
267 return disco_type_mappings[i].to; | 267 return disco_type_mappings[i].to; |
268 } | 268 } |
269 | 269 |
270 /* fallback to the string itself */ | 270 /* fallback to the string itself */ |
271 return str; | 271 return str; |
272 } | 272 } |
273 | 273 |
274 static void | 274 static void |
275 got_info_cb(PurpleConnection *pc, const char *type, const char *id, | 275 got_info_cb(PurpleConnection *pc, const char *type, const char *id, |
276 const char *from, xmlnode *iq, gpointer data) | 276 const char *from, xmlnode *iq, gpointer data) |
605 } | 605 } |
606 | 606 |
607 static gboolean | 607 static gboolean |
608 plugin_load(PurplePlugin *plugin) | 608 plugin_load(PurplePlugin *plugin) |
609 { | 609 { |
610 PurplePlugin *xmpp_prpl; | 610 PurplePlugin *xmpp_prpl; |
611 | 611 |
612 my_plugin = plugin; | 612 my_plugin = plugin; |
613 | 613 |
614 xmpp_prpl = purple_plugins_find_with_id(XMPP_PLUGIN_ID); | 614 xmpp_prpl = purple_plugins_find_with_id(XMPP_PLUGIN_ID); |
615 if (NULL == xmpp_prpl) | 615 if (NULL == xmpp_prpl) |
616 return FALSE; | 616 return FALSE; |
617 | 617 |
618 purple_signal_connect(purple_connections_get_handle(), "signing-off", | 618 purple_signal_connect(purple_connections_get_handle(), "signing-off", |
619 plugin, PURPLE_CALLBACK(signed_off_cb), NULL); | 619 plugin, PURPLE_CALLBACK(signed_off_cb), NULL); |
620 | 620 |
621 iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | 621 iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |