Mercurial > pidgin
comparison libpurple/pounce.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | f75041cb3fec |
children |
comparison
equal
deleted
inserted
replaced
32818:01ff09d4a463 | 32819:2c6510167895 |
---|---|
30 | 30 |
31 #include "debug.h" | 31 #include "debug.h" |
32 #include "pounce.h" | 32 #include "pounce.h" |
33 #include "util.h" | 33 #include "util.h" |
34 | 34 |
35 /** | |
36 * A buddy pounce structure. | |
37 * | |
38 * Buddy pounces are actions triggered by a buddy-related event. For | |
39 * example, a sound can be played or an IM window opened when a buddy | |
40 * signs on or returns from away. Such responses are handled in the | |
41 * UI. The events themselves are done in the core. | |
42 */ | |
43 struct _PurplePounce | |
44 { | |
45 char *ui_type; /**< The type of UI. */ | |
46 | |
47 PurplePounceEvent events; /**< The event(s) to pounce on. */ | |
48 PurplePounceOption options; /**< The pounce options */ | |
49 PurpleAccount *pouncer; /**< The user who is pouncing. */ | |
50 | |
51 char *pouncee; /**< The buddy to pounce on. */ | |
52 | |
53 GHashTable *actions; /**< The registered actions. */ | |
54 | |
55 gboolean save; /**< Whether or not the pounce should | |
56 be saved after activation. */ | |
57 void *data; /**< Pounce-specific data. */ | |
58 }; | |
59 | |
35 typedef struct | 60 typedef struct |
36 { | 61 { |
37 GString *buffer; | 62 GString *buffer; |
38 | 63 |
39 PurplePounce *pounce; | 64 PurplePounce *pounce; |
178 | 203 |
179 node = xmlnode_new("pounce"); | 204 node = xmlnode_new("pounce"); |
180 xmlnode_set_attrib(node, "ui", pounce->ui_type); | 205 xmlnode_set_attrib(node, "ui", pounce->ui_type); |
181 | 206 |
182 child = xmlnode_new_child(node, "account"); | 207 child = xmlnode_new_child(node, "account"); |
183 xmlnode_set_attrib(child, "protocol", pouncer->protocol_id); | 208 xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(pouncer)); |
184 xmlnode_insert_data(child, | 209 xmlnode_insert_data(child, |
185 purple_normalize(pouncer, purple_account_get_username(pouncer)), -1); | 210 purple_normalize(pouncer, purple_account_get_username(pouncer)), -1); |
186 | 211 |
187 child = xmlnode_new_child(node, "pouncee"); | 212 child = xmlnode_new_child(node, "pouncee"); |
188 xmlnode_insert_data(child, purple_pounce_get_pouncee(pounce), -1); | 213 xmlnode_insert_data(child, purple_pounce_get_pouncee(pounce), -1); |
403 buffer = g_string_free(data->buffer, FALSE); | 428 buffer = g_string_free(data->buffer, FALSE); |
404 data->buffer = NULL; | 429 data->buffer = NULL; |
405 } | 430 } |
406 | 431 |
407 if (purple_strequal(element_name, "account")) { | 432 if (purple_strequal(element_name, "account")) { |
408 char *tmp; | |
409 g_free(data->account_name); | 433 g_free(data->account_name); |
410 data->account_name = g_strdup(buffer); | 434 data->account_name = g_strdup(buffer); |
411 tmp = data->protocol_id; | |
412 data->protocol_id = g_strdup(_purple_oscar_convert(buffer, tmp)); | |
413 g_free(tmp); | |
414 } | 435 } |
415 else if (purple_strequal(element_name, "pouncee")) { | 436 else if (purple_strequal(element_name, "pouncee")) { |
416 g_free(data->pouncee); | 437 g_free(data->pouncee); |
417 data->pouncee = g_strdup(buffer); | 438 data->pouncee = g_strdup(buffer); |
418 } | 439 } |