comparison libpurple/protocols/gg/gg.c @ 27118:c3fcdd59ab76

Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691. Modified patch from kreez. Awaiting name for COPYRIGHT/ChangeLog.
author Paul Aurich <paul@darkrain42.org>
date Fri, 05 Jun 2009 05:42:05 +0000
parents a9f5afce8f39
children ef9e68020265
comparison
equal deleted inserted replaced
27116:b58672890b3f 27118:c3fcdd59ab76
1757 PurpleConnection *gc; 1757 PurpleConnection *gc;
1758 PurplePresence *presence; 1758 PurplePresence *presence;
1759 PurpleStatus *status; 1759 PurpleStatus *status;
1760 struct gg_login_params *glp; 1760 struct gg_login_params *glp;
1761 GGPInfo *info; 1761 GGPInfo *info;
1762 const char *address;
1762 1763
1763 if (ggp_setup_proxy(account) == -1) 1764 if (ggp_setup_proxy(account) == -1)
1764 return; 1765 return;
1765 1766
1766 gc = purple_account_get_connection(account); 1767 gc = purple_account_get_connection(account);
1786 status = purple_presence_get_active_status(presence); 1787 status = purple_presence_get_active_status(presence);
1787 1788
1788 glp->async = 1; 1789 glp->async = 1;
1789 glp->status = ggp_to_gg_status(status, &glp->status_descr); 1790 glp->status = ggp_to_gg_status(status, &glp->status_descr);
1790 glp->tls = 0; 1791 glp->tls = 0;
1792
1793 address = purple_account_get_string(account, "gg_server", "");
1794 if (address && *address) {
1795 struct in_addr *addr = gg_gethostbyname(address);
1796
1797 purple_debug_info("gg", "Using gg server given by user (%s)\n", address);
1798
1799 if (addr == NULL) {
1800 purple_debug_error("gg", "gg_gethostbyname returned error (%d): %s\n",
1801 errno, g_strerror(errno));
1802 purple_connection_error_reason(gc,
1803 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, /* should this be a settings error? */
1804 _("Unable to resolve server"));
1805 return;
1806 }
1807
1808 glp->server_addr = inet_addr(inet_ntoa(*addr));
1809 glp->server_port = 8074;
1810 } else
1811 purple_debug_info("gg", "Trying to retrieve address from gg appmsg service\n");
1791 1812
1792 info->session = gg_login(glp); 1813 info->session = gg_login(glp);
1793 if (info->session == NULL) { 1814 if (info->session == NULL) {
1794 purple_connection_error_reason (gc, 1815 purple_connection_error_reason (gc,
1795 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 1816 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
2365 option = purple_account_option_string_new(_("Nickname"), 2386 option = purple_account_option_string_new(_("Nickname"),
2366 "nick", _("Gadu-Gadu User")); 2387 "nick", _("Gadu-Gadu User"));
2367 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, 2388 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
2368 option); 2389 option);
2369 2390
2391 option = purple_account_option_string_new(_("GG server"),
2392 "gg_server", "");
2393 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
2394 option);
2395
2370 my_protocol = plugin; 2396 my_protocol = plugin;
2371 2397
2372 gg_debug_handler = purple_gg_debug_handler; 2398 gg_debug_handler = purple_gg_debug_handler;
2373 } 2399 }
2374 2400