Mercurial > pidgin.yaz
comparison src/protocols/yahoo/yahoo.c @ 9283:66ff39319900
[gaim-migrate @ 10086]
Just some boring accessor function stuff. Move along folks.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Mon, 14 Jun 2004 16:44:32 +0000 |
parents | adde46ad65e9 |
children | fe0291162312 |
comparison
equal
deleted
inserted
replaced
9282:fe7db2ea4a1e | 9283:66ff39319900 |
---|---|
325 f->away = 0; | 325 f->away = 0; |
326 if (f->status == YAHOO_STATUS_IDLE) | 326 if (f->status == YAHOO_STATUS_IDLE) |
327 f->idle = time(NULL); | 327 f->idle = time(NULL); |
328 else | 328 else |
329 f->idle = 0; | 329 f->idle = 0; |
330 if (f->status != YAHOO_STATUS_CUSTOM) { | 330 if (f->status != YAHOO_STATUS_CUSTOM) |
331 g_free(f->msg); | 331 yahoo_friend_set_status_message(f, NULL); |
332 f->msg = NULL; | |
333 } | |
334 | 332 |
335 f->sms = 0; | 333 f->sms = 0; |
336 break; | 334 break; |
337 case 19: /* custom message */ | 335 case 19: /* custom message */ |
338 if (f) { | 336 if (f) |
339 if (f->msg) | 337 yahoo_friend_set_status_message(f, yahoo_string_decode(gc, pair->value, FALSE)); |
340 g_free(f->msg); | |
341 f->msg = yahoo_string_decode(gc, pair->value, FALSE); | |
342 } | |
343 break; | 338 break; |
344 case 11: /* this is the buddy's session id */ | 339 case 11: /* this is the buddy's session id */ |
345 break; | 340 break; |
346 case 17: /* in chat? */ | 341 case 17: /* in chat? */ |
347 break; | 342 break; |
676 | 671 |
677 f = yahoo_friend_find(gc, from); | 672 f = yahoo_friend_find(gc, from); |
678 if (!f) | 673 if (!f) |
679 return; /* if they're not on the list, don't bother */ | 674 return; /* if they're not on the list, don't bother */ |
680 | 675 |
681 if (f->game) { | 676 yahoo_friend_set_game(f, NULL); |
682 g_free(f->game); | |
683 f->game = NULL; | |
684 } | |
685 | 677 |
686 if (*stat == '1') { | 678 if (*stat == '1') { |
687 f->game = g_strdup(game); | 679 yahoo_friend_set_game(f, game); |
688 if (bud) | 680 if (bud) |
689 yahoo_update_status(gc, from, f); | 681 yahoo_update_status(gc, from, f); |
690 } | 682 } |
691 } | 683 } |
692 } | 684 } |
2343 } else { | 2335 } else { |
2344 if (f->away) | 2336 if (f->away) |
2345 emblems[i++] = "away"; | 2337 emblems[i++] = "away"; |
2346 if (f->sms) | 2338 if (f->sms) |
2347 emblems[i++] = "wireless"; | 2339 emblems[i++] = "wireless"; |
2348 if (f->game) | 2340 if (yahoo_friend_get_game(f)) |
2349 emblems[i++] = "game"; | 2341 emblems[i++] = "game"; |
2350 } | 2342 } |
2351 *se = emblems[0]; | 2343 *se = emblems[0]; |
2352 *sw = emblems[1]; | 2344 *sw = emblems[1]; |
2353 *nw = emblems[2]; | 2345 *nw = emblems[2]; |
2417 | 2409 |
2418 GaimBuddy *buddy; | 2410 GaimBuddy *buddy; |
2419 GaimConnection *gc; | 2411 GaimConnection *gc; |
2420 | 2412 |
2421 struct yahoo_data *yd; | 2413 struct yahoo_data *yd; |
2422 char *game = NULL; | 2414 const char *game; |
2415 char *game2; | |
2423 char *t; | 2416 char *t; |
2424 char url[256]; | 2417 char url[256]; |
2425 YahooFriend *f; | 2418 YahooFriend *f; |
2426 | 2419 |
2427 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); | 2420 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); |
2432 | 2425 |
2433 f = yahoo_friend_find(gc, buddy->name); | 2426 f = yahoo_friend_find(gc, buddy->name); |
2434 if (!f) | 2427 if (!f) |
2435 return; | 2428 return; |
2436 | 2429 |
2437 game = f->game; | 2430 game = yahoo_friend_get_game(f); |
2438 if (!game) | 2431 if (!game) |
2439 return; | 2432 return; |
2440 | 2433 |
2441 t = game = g_strdup(strstr(game, "ante?room=")); | 2434 t = game2 = g_strdup(strstr(game, "ante?room=")); |
2442 while (*t != '\t') | 2435 while (*t && *t != '\t') |
2443 t++; | 2436 t++; |
2444 *t = 0; | 2437 *t = 0; |
2445 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game); | 2438 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2); |
2446 gaim_notify_uri(gc, url); | 2439 gaim_notify_uri(gc, url); |
2447 g_free(game); | 2440 g_free(game2); |
2448 } | 2441 } |
2449 | 2442 |
2450 static char *yahoo_status_text(GaimBuddy *b) | 2443 static char *yahoo_status_text(GaimBuddy *b) |
2451 { | 2444 { |
2452 YahooFriend *f = NULL; | 2445 YahooFriend *f = NULL; |
2446 const char *msg; | |
2453 | 2447 |
2454 f = yahoo_friend_find(b->account->gc, b->name); | 2448 f = yahoo_friend_find(b->account->gc, b->name); |
2455 if (!f) | 2449 if (!f) |
2456 return g_strdup(_("Not on server list")); | 2450 return g_strdup(_("Not on server list")); |
2457 | 2451 |
2461 case YAHOO_STATUS_IDLE: | 2455 case YAHOO_STATUS_IDLE: |
2462 if (f->idle == -1) | 2456 if (f->idle == -1) |
2463 return g_strdup(yahoo_get_status_string(f->status)); | 2457 return g_strdup(yahoo_get_status_string(f->status)); |
2464 return NULL; | 2458 return NULL; |
2465 case YAHOO_STATUS_CUSTOM: | 2459 case YAHOO_STATUS_CUSTOM: |
2466 if (!f->msg) | 2460 if (!(msg = yahoo_friend_get_status_message(f))) |
2467 return NULL; | 2461 return NULL; |
2468 return g_markup_escape_text(f->msg, strlen(f->msg)); | 2462 return g_markup_escape_text(msg, strlen(msg)); |
2469 | 2463 |
2470 default: | 2464 default: |
2471 return g_strdup(yahoo_get_status_string(f->status)); | 2465 return g_strdup(yahoo_get_status_string(f->status)); |
2472 } | 2466 } |
2473 } | 2467 } |
2487 status = g_strdup(yahoo_get_status_string(f->status)); | 2481 status = g_strdup(yahoo_get_status_string(f->status)); |
2488 break; | 2482 break; |
2489 } | 2483 } |
2490 return NULL; | 2484 return NULL; |
2491 case YAHOO_STATUS_CUSTOM: | 2485 case YAHOO_STATUS_CUSTOM: |
2492 if (!f->msg) | 2486 if (!yahoo_friend_get_status_message(f)) |
2493 return NULL; | 2487 return NULL; |
2494 status = g_strdup(f->msg); | 2488 status = g_strdup(yahoo_friend_get_status_message(f)); |
2495 break; | 2489 break; |
2496 default: | 2490 default: |
2497 status = g_strdup(yahoo_get_status_string(f->status)); | 2491 status = g_strdup(yahoo_get_status_string(f->status)); |
2498 break; | 2492 break; |
2499 } | 2493 } |
2581 /* FIXME: remove this when the ui does it for us. */ | 2575 /* FIXME: remove this when the ui does it for us. */ |
2582 act = gaim_blist_node_action_new(_("Send File"), | 2576 act = gaim_blist_node_action_new(_("Send File"), |
2583 yahoo_ask_send_file_menu, NULL); | 2577 yahoo_ask_send_file_menu, NULL); |
2584 m = g_list_append(m, act); | 2578 m = g_list_append(m, act); |
2585 | 2579 |
2586 if (f->game) { | 2580 if (yahoo_friend_get_game(f)) { |
2587 char *game = f->game; | 2581 const char *game = yahoo_friend_get_game(f); |
2588 char *room; | 2582 char *room; |
2589 char *t; | 2583 char *t; |
2590 | |
2591 if (!game) | |
2592 return m; | |
2593 | 2584 |
2594 if (!(room = strstr(game, "&follow="))) /* skip ahead to the url */ | 2585 if (!(room = strstr(game, "&follow="))) /* skip ahead to the url */ |
2595 return m; | 2586 return m; |
2596 while (*room && *room != '\t') /* skip to the tab */ | 2587 while (*room && *room != '\t') /* skip to the tab */ |
2597 room++; | 2588 room++; |