comparison libgaim/account.c @ 14607:f23506e8f812

[gaim-migrate @ 17335] Get rid of some checks to make sure gc is valid. They shouldn't be necessary (and a lot of them were poorly implemented anyway). Let me know if you notice any crashes. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 22 Sep 2006 05:42:01 +0000
parents 60b1bc8dbf37
children 4df2827fc2eb
comparison
equal deleted inserted replaced
14606:a35ed72bf50a 14607:f23506e8f812
1139 set_user_info_cb(GaimAccount *account, const char *user_info) 1139 set_user_info_cb(GaimAccount *account, const char *user_info)
1140 { 1140 {
1141 GaimConnection *gc; 1141 GaimConnection *gc;
1142 1142
1143 gaim_account_set_user_info(account, user_info); 1143 gaim_account_set_user_info(account, user_info);
1144
1145 gc = gaim_account_get_connection(account); 1144 gc = gaim_account_get_connection(account);
1146 1145 serv_set_info(gc, user_info);
1147 if (gc != NULL)
1148 serv_set_info(gc, user_info);
1149 } 1146 }
1150 1147
1151 void 1148 void
1152 gaim_account_request_change_user_info(GaimAccount *account) 1149 gaim_account_request_change_user_info(GaimAccount *account)
1153 { 1150 {
1957 GaimConnection *gc = gaim_account_get_connection(account); 1954 GaimConnection *gc = gaim_account_get_connection(account);
1958 1955
1959 if (gc != NULL && gc->prpl != NULL) 1956 if (gc != NULL && gc->prpl != NULL)
1960 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 1957 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
1961 1958
1962 if (prpl_info != NULL && g_list_find(gaim_connections_get_all(), gc) && 1959 if (prpl_info != NULL && prpl_info->add_buddy != NULL)
1963 prpl_info->add_buddy != NULL)
1964 prpl_info->add_buddy(gc, buddy, gaim_buddy_get_group(buddy)); 1960 prpl_info->add_buddy(gc, buddy, gaim_buddy_get_group(buddy));
1965 } 1961 }
1966 1962
1967 void 1963 void
1968 gaim_account_add_buddies(GaimAccount *account, GList *buddies) 1964 gaim_account_add_buddies(GaimAccount *account, GList *buddies)
1971 GaimConnection *gc = gaim_account_get_connection(account); 1967 GaimConnection *gc = gaim_account_get_connection(account);
1972 1968
1973 if (gc != NULL && gc->prpl != NULL) 1969 if (gc != NULL && gc->prpl != NULL)
1974 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 1970 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
1975 1971
1976 if (prpl_info && g_list_find(gaim_connections_get_all(), gc)) { 1972 if (prpl_info) {
1977 GList *cur, *groups = NULL; 1973 GList *cur, *groups = NULL;
1978 1974
1979 /* Make a list of what group each buddy is in */ 1975 /* Make a list of what group each buddy is in */
1980 for (cur = buddies; cur != NULL; cur = cur->next) { 1976 for (cur = buddies; cur != NULL; cur = cur->next) {
1981 GaimBlistNode *node = cur->data; 1977 GaimBlistNode *node = cur->data;
2006 GaimConnection *gc = gaim_account_get_connection(account); 2002 GaimConnection *gc = gaim_account_get_connection(account);
2007 2003
2008 if (gc != NULL && gc->prpl != NULL) 2004 if (gc != NULL && gc->prpl != NULL)
2009 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 2005 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
2010 2006
2011 if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->remove_buddy) 2007 if (prpl_info && prpl_info->remove_buddy)
2012 prpl_info->remove_buddy(gc, buddy, group); 2008 prpl_info->remove_buddy(gc, buddy, group);
2013 } 2009 }
2014 2010
2015 void 2011 void
2016 gaim_account_remove_buddies(GaimAccount *account, GList *buddies, GList *groups) 2012 gaim_account_remove_buddies(GaimAccount *account, GList *buddies, GList *groups)
2017 { 2013 {
2018 GaimPluginProtocolInfo *prpl_info = NULL; 2014 GaimPluginProtocolInfo *prpl_info = NULL;
2019 GaimConnection *gc = gaim_account_get_connection(account); 2015 GaimConnection *gc = gaim_account_get_connection(account);
2020 2016
2021 if (!g_list_find(gaim_connections_get_all(), gc))
2022 return;
2023
2024 if (gc != NULL && gc->prpl != NULL) 2017 if (gc != NULL && gc->prpl != NULL)
2025 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 2018 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
2026 2019
2027 if (prpl_info && g_list_find(gaim_connections_get_all(), gc)) { 2020 if (prpl_info) {
2028 if (prpl_info->remove_buddies) 2021 if (prpl_info->remove_buddies)
2029 prpl_info->remove_buddies(gc, buddies, groups); 2022 prpl_info->remove_buddies(gc, buddies, groups);
2030 else { 2023 else {
2031 GList *curb = buddies; 2024 GList *curb = buddies;
2032 GList *curg = groups; 2025 GList *curg = groups;
2046 GaimConnection *gc = gaim_account_get_connection(account); 2039 GaimConnection *gc = gaim_account_get_connection(account);
2047 2040
2048 if (gc != NULL && gc->prpl != NULL) 2041 if (gc != NULL && gc->prpl != NULL)
2049 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 2042 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
2050 2043
2051 if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->remove_group) 2044 if (prpl_info && prpl_info->remove_group)
2052 prpl_info->remove_group(gc, group); 2045 prpl_info->remove_group(gc, group);
2053 } 2046 }
2054 2047
2055 void 2048 void
2056 gaim_account_change_password(GaimAccount *account, const char *orig_pw, 2049 gaim_account_change_password(GaimAccount *account, const char *orig_pw,
2062 gaim_account_set_password(account, new_pw); 2055 gaim_account_set_password(account, new_pw);
2063 2056
2064 if (gc != NULL && gc->prpl != NULL) 2057 if (gc != NULL && gc->prpl != NULL)
2065 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 2058 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
2066 2059
2067 if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && prpl_info->change_passwd) 2060 if (prpl_info && prpl_info->change_passwd)
2068 prpl_info->change_passwd(gc, orig_pw, new_pw); 2061 prpl_info->change_passwd(gc, orig_pw, new_pw);
2069 } 2062 }
2070 2063
2071 gboolean gaim_account_supports_offline_message(GaimAccount *account, GaimBuddy *buddy) 2064 gboolean gaim_account_supports_offline_message(GaimAccount *account, GaimBuddy *buddy)
2072 { 2065 {