libpurple/protocols/myspace/myspace.c

branch
soc.2007.msimprpl
changeset 19507
5489112d974c
parent 19506
0e4b5fe04c11
child 19509
75059eaf1be9
equal deleted inserted replaced
19506:0e4b5fe04c11 19507:5489112d974c
285 /** Get zap types. */ 285 /** Get zap types. */
286 GList * 286 GList *
287 msim_attention_types(PurpleAccount *acct) 287 msim_attention_types(PurpleAccount *acct)
288 { 288 {
289 static GList *types = NULL; 289 static GList *types = NULL;
290 PurpleAttentionType* attn; 290 MsimAttentionType* attn;
291 291
292 if (!types) { 292 if (!types) {
293 #define _MSIM_ADD_NEW_ATTENTION(icn, des, incoming, outgoing) \ 293 #define _MSIM_ADD_NEW_ATTENTION(icn, des, incoming, outgoing) \
294 attn = g_new0(PurpleAttentionType, 1); \ 294 attn = g_new0(MsimAttentionType, 1); \
295 attn->icon = icn; \ 295 attn->icon = icn; \
296 attn->description = des; \ 296 attn->description = des; \
297 attn->incoming_description = incoming; \ 297 attn->incoming_description = incoming; \
298 attn->outgoing_description = outgoing; \ 298 attn->outgoing_description = outgoing; \
299 types = g_list_append(types, attn); 299 types = g_list_append(types, attn);
318 gboolean 318 gboolean
319 msim_send_attention(PurpleConnection *gc, gchar *username, guint code) 319 msim_send_attention(PurpleConnection *gc, gchar *username, guint code)
320 { 320 {
321 GList *types; 321 GList *types;
322 MsimSession *session; 322 MsimSession *session;
323 PurpleAttentionType *attn; 323 MsimAttentionType *attn;
324 PurpleBuddy *buddy; 324 PurpleBuddy *buddy;
325 325
326 session = (MsimSession *)gc->proto_data; 326 session = (MsimSession *)gc->proto_data;
327 327
328 /* Look for this attention type, by the code index given. */ 328 /* Look for this attention type, by the code index given. */
329 types = msim_attention_types(gc->account); 329 types = msim_attention_types(gc->account);
330 attn = (PurpleAttentionType *)g_list_nth_data(types, code); 330 attn = (MsimAttentionType *)g_list_nth_data(types, code);
331 331
332 if (!attn) { 332 if (!attn) {
333 purple_debug_info("msim_send_attention", "got invalid zap code %d\n", code); 333 purple_debug_info("msim_send_attention", "got invalid zap code %d\n", code);
334 return FALSE; 334 return FALSE;
335 } 335 }
337 buddy = purple_find_buddy(session->account, username); 337 buddy = purple_find_buddy(session->account, username);
338 if (!buddy) { 338 if (!buddy) {
339 return FALSE; 339 return FALSE;
340 } 340 }
341 341
342 /* TODO: make use of the PurpleAttentionType we found, instead of 342 /* TODO: make use of the MsimAttentionType we found, instead of
343 * doing it all over in msim_send_zap_from_menu. */ 343 * doing it all over in msim_send_zap_from_menu. */
344 msim_send_zap_from_menu(&buddy->node, GUINT_TO_POINTER(code)); 344 msim_send_zap_from_menu(&buddy->node, GUINT_TO_POINTER(code));
345 345
346 return TRUE; 346 return TRUE;
347 } 347 }
353 gchar *zap_string; 353 gchar *zap_string;
354 #ifndef MSIM_USE_ATTENTION_API 354 #ifndef MSIM_USE_ATTENTION_API
355 gchar *zap_description; 355 gchar *zap_description;
356 #endif 356 #endif
357 GList *types; 357 GList *types;
358 PurpleAttentionType *attn; 358 MsimAttentionType *attn;
359 gboolean rc; 359 gboolean rc;
360 360
361 g_return_val_if_fail(session != NULL, FALSE); 361 g_return_val_if_fail(session != NULL, FALSE);
362 g_return_val_if_fail(username != NULL, FALSE); 362 g_return_val_if_fail(username != NULL, FALSE);
363 363
447 /* Names from official client. */ 447 /* Names from official client. */
448 types = msim_attention_types(NULL); 448 types = msim_attention_types(NULL);
449 i = 0; 449 i = 0;
450 do 450 do
451 { 451 {
452 PurpleAttentionType *attn; 452 MsimAttentionType *attn;
453 453
454 attn = (PurpleAttentionType *)types->data; 454 attn = (MsimAttentionType *)types->data;
455 zap_names[i] = attn->description; 455 zap_names[i] = attn->description;
456 ++i; 456 ++i;
457 } while ((types = g_list_next(types))); 457 } while ((types = g_list_next(types)));
458 458
459 menu = zap_menu = NULL; 459 menu = zap_menu = NULL;
1684 { 1684 {
1685 gchar *msg_text, *username; 1685 gchar *msg_text, *username;
1686 gint zap; 1686 gint zap;
1687 const gchar *zap_past_tense[10]; 1687 const gchar *zap_past_tense[10];
1688 #ifdef MSIM_USE_ATTENTION_API 1688 #ifdef MSIM_USE_ATTENTION_API
1689 PurpleAttentionType attn; 1689 MsimAttentionType attn;
1690 #else 1690 #else
1691 gchar *zap_text; 1691 gchar *zap_text;
1692 #endif 1692 #endif
1693 1693
1694 zap_past_tense[0] = _("zapped"); 1694 zap_past_tense[0] = _("zapped");

mercurial