comparison src/protocols/yahoo/yahoo.c @ 6793:3d84c933b939

[gaim-migrate @ 7332] Tim Ringenbach (marv_sf) writes: " This makes two things work (on the server side list): 1) Moving buddies between groups. 2) Renaming groups. It doesn't, however, fix the case where Gaim disagrees with the server as to what group a buddy is in. But that doesn't make anything bad happen really, so I'll save it for another patch. And moving the buddy seems get the server and gaim in sync again." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 08 Sep 2003 10:08:39 +0000
parents 62aec9fd7aca
children 40ba19133882
comparison
equal deleted inserted replaced
6792:62aec9fd7aca 6793:3d84c933b939
1976 { 1976 {
1977 /* struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; */ 1977 /* struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; */
1978 char url[256]; 1978 char url[256];
1979 g_snprintf(url, sizeof url, "%s%s", YAHOO_PROFILE_URL, name); 1979 g_snprintf(url, sizeof url, "%s%s", YAHOO_PROFILE_URL, name);
1980 grab_url(url, FALSE, yahoo_got_info, NULL, NULL, 0); 1980 grab_url(url, FALSE, yahoo_got_info, NULL, NULL, 0);
1981 }
1982
1983 static void yahoo_change_buddys_group(GaimConnection *gc, const char *who,
1984 const char *old_group, const char *new_group)
1985 {
1986 struct yahoo_data *yd = gc->proto_data;
1987 struct yahoo_packet *pkt;
1988
1989 /* Step 0: If they aren't on the server list anyway,
1990 * don't bother letting the server know.
1991 */
1992 if (!g_hash_table_lookup(yd->friends, who))
1993 return;
1994
1995 /* Step 1: Add buddy to new group. */
1996 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0);
1997 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
1998 yahoo_packet_hash(pkt, 7, who);
1999 yahoo_packet_hash(pkt, 65, new_group);
2000 yahoo_packet_hash(pkt, 14, "");
2001 yahoo_send_packet(yd, pkt);
2002 yahoo_packet_free(pkt);
2003
2004 /* Step 2: Remove buddy from old group */
2005 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0);
2006 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
2007 yahoo_packet_hash(pkt, 7, who);
2008 yahoo_packet_hash(pkt, 65, old_group);
2009 yahoo_send_packet(yd, pkt);
2010 yahoo_packet_free(pkt);
2011 }
2012
2013 static void yahoo_rename_group(GaimConnection *gc, const char *old_group,
2014 const char *new_group, GList *whocares)
2015 {
2016 struct yahoo_data *yd = gc->proto_data;
2017 struct yahoo_packet *pkt;
2018
2019 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0);
2020 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
2021 yahoo_packet_hash(pkt, 65, old_group);
2022 yahoo_packet_hash(pkt, 67, new_group);
2023 yahoo_send_packet(yd, pkt);
2024 yahoo_packet_free(pkt);
1981 } 2025 }
1982 2026
1983 static GaimPlugin *my_protocol = NULL; 2027 static GaimPlugin *my_protocol = NULL;
1984 2028
1985 static GaimPluginProtocolInfo prpl_info = 2029 static GaimPluginProtocolInfo prpl_info =
2027 yahoo_keepalive, 2071 yahoo_keepalive,
2028 NULL, /* register_user */ 2072 NULL, /* register_user */
2029 NULL, /* get_cb_info */ 2073 NULL, /* get_cb_info */
2030 NULL, /* get_cb_away */ 2074 NULL, /* get_cb_away */
2031 NULL, /* alias_buddy */ 2075 NULL, /* alias_buddy */
2032 NULL, /* change group */ 2076 yahoo_change_buddys_group,
2033 NULL, /* rename group */ 2077 yahoo_rename_group,
2034 NULL, /* buddy_free */ 2078 NULL, /* buddy_free */
2035 NULL, /* convo_closed */ 2079 NULL, /* convo_closed */
2036 NULL, /* normalize */ 2080 NULL, /* normalize */
2037 NULL /* set_buddy_icon */ 2081 NULL /* set_buddy_icon */
2038 }; 2082 };