Mercurial > pidgin
diff libpurple/prpl.c @ 15593:f485c87e6546
sf patch #1655057, from Peter Tang
Fix a memory leak when signing off an account, I think. Peter Tang
found it and suggested one fix. I suggested another, then Sadrul
made it work. I like this change. We're now re-using GaimStatusType
objects instead of making lots of copies of them.
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Fri, 09 Feb 2007 07:42:01 +0000 |
| parents | 84b3ab83df35 |
| children | 32c366eeeb99 |
line wrap: on
line diff
--- a/libpurple/prpl.c Fri Feb 09 07:34:51 2007 +0000 +++ b/libpurple/prpl.c Fri Feb 09 07:42:01 2007 +0000 @@ -165,12 +165,9 @@ void gaim_prpl_got_user_status_deactive(GaimAccount *account, const char *name, const char *status_id) { - GSList *list; GaimBuddy *buddy; GaimPresence *presence; GaimStatus *status; - GaimStatus *old_status; - va_list args; g_return_if_fail(account != NULL); g_return_if_fail(name != NULL); @@ -246,31 +243,20 @@ GList * gaim_prpl_get_statuses(GaimAccount *account, GaimPresence *presence) { - GaimPlugin *prpl; - GaimPluginProtocolInfo *prpl_info; GList *statuses = NULL; - GList *l, *list; + const GList *l; GaimStatus *status; g_return_val_if_fail(account != NULL, NULL); g_return_val_if_fail(presence != NULL, NULL); - prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); - - if (prpl == NULL) - return NULL; - - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info == NULL || prpl_info->status_types == NULL) - return NULL; - - for (l = list = prpl_info->status_types(account); l != NULL; l = l->next) + for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) { status = gaim_status_new((GaimStatusType *)l->data, presence); - statuses = g_list_append(statuses, status); + statuses = g_list_prepend(statuses, status); } - g_list_free(list); + statuses = g_list_reverse(statuses); return statuses; }
