diff -r 14cda54c3fbf -r b271cf41c92d pidgin/gtkutils.c --- a/pidgin/gtkutils.c Tue May 17 01:49:31 2022 -0500 +++ b/pidgin/gtkutils.c Tue May 17 01:53:55 2022 -0500 @@ -306,146 +306,6 @@ g_free(who); } -gboolean -pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts, - PurpleAccount **ret_account, char **ret_protocol, - char **ret_username, char **ret_alias) -{ - char *protocol = NULL; - char *username = NULL; - char *alias = NULL; - char *str; - char *s; - gboolean valid; - - g_return_val_if_fail(msg != NULL, FALSE); - g_return_val_if_fail(ret_protocol != NULL, FALSE); - g_return_val_if_fail(ret_username != NULL, FALSE); - - s = str = g_strdup(msg); - - while (*s != '\r' && *s != '\n' && *s != '\0') - { - char *key, *value; - - key = s; - - /* Grab the key */ - while (*s != '\r' && *s != '\n' && *s != '\0' && *s != ' ') - s++; - - if (*s == '\r') s++; - - if (*s == '\n') - { - s++; - continue; - } - - if (*s != '\0') *s++ = '\0'; - - /* Clear past any whitespace */ - while (*s == ' ') - s++; - - /* Now let's grab until the end of the line. */ - value = s; - - while (*s != '\r' && *s != '\n' && *s != '\0') - s++; - - if (*s == '\r') *s++ = '\0'; - if (*s == '\n') *s++ = '\0'; - - if (strchr(key, ':') != NULL) - { - if (!g_ascii_strcasecmp(key, "X-IM-Username:")) - username = g_strdup(value); - else if (!g_ascii_strcasecmp(key, "X-IM-Protocol:")) - protocol = g_strdup(value); - else if (!g_ascii_strcasecmp(key, "X-IM-Alias:")) - alias = g_strdup(value); - } - } - - if (username != NULL && protocol != NULL) - { - valid = TRUE; - - *ret_username = username; - *ret_protocol = protocol; - - if (ret_alias != NULL) - *ret_alias = alias; - - /* Check for a compatible account. */ - if(ret_account != NULL) { - PurpleAccount *account = NULL; - GList *list; - GList *l; - const char *protoname; - - - if(all_accounts) { - PurpleAccountManager *manager = NULL; - - manager = purple_account_manager_get_default(); - list = purple_account_manager_get_all(manager); - } else { - list = purple_connections_get_all(); - } - - for (l = list; l != NULL; l = l->next) - { - PurpleConnection *gc; - PurpleProtocol *proto = NULL; - - if (all_accounts) - { - account = (PurpleAccount *)l->data; - - proto = purple_account_get_protocol(account); - - if (proto == NULL) - { - account = NULL; - - continue; - } - } - else - { - gc = (PurpleConnection *)l->data; - account = purple_connection_get_account(gc); - - proto = purple_connection_get_protocol(gc); - } - - protoname = purple_protocol_get_list_icon(proto, account, NULL); - - if (purple_strequal(protoname, protocol)) - break; - - account = NULL; - } - - *ret_account = account; - } - } - else - { - valid = FALSE; - - g_free(username); - g_free(protocol); - g_free(alias); - } - - g_free(str); - - return valid; -} - void pidgin_set_accessible_label(GtkWidget *w, GtkLabel *l) {