Mercurial > pidgin
changeset 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 | 18cc881d5a73 |
children | 2ccda8e9046d |
files | libpurple/core.h libpurple/protocols/oscar/oscar.c libpurple/protocols/silc/silc.c libpurple/protocols/silc10/silc.c libpurple/protocols/yahoo/yahoo.c pidgin/gtkmain.c |
diffstat | 6 files changed, 115 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/core.h Tue Jul 01 23:21:20 2008 +0000 +++ b/libpurple/core.h Tue Jul 01 23:40:13 2008 +0000 @@ -180,6 +180,12 @@ * * <dt><tt>version</tt></dt> * <dd>a user-readable description of the current version of the UI.</dd> + * + * <dt><tt>website</tt></dt> + * <dd>the UI's website, such as http://pidgin.im.</dd> + * + * <dt><tt>dev_website</tt></dt> + * <dd>the UI's development/support website, such as http://developer.pidgin.im.</dd> * </dl> * * @return A GHashTable with strings for keys and values. This
--- a/libpurple/protocols/oscar/oscar.c Tue Jul 01 23:21:20 2008 +0000 +++ b/libpurple/protocols/oscar/oscar.c Tue Jul 01 23:40:13 2008 +0000 @@ -1519,10 +1519,14 @@ purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); break; case 0x1c: + { /* client too old */ - g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), PURPLE_WEBSITE); + GHashTable *ui_info = purple_core_get_ui_info(); + g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), + ((ui_info && g_hash_table_lookup(ui_info, "website")) ? (char *)g_hash_table_lookup(ui_info, "website") : PURPLE_WEBSITE)); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, buf); break; + } case 0x1d: /* IP address connecting too frequently */ purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); @@ -1640,8 +1644,10 @@ } if (in != '\n') { char buf[256]; + GHashTable *ui_info = purple_core_get_ui_info(); g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " - "this is fixed. Check %s for updates."), PURPLE_WEBSITE); + "this is fixed. Check %s for updates."), + ((ui_info && g_hash_table_lookup(ui_info, "website")) ? (char *)g_hash_table_lookup(ui_info, "website") : PURPLE_WEBSITE)); purple_notify_warning(pos->gc, NULL, _("Unable to get a valid AIM login hash."), buf); @@ -1684,8 +1690,10 @@ pos->fd = source; if (source < 0) { + GHashTable *ui_info = purple_core_get_ui_info(); buf = g_strdup_printf(_("You may be disconnected shortly. " - "Check %s for updates."), PURPLE_WEBSITE); + "Check %s for updates."), + ((ui_info && g_hash_table_lookup(ui_info, "website")) ? (char *)g_hash_table_lookup(ui_info, "website") : PURPLE_WEBSITE)); purple_notify_warning(pos->gc, NULL, _("Unable to get a valid AIM login hash."), buf); @@ -1781,10 +1789,13 @@ straight_to_hell, pos) == NULL) { char buf[256]; + GHashTable *ui_info = purple_core_get_ui_info(); g_free(pos->modname); g_free(pos); + g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. " - "Check %s for updates."), PURPLE_WEBSITE); + "Check %s for updates."), + ((ui_info && g_hash_table_lookup(ui_info, "website")) ? (char *)g_hash_table_lookup(ui_info, "website") : PURPLE_WEBSITE)); purple_notify_warning(pos->gc, NULL, _("Unable to get a valid login hash."), buf);
--- a/libpurple/protocols/silc/silc.c Tue Jul 01 23:21:20 2008 +0000 +++ b/libpurple/protocols/silc/silc.c Tue Jul 01 23:40:13 2008 +0000 @@ -669,13 +669,31 @@ #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) SilcPurpleTask task; #endif /* __SILC_TOOLKIT_VERSION */ + GHashTable *ui_info; + const char *ui_name = NULL, *ui_website = NULL; + char *quit_msg; 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 Pidgin: " PURPLE_WEBSITE, + "QUIT", quit_msg, NULL); + g_free(quit_msg); if (sg->conn) silc_client_close_connection(sg->client, sg->conn); @@ -1816,7 +1834,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) @@ -1827,8 +1848,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 Pidgin: " PURPLE_WEBSITE, NULL); + "QUIT", (args && args[0]) ? args[0] : quit_msg, NULL); + g_free(quit_msg); return PURPLE_CMD_RET_OK; }
--- 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; }
--- a/libpurple/protocols/yahoo/yahoo.c Tue Jul 01 23:21:20 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Tue Jul 01 23:40:13 2008 +0000 @@ -1995,13 +1995,19 @@ yahoo_process_auth_new(gc, seed); break; default: - buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized " - "authentication method. You will probably not be able " - "to successfully sign on to Yahoo. Check %s for updates."), PURPLE_WEBSITE); - purple_notify_error(gc, "", _("Failed Yahoo! Authentication"), - buf); - g_free(buf); - yahoo_process_auth_new(gc, seed); /* Can't hurt to try it anyway. */ + { + GHashTable *ui_info = purple_core_get_ui_info(); + + buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized " + "authentication method. You will probably not be able " + "to successfully sign on to Yahoo. Check %s for updates."), + ((ui_info && g_hash_table_lookup(ui_info, "website")) ? (char *)g_hash_table_lookup(ui_info, "website") : PURPLE_WEBSITE)); + purple_notify_error(gc, "", _("Failed Yahoo! Authentication"), + buf); + g_free(buf); + yahoo_process_auth_new(gc, seed); /* Can't hurt to try it anyway. */ + break; + } } } }
--- a/pidgin/gtkmain.c Tue Jul 01 23:21:20 2008 +0000 +++ b/pidgin/gtkmain.c Tue Jul 01 23:40:13 2008 +0000 @@ -350,6 +350,8 @@ g_hash_table_insert(ui_info, "name", (char*)PIDGIN_NAME); g_hash_table_insert(ui_info, "version", VERSION); + g_hash_table_insert(ui_info, "website", "http://pidgin.im"); + g_hash_table_insert(ui_info, "dev_website", "http://developer.pidgin.im"); } return ui_info;