Mercurial > pidgin.yaz
comparison libpurple/protocols/silc/silc.c @ 23404: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 |
comparison
equal
deleted
inserted
replaced
23403:18cc881d5a73 | 23404:c6b29adc22d1 |
---|---|
667 { | 667 { |
668 SilcPurple sg = gc->proto_data; | 668 SilcPurple sg = gc->proto_data; |
669 #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) | 669 #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) |
670 SilcPurpleTask task; | 670 SilcPurpleTask task; |
671 #endif /* __SILC_TOOLKIT_VERSION */ | 671 #endif /* __SILC_TOOLKIT_VERSION */ |
672 GHashTable *ui_info; | |
673 const char *ui_name = NULL, *ui_website = NULL; | |
674 char *quit_msg; | |
672 | 675 |
673 g_return_if_fail(sg != NULL); | 676 g_return_if_fail(sg != NULL); |
677 | |
678 ui_info = purple_core_get_ui_info(); | |
679 | |
680 if(ui_info) { | |
681 ui_name = g_hash_table_lookup(ui_info, "name"); | |
682 ui_website = g_hash_table_lookup(ui_info, "website"); | |
683 } | |
684 | |
685 if(!ui_name || !ui_website) { | |
686 ui_name = "Pidgin"; | |
687 ui_website = PURPLE_WEBSITE; | |
688 } | |
689 quit_msg = g_strdup_printf(_("Download %s: %s"), | |
690 ui_name, ui_website); | |
674 | 691 |
675 /* Send QUIT */ | 692 /* Send QUIT */ |
676 silc_client_command_call(sg->client, sg->conn, NULL, | 693 silc_client_command_call(sg->client, sg->conn, NULL, |
677 "QUIT", "Download Pidgin: " PURPLE_WEBSITE, | 694 "QUIT", quit_msg, |
678 NULL); | 695 NULL); |
696 g_free(quit_msg); | |
679 | 697 |
680 if (sg->conn) | 698 if (sg->conn) |
681 silc_client_close_connection(sg->client, sg->conn); | 699 silc_client_close_connection(sg->client, sg->conn); |
682 | 700 |
683 #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) | 701 #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) |
1814 static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, | 1832 static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, |
1815 const char *cmd, char **args, char **error, void *data) | 1833 const char *cmd, char **args, char **error, void *data) |
1816 { | 1834 { |
1817 PurpleConnection *gc; | 1835 PurpleConnection *gc; |
1818 SilcPurple sg; | 1836 SilcPurple sg; |
1819 | 1837 GHashTable *ui_info; |
1838 const char *ui_name = NULL, *ui_website = NULL; | |
1839 char *quit_msg; | |
1840 | |
1820 gc = purple_conversation_get_gc(conv); | 1841 gc = purple_conversation_get_gc(conv); |
1821 | 1842 |
1822 if (gc == NULL) | 1843 if (gc == NULL) |
1823 return PURPLE_CMD_RET_FAILED; | 1844 return PURPLE_CMD_RET_FAILED; |
1824 | 1845 |
1825 sg = gc->proto_data; | 1846 sg = gc->proto_data; |
1826 | 1847 |
1827 if (sg == NULL) | 1848 if (sg == NULL) |
1828 return PURPLE_CMD_RET_FAILED; | 1849 return PURPLE_CMD_RET_FAILED; |
1829 | 1850 |
1851 ui_info = purple_core_get_ui_info(); | |
1852 | |
1853 if(ui_info) { | |
1854 ui_name = g_hash_table_lookup(ui_info, "name"); | |
1855 ui_website = g_hash_table_lookup(ui_info, "website"); | |
1856 } | |
1857 | |
1858 if(!ui_name || !ui_website) { | |
1859 ui_name = "Pidgin"; | |
1860 ui_website = PURPLE_WEBSITE; | |
1861 } | |
1862 quit_msg = g_strdup_printf(_("Download %s: %s"), | |
1863 ui_name, ui_website); | |
1864 | |
1830 silc_client_command_call(sg->client, sg->conn, NULL, | 1865 silc_client_command_call(sg->client, sg->conn, NULL, |
1831 "QUIT", (args && args[0]) ? args[0] : "Download Pidgin: " PURPLE_WEBSITE, NULL); | 1866 "QUIT", (args && args[0]) ? args[0] : quit_msg, NULL); |
1867 g_free(quit_msg); | |
1832 | 1868 |
1833 return PURPLE_CMD_RET_OK; | 1869 return PURPLE_CMD_RET_OK; |
1834 } | 1870 } |
1835 | 1871 |
1836 static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, | 1872 static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, |