Mercurial > pidgin
comparison src/protocols/yahoo/yahoo.c @ 4722:534eaa4ead94
[gaim-migrate @ 5034]
Provided a generic way for prpls to put text in the second line of the
Big List and removed a hideous Yahoo! buddy menu hack in the process
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 12 Mar 2003 06:37:40 +0000 |
parents | e19f91053ad0 |
children | b9e7ccf21f9c |
comparison
equal
deleted
inserted
replaced
4721:91ef4fae4a49 | 4722:534eaa4ead94 |
---|---|
1062 *t = 0; | 1062 *t = 0; |
1063 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game); | 1063 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game); |
1064 open_url(NULL, url); | 1064 open_url(NULL, url); |
1065 g_free(game); | 1065 g_free(game); |
1066 } | 1066 } |
1067 | |
1068 static const char *yahoo_status_text(struct buddy *b) | |
1069 { | |
1070 struct yahoo_data *yd = (struct yahoo_data*)b->account->gc->proto_data; | |
1071 if (b->uc & UC_UNAVAILABLE && b->uc >> 2 != YAHOO_STATUS_IDLE) { | |
1072 if ((b->uc >> 2) != YAHOO_STATUS_CUSTOM) | |
1073 return yahoo_get_status_string(b->uc >> 2); | |
1074 else | |
1075 return g_hash_table_lookup(yd->hash, b->name); | |
1076 } | |
1077 } | |
1078 | |
1067 static GList *yahoo_buddy_menu(struct gaim_connection *gc, char *who) | 1079 static GList *yahoo_buddy_menu(struct gaim_connection *gc, char *who) |
1068 { | 1080 { |
1069 GList *m = NULL; | 1081 GList *m = NULL; |
1070 struct proto_buddy_menu *pbm; | 1082 struct proto_buddy_menu *pbm; |
1071 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | 1083 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
1072 struct buddy *b = gaim_find_buddy(gc->account, who); /* this should never be null. if it is, | 1084 struct buddy *b = gaim_find_buddy(gc->account, who); /* this should never be null. if it is, |
1073 segfault and get the bug report. */ | 1085 segfault and get the bug report. */ |
1074 static char buf[1024]; | 1086 static char buf[1024]; |
1075 static char buf2[1024]; | 1087 static char buf2[1024]; |
1076 | 1088 |
1077 if (b->uc & UC_UNAVAILABLE && b->uc >> 2 != YAHOO_STATUS_IDLE) { | |
1078 pbm = g_new0(struct proto_buddy_menu, 1); | |
1079 if ((b->uc >> 2) != YAHOO_STATUS_CUSTOM) | |
1080 g_snprintf(buf, sizeof buf, | |
1081 "Status: %s", yahoo_get_status_string(b->uc >> 2)); | |
1082 else | |
1083 g_snprintf(buf, sizeof buf, "Custom Status: %s", | |
1084 (char *)g_hash_table_lookup(yd->hash, b->name)); | |
1085 pbm->label = buf; | |
1086 pbm->callback = NULL; | |
1087 pbm->gc = gc; | |
1088 m = g_list_append(m, pbm); | |
1089 } | |
1090 | |
1091 if (b->uc | YAHOO_STATUS_GAME) { | 1089 if (b->uc | YAHOO_STATUS_GAME) { |
1092 char *game = g_hash_table_lookup(yd->games, b->name); | 1090 char *game = g_hash_table_lookup(yd->games, b->name); |
1093 char *room; | 1091 char *room; |
1094 if (!game) | 1092 if (!game) |
1095 return m; | 1093 return m; |
1109 pbm->callback = yahoo_game; | 1107 pbm->callback = yahoo_game; |
1110 pbm->gc = gc; | 1108 pbm->gc = gc; |
1111 m = g_list_append(m, pbm); | 1109 m = g_list_append(m, pbm); |
1112 } | 1110 } |
1113 } | 1111 } |
1114 | 1112 |
1115 return m; | 1113 return m; |
1116 } | 1114 } |
1117 | 1115 |
1118 static void yahoo_act_id(gpointer data, char *entry) | 1116 static void yahoo_act_id(gpointer data, char *entry) |
1119 { | 1117 { |
1346 ret->name = g_strdup("Yahoo"); | 1344 ret->name = g_strdup("Yahoo"); |
1347 ret->login = yahoo_login; | 1345 ret->login = yahoo_login; |
1348 ret->close = yahoo_close; | 1346 ret->close = yahoo_close; |
1349 ret->buddy_menu = yahoo_buddy_menu; | 1347 ret->buddy_menu = yahoo_buddy_menu; |
1350 ret->list_icon = yahoo_list_icon; | 1348 ret->list_icon = yahoo_list_icon; |
1349 ret->status_text = yahoo_status_text; | |
1351 ret->actions = yahoo_actions; | 1350 ret->actions = yahoo_actions; |
1352 ret->send_im = yahoo_send_im; | 1351 ret->send_im = yahoo_send_im; |
1353 ret->away_states = yahoo_away_states; | 1352 ret->away_states = yahoo_away_states; |
1354 ret->set_away = yahoo_set_away; | 1353 ret->set_away = yahoo_set_away; |
1355 ret->set_idle = yahoo_set_idle; | 1354 ret->set_idle = yahoo_set_idle; |