Mercurial > pidgin
diff libpurple/protocols/silc10/silc.c @ 23402:c6b29adc22d1
Added "website" and "dev_website" items to the ui_info GHashTable,
and made use of "website" wherever PURPLE_WEBSITE was found previously.
Thanks to Stu for the suggestion as a replacement for my #define-based
previous solution.
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Tue, 01 Jul 2008 23:40:13 +0000 |
parents | f1602b78aa59 |
children | 4a4f733c4bf1 |
line wrap: on
line diff
--- a/libpurple/protocols/silc10/silc.c Tue Jul 01 23:21:20 2008 +0000 +++ b/libpurple/protocols/silc10/silc.c Tue Jul 01 23:40:13 2008 +0000 @@ -384,12 +384,30 @@ silcpurple_close(PurpleConnection *gc) { SilcPurple sg = gc->proto_data; + GHashTable *ui_info; + const char *ui_name = NULL, *ui_website = NULL; + char *quit_msg; + + g_return_if_fail(sg != NULL); - g_return_if_fail(sg != NULL); + ui_info = purple_core_get_ui_info(); + + if(ui_info) { + ui_name = g_hash_table_lookup(ui_info, "name"); + ui_website = g_hash_table_lookup(ui_info, "website"); + } + + if(!ui_name || !ui_website) { + ui_name = "Pidgin"; + ui_website = PURPLE_WEBSITE; + } + quit_msg = g_strdup_printf(_("Download %s: %s"), + ui_name, ui_website); /* Send QUIT */ silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", "Download this: " PURPLE_WEBSITE, NULL); + "QUIT", quit_msg, NULL); + g_free(quit_msg); if (sg->conn) silc_client_close_connection(sg->client, sg->conn); @@ -1535,7 +1553,10 @@ { PurpleConnection *gc; SilcPurple sg; - + GHashTable *ui_info; + const char *ui_name = NULL, *ui_website = NULL; + char *quit_msg; + gc = purple_conversation_get_gc(conv); if (gc == NULL) @@ -1546,8 +1567,23 @@ if (sg == NULL) return PURPLE_CMD_RET_FAILED; + ui_info = purple_core_get_ui_info(); + + if(ui_info) { + ui_name = g_hash_table_lookup(ui_info, "name"); + ui_website = g_hash_table_lookup(ui_info, "website"); + } + + if(!ui_name || !ui_website) { + ui_name = "Pidgin"; + ui_website = PURPLE_WEBSITE; + } + quit_msg = g_strdup_printf(_("Download %s: %s"), + ui_name, ui_website); + silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", (args && args[0]) ? args[0] : "Download this: " PURPLE_WEBSITE, NULL); + "QUIT", (args && args[0]) ? args[0] : quit_msg, NULL); + g_free(quit_msg); return PURPLE_CMD_RET_OK; }