# HG changeset patch # User Daniel Atallah # Date 1127443172 0 # Node ID 7897207b522d0b40f673f35a3f21604035b7edb6 # Parent 2aa7d8dd61d742bfed8de3fa78d681692467570a [gaim-migrate @ 13832] Don't use the gtk wrapper when you can use glib directly - upnp shouldn't depend on gtk. Also some trailing whitespace fixes - this whole file is using spaces instead of tabs. committer: Tailor Script diff -r 2aa7d8dd61d7 -r 7897207b522d src/upnp.c --- a/src/upnp.c Thu Sep 22 22:20:21 2005 +0000 +++ b/src/upnp.c Fri Sep 23 02:39:32 2005 +0000 @@ -23,7 +23,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "internal.h" -#include "gtkgaim.h" +#include "gaim.h" #include "debug.h" #include "util.h" @@ -200,7 +200,7 @@ } } -static void +static void gaim_upnp_http_send(gpointer data, gint sock, GaimInputCondition cond) @@ -232,7 +232,7 @@ nrd->inpa = gaim_input_add(sock, GAIM_INPUT_READ, gaim_upnp_http_read, nrd); while (!nrd->done) { - gtk_main_iteration(); + g_main_context_iteration(NULL, TRUE); } close(sock); } @@ -250,10 +250,10 @@ nrd->tima = gaim_timeout_add(RECEIVE_TIMEOUT, (GSourceFunc)gaim_upnp_timeout, nrd); - if(gaim_proxy_connect(NULL, address, port, + if(gaim_proxy_connect(NULL, address, port, gaim_upnp_http_send, nrd)) { - gaim_debug_error("upnp", "Connect Failed: Address: %s @@@ Port %d @@@ Request %s\n\n", + gaim_debug_error("upnp", "Connect Failed: Address: %s @@@ Port %d @@@ Request %s\n\n", address, port, nrd->sendBuffer); gaim_timeout_remove(nrd->tima); @@ -261,7 +261,7 @@ nrd->recvBuffer = NULL; } else { while (!nrd->done) { - gtk_main_iteration(); + g_main_context_iteration(NULL, TRUE); } } @@ -299,7 +299,7 @@ static gchar* -gaim_upnp_parse_description_response(const gchar* httpResponse, +gaim_upnp_parse_description_response(const gchar* httpResponse, const gchar* httpURL, const gchar* serviceType) { @@ -320,7 +320,7 @@ } /* find the root of the xml document */ - if((xmlRoot = g_strstr_len(httpResponse, strlen(httpResponse), + if((xmlRoot = g_strstr_len(httpResponse, strlen(httpResponse), "tima = gaim_timeout_add(DISCOVERY_TIMEOUT, + nrd->tima = gaim_timeout_add(DISCOVERY_TIMEOUT, (GSourceFunc)gaim_upnp_timeout, nrd); nrd->inpa = gaim_input_add(sock, GAIM_INPUT_READ, gaim_upnp_discover_udp_read, nrd); while (!nrd->done) { - gtk_main_iteration(); + g_main_context_iteration(NULL, TRUE); } if(nrd->recvBuffer == NULL) { recvSuccess = FALSE; @@ -736,7 +736,7 @@ static char* gaim_upnp_generate_action_message_and_send(const GaimUPnPControlInfo* controlInfo, - const gchar* actionName, + const gchar* actionName, const gchar* actionParams) { gchar* actionMessage; @@ -776,14 +776,14 @@ /* set the HTTP Header */ actionMessage = g_strdup_printf(HTTP_HEADER_ACTION, pathOfControl, addressPortOfControl, - controlInfo->serviceType, actionName, + controlInfo->serviceType, actionName, strlen(soapMessage)); /* append to the header the body */ totalSendMessage = g_strdup_printf("%s%s", actionMessage, soapMessage); /* get the return of the http response */ - httpResponse = gaim_upnp_http_request(addressOfControl, + httpResponse = gaim_upnp_http_request(addressOfControl, port, totalSendMessage); if(httpResponse == NULL) { gaim_debug_error("upnp", @@ -813,7 +813,7 @@ gchar* temp, *temp2; httpResponse = gaim_upnp_generate_action_message_and_send(controlInfo, - actionName, + actionName, actionParams); if(httpResponse == NULL) { gaim_debug_error("upnp", @@ -865,14 +865,14 @@ } static gchar* -gaim_upnp_get_local_ip_address(const gchar* address) +gaim_upnp_get_local_ip_address(const gchar* address) { gchar* ip; gchar* pathOfControl; gchar* addressOfControl; int port = 0; NetResponseData* nrd = (NetResponseData*)g_malloc0(sizeof(NetResponseData)); - + if(!gaim_url_parse(address, &addressOfControl, &port, &pathOfControl, NULL, NULL)) { gaim_debug_error("upnp", @@ -886,16 +886,16 @@ nrd->tima = gaim_timeout_add(RECEIVE_TIMEOUT, (GSourceFunc)gaim_upnp_timeout, nrd); - if(gaim_proxy_connect(NULL, addressOfControl, port, + if(gaim_proxy_connect(NULL, addressOfControl, port, gaim_upnp_get_local_system_ip, nrd)) { - gaim_debug_error("upnp", "Get Local IP Connect Failed: Address: %s @@@ Port %d @@@ Request %s\n\n", + gaim_debug_error("upnp", "Get Local IP Connect Failed: Address: %s @@@ Port %d @@@ Request %s\n\n", address, port, nrd->sendBuffer); gaim_timeout_remove(nrd->tima); } else { while (!nrd->done) { - gtk_main_iteration(); + g_main_context_iteration(NULL, TRUE); } } @@ -910,7 +910,7 @@ gboolean -gaim_upnp_set_port_mapping(const GaimUPnPControlInfo* controlInfo, +gaim_upnp_set_port_mapping(const GaimUPnPControlInfo* controlInfo, unsigned short portMap, const gchar* protocol) { @@ -928,11 +928,11 @@ } /* make the portMappingParams variable */ - actionParams = g_strdup_printf(ADD_PORT_MAPPING_PARAMS, portMap, + actionParams = g_strdup_printf(ADD_PORT_MAPPING_PARAMS, portMap, protocol, portMap, internalIP); httpResponse = gaim_upnp_generate_action_message_and_send(controlInfo, - actionName, + actionName, actionParams); if(httpResponse == NULL) { gaim_debug_error("upnp", @@ -962,7 +962,7 @@ gboolean -gaim_upnp_remove_port_mapping(const GaimUPnPControlInfo* controlInfo, +gaim_upnp_remove_port_mapping(const GaimUPnPControlInfo* controlInfo, unsigned short portMap, const char* protocol) { @@ -975,7 +975,7 @@ portMap, protocol); httpResponse = gaim_upnp_generate_action_message_and_send(controlInfo, - actionName, + actionName, actionParams); if(httpResponse == NULL) {