comparison libpurple/protocols/jabber/usermood.c @ 29857:f3654983e1da

Implemented the get_moods prpl function for XMPP. Enables the generic mood chooser. Doesn't actually work yet...
author Marcus Lundblad <ml@update.uu.se>
date Mon, 08 Feb 2010 21:38:26 +0000
parents a538cb73f897
children 65004796201d
comparison
equal deleted inserted replaced
29856:22938670285d 29857:f3654983e1da
117 {"worried", N_("Worried"), NULL}, 117 {"worried", N_("Worried"), NULL},
118 /* Mark the last record. */ 118 /* Mark the last record. */
119 {NULL, NULL, NULL} 119 {NULL, NULL, NULL}
120 }; 120 };
121 121
122 static PurpleMood empty_moods[] = {
123 {NULL, NULL, NULL}
124 };
125
122 static void jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) { 126 static void jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) {
123 /* it doesn't make sense to have more than one item here, so let's just pick the first one */ 127 /* it doesn't make sense to have more than one item here, so let's just pick the first one */
124 xmlnode *item = xmlnode_get_child(items, "item"); 128 xmlnode *item = xmlnode_get_child(items, "item");
125 const char *newmood = NULL; 129 const char *newmood = NULL;
126 char *moodtext = NULL; 130 char *moodtext = NULL;
250 254
251 jabber_pep_publish(js, publish); 255 jabber_pep_publish(js, publish);
252 /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free 256 /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free
253 (yay for well-defined memory management rules) */ 257 (yay for well-defined memory management rules) */
254 } 258 }
259
260 PurpleMood *jabber_get_moods(PurpleAccount *account)
261 {
262 PurpleConnection *gc = purple_account_get_connection(account);
263 JabberStream *js = (JabberStream *) gc->proto_data;
264
265 if (js->pep) {
266 purple_debug_info("jabber", "get_moods: account supports PEP\n");
267 return moods;
268 } else {
269 purple_debug_info("jabber", "get_moods: account doesn't support PEP\n");
270 return empty_moods;
271 }
272 }