Mercurial > pidgin.yaz
diff src/protocols/simple/simple.c @ 11210:5ba038e1b21f
[gaim-migrate @ 13341]
Added an option to connect to a different proxy. This is useful in some
internal networks where the hostpart of the userid does not equal the
hostname of the registrar server to connect to.
committer: Tailor Script <tailor@pidgin.im>
author | Thomas Butter <tbutter> |
---|---|
date | Mon, 08 Aug 2005 18:08:45 +0000 |
parents | 4c1f45ac00e9 |
children | 90be432e8385 |
line wrap: on
line diff
--- a/src/protocols/simple/simple.c Mon Aug 08 16:23:18 2005 +0000 +++ b/src/protocols/simple/simple.c Mon Aug 08 18:08:45 2005 +0000 @@ -1095,6 +1095,7 @@ gchar **userserver; int error=0; struct getserver_return *serveradr; + gchar *hosttoconnect; const char *username = gaim_account_get_username(account); @@ -1124,10 +1125,16 @@ sip->status = g_strdup("available"); + if(!gaim_account_get_bool(account, "useproxy", FALSE)) { + hosttoconnect = g_strdup(sip->servername); + } else { + hosttoconnect = g_strdup(gaim_account_get_string(account, "proxy", sip->servername)); + } + // TCP case if(! sip->udp) { // search for SRV record - serveradr = getserver(sip->servername, "_sip._tcp"); + serveradr = getserver(hosttoconnect, "_sip._tcp"); gaim_debug_info("simple","connecting to %s port %d", serveradr->name, serveradr->port); // open tcp connection to the server @@ -1149,7 +1156,7 @@ struct sockaddr_in addr; struct hostent *h; - serveradr = getserver(sip->servername, "_sip._udp"); + serveradr = getserver(hosttoconnect, "_sip._udp"); gaim_debug_info("simple", "using udp with server %s and port %d", serveradr->name, serveradr->port); sip->fd = socket(AF_INET, SOCK_DGRAM, 0); @@ -1174,6 +1181,7 @@ do_register(sip); } + g_free(hosttoconnect); // register timeout callback for register / subscribe renewal sip->registertimeout = gaim_timeout_add((rand()%100)+10*1000, (GSourceFunc)register_timeout, sip); @@ -1308,6 +1316,10 @@ option = gaim_account_option_bool_new(_("Use UDP"), "udp", FALSE); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + option = gaim_account_option_bool_new(_("Use Proxy"), "useproxy", FALSE); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + option = gaim_account_option_string_new(_("Proxy"), "proxy", ""); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); // _simple_plugin = plugin; }