You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(106) |
Oct
(334) |
Nov
(246) |
Dec
(145) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(42) |
Feb
(53) |
Mar
(232) |
Apr
(109) |
May
(137) |
Jun
(63) |
Jul
(26) |
Aug
(263) |
Sep
(193) |
Oct
(507) |
Nov
(440) |
Dec
(241) |
2003 |
Jan
(567) |
Feb
(195) |
Mar
(504) |
Apr
(481) |
May
(524) |
Jun
(522) |
Jul
(594) |
Aug
(502) |
Sep
(643) |
Oct
(508) |
Nov
(430) |
Dec
(377) |
2004 |
Jan
(361) |
Feb
(251) |
Mar
(219) |
Apr
(499) |
May
(461) |
Jun
(419) |
Jul
(314) |
Aug
(519) |
Sep
(416) |
Oct
(247) |
Nov
(305) |
Dec
(382) |
2005 |
Jan
(267) |
Feb
(282) |
Mar
(327) |
Apr
(338) |
May
(189) |
Jun
(400) |
Jul
(462) |
Aug
(530) |
Sep
(316) |
Oct
(523) |
Nov
(481) |
Dec
(650) |
2006 |
Jan
(536) |
Feb
(361) |
Mar
(287) |
Apr
(146) |
May
(101) |
Jun
(169) |
Jul
(221) |
Aug
(498) |
Sep
(300) |
Oct
(236) |
Nov
(209) |
Dec
(205) |
2007 |
Jan
(30) |
Feb
(23) |
Mar
(26) |
Apr
(15) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <the...@us...> - 2006-08-21 05:49:24
|
Revision: 16945 Author: thekingant Date: 2006-08-20 22:49:20 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16945&view=rev Log Message: ----------- Don't call gethostbyname in a thread because it's not thread-safe. Modified Paths: -------------- trunk/libgaim/dnsquery.c Modified: trunk/libgaim/dnsquery.c =================================================================== --- trunk/libgaim/dnsquery.c 2006-08-21 05:25:44 UTC (rev 16944) +++ trunk/libgaim/dnsquery.c 2006-08-21 05:49:20 UTC (rev 16945) @@ -89,22 +89,17 @@ return FALSE; } +#ifdef HAVE_GETADDRINFO static gpointer dns_thread(gpointer data) { GaimDnsQueryData *query_data; -#ifdef HAVE_GETADDRINFO int rc; struct addrinfo hints, *res, *tmp; char servname[20]; -#else - struct sockaddr_in sin; - struct hostent *hp; -#endif query_data = data; -#ifdef HAVE_GETADDRINFO g_snprintf(servname, sizeof(servname), "%d", query_data->port); memset(&hints,0,sizeof(hints)); @@ -129,27 +124,13 @@ } else { query_data->error_message = g_strdup_printf(_("Error resolving %s: %s"), query_data->hostname, gai_strerror(rc)); } -#else - if ((hp = gethostbyname(query_data->hostname))) { - memset(&sin, 0, sizeof(struct sockaddr_in)); - memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length); - sin.sin_family = hp->h_addrtype; - sin.sin_port = htons(query_data->port); - query_data->hosts = g_slist_append(query_data->hosts, - GSIZE_TO_POINTER(sizeof(sin))); - query_data->hosts = g_slist_append(query_data->hosts, - g_memdup(&sin, sizeof(sin))); - } else { - query_data->error_message = g_strdup_printf(_("Error resolving %s: %d"), query_data->hostname, h_errno); - } -#endif - - /* back to main thread */ + /* We're done, tell the main thread to look at our results */ g_idle_add(dns_main_thread_cb, query_data); return 0; } +#endif static gboolean resolve_host(gpointer data) @@ -176,6 +157,7 @@ } else { +#ifdef HAVE_GETADDRINFO /* * Spin off a separate thread to perform the DNS lookup so * that we don't block the UI. @@ -190,6 +172,34 @@ g_error_free(err); gaim_dnsquery_failed(query_data, message); } +#else + struct sockaddr_in sin; + struct hostent *hp; + + /* + * gethostbyname() is not threadsafe, but gethostbyname_r() is a GNU + * extension. Unfortunately this means that we'll have to do a + * blocking DNS query for systems without GETADDRINFO. Fortunately + * this should be a very small number of systems. + */ + + if ((hp = gethostbyname(query_data->hostname))) { + memset(&sin, 0, sizeof(struct sockaddr_in)); + memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length); + sin.sin_family = hp->h_addrtype; + sin.sin_port = htons(query_data->port); + + query_data->hosts = g_slist_append(query_data->hosts, + GSIZE_TO_POINTER(sizeof(sin))); + query_data->hosts = g_slist_append(query_data->hosts, + g_memdup(&sin, sizeof(sin))); + } else { + query_data->error_message = g_strdup_printf(_("Error resolving %s: %d"), query_data->hostname, h_errno); + } + + /* We're done! */ + dns_main_thread(query_data); +#endif } return FALSE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-21 05:25:58
|
Revision: 16944 Author: thekingant Date: 2006-08-20 22:25:44 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16944&view=rev Log Message: ----------- Rename GaimProxyConnectInfo to GaimProxyConnectData, and change the variables from connect_info to connect_data. Sorry, but I wanted to get this right before it becomes permanent. Modified Paths: -------------- trunk/libgaim/protocols/irc/irc.c trunk/libgaim/protocols/irc/irc.h trunk/libgaim/protocols/jabber/jabber.c trunk/libgaim/protocols/jabber/jabber.h trunk/libgaim/protocols/jabber/si.c trunk/libgaim/protocols/msn/directconn.c trunk/libgaim/protocols/msn/directconn.h trunk/libgaim/protocols/msn/httpconn.c trunk/libgaim/protocols/msn/httpconn.h trunk/libgaim/protocols/msn/servconn.c trunk/libgaim/protocols/msn/servconn.h trunk/libgaim/protocols/oscar/flap_connection.c trunk/libgaim/protocols/oscar/oscar.c trunk/libgaim/protocols/oscar/oscar.h trunk/libgaim/protocols/oscar/peer.c trunk/libgaim/protocols/oscar/peer.h trunk/libgaim/protocols/oscar/peer_proxy.c trunk/libgaim/protocols/sametime/sametime.c trunk/libgaim/protocols/silc/silc.c trunk/libgaim/protocols/silc/silcgaim.h trunk/libgaim/protocols/simple/simple.c trunk/libgaim/proxy.c trunk/libgaim/proxy.h trunk/libgaim/sslconn.c trunk/libgaim/sslconn.h Modified: trunk/libgaim/protocols/irc/irc.c =================================================================== --- trunk/libgaim/protocols/irc/irc.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/irc/irc.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -324,11 +324,11 @@ if (!irc->gsc) { - irc->connect_info = gaim_proxy_connect(account, irc->server, + irc->connect_data = gaim_proxy_connect(account, irc->server, gaim_account_get_int(account, "port", IRC_DEFAULT_PORT), irc_login_cb, gc); - if (!irc->connect_info || !gaim_account_get_connection(account)) { + if (!irc->connect_data || !gaim_account_get_connection(account)) { gaim_connection_error(gc, _("Couldn't create socket")); return; } @@ -390,7 +390,7 @@ GaimConnection *gc = data; struct irc_conn *irc = gc->proto_data; - irc->connect_info = NULL; + irc->connect_data = NULL; if (source < 0) { gaim_connection_error(gc, _("Couldn't connect to host")); @@ -433,8 +433,8 @@ if (irc->gsc || (irc->fd >= 0)) irc_cmd_quit(irc, "quit", NULL, NULL); - if (irc->connect_info) - gaim_proxy_connect_cancel(irc->connect_info); + if (irc->connect_data) + gaim_proxy_connect_cancel(irc->connect_data); if (gc->inpa) gaim_input_remove(gc->inpa); Modified: trunk/libgaim/protocols/irc/irc.h =================================================================== --- trunk/libgaim/protocols/irc/irc.h 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/irc/irc.h 2006-08-21 05:25:44 UTC (rev 16944) @@ -54,7 +54,7 @@ guint timer; GHashTable *buddies; - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; char *inbuf; int inbuflen; Modified: trunk/libgaim/protocols/jabber/jabber.c =================================================================== --- trunk/libgaim/protocols/jabber/jabber.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/jabber/jabber.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -420,7 +420,7 @@ GaimConnection *gc = data; JabberStream *js = gc->proto_data; - js->connect_info = NULL; + js->connect_data = NULL; if (source < 0) { gaim_connection_error(gc, _("Couldn't connect to host")); @@ -465,10 +465,10 @@ static void jabber_login_connect(JabberStream *js, const char *server, int port) { - js->connect_info = gaim_proxy_connect(js->gc->account, server, + js->connect_data = gaim_proxy_connect(js->gc->account, server, port, jabber_login_callback, js->gc); - if (js->connect_info == NULL) + if (js->connect_data == NULL) gaim_connection_error(js->gc, _("Unable to create socket")); } @@ -900,11 +900,11 @@ } if(!js->gsc) { - js->connect_info = gaim_proxy_connect(account, server, + js->connect_data = gaim_proxy_connect(account, server, gaim_account_get_int(account, "port", 5222), jabber_login_callback, gc); - if (js->connect_info == NULL) + if (js->connect_data == NULL) gaim_connection_error(gc, _("Unable to create socket")); } } @@ -920,8 +920,8 @@ if (!gc->disconnect_timeout) jabber_send_raw(js, "</stream:stream>", -1); - if (js->connect_info) - gaim_proxy_connect_cancel(js->connect_info); + if (js->connect_data) + gaim_proxy_connect_cancel(js->connect_data); if(js->gsc) { #ifdef HAVE_OPENSSL Modified: trunk/libgaim/protocols/jabber/jabber.h =================================================================== --- trunk/libgaim/protocols/jabber/jabber.h 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/jabber/jabber.h 2006-08-21 05:25:44 UTC (rev 16944) @@ -67,7 +67,7 @@ { int fd; - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; #ifdef HAVE_LIBXML xmlParserCtxt *context; Modified: trunk/libgaim/protocols/jabber/si.c =================================================================== --- trunk/libgaim/protocols/jabber/si.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/jabber/si.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -46,7 +46,7 @@ typedef struct _JabberSIXfer { JabberStream *js; - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; gboolean accepted; @@ -100,7 +100,7 @@ struct bytestreams_streamhost *streamhost = jsx->streamhosts->data; gaim_proxy_info_destroy(jsx->gpi); - jsx->connect_info = NULL; + jsx->connect_data = NULL; if(source < 0) { jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost); @@ -171,11 +171,11 @@ for(i=0; i<20; i++, p+=2) snprintf(p, 3, "%02x", hashval[i]); - jsx->connect_info = gaim_proxy_connect_socks5(jsx->gpi, dstaddr, 0, + jsx->connect_data = gaim_proxy_connect_socks5(jsx->gpi, dstaddr, 0, jabber_si_bytestreams_connect_cb, xfer); g_free(dstaddr); - if (jsx->connect_info == NULL) + if (jsx->connect_data == NULL) { jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost); g_free(streamhost->jid); @@ -696,8 +696,8 @@ js->file_transfers = g_list_remove(js->file_transfers, xfer); - if (jsx->connect_info != NULL) - gaim_proxy_connect_cancel(jsx->connect_info); + if (jsx->connect_data != NULL) + gaim_proxy_connect_cancel(jsx->connect_data); g_free(jsx->stream_id); g_free(jsx->iq_id); Modified: trunk/libgaim/protocols/msn/directconn.c =================================================================== --- trunk/libgaim/protocols/msn/directconn.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/msn/directconn.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -361,7 +361,7 @@ gaim_debug_misc("msn", "directconn: connect_cb: %d\n", source); directconn = data; - directconn->connect_info = NULL; + directconn->connect_data = NULL; if (TRUE) { @@ -423,10 +423,10 @@ } #endif - directconn->connect_info = gaim_proxy_connect(session->account, host, port, + directconn->connect_data = gaim_proxy_connect(session->account, host, port, connect_cb, directconn); - if (directconn->connect_info != NULL) + if (directconn->connect_data != NULL) { return TRUE; } @@ -476,8 +476,8 @@ void msn_directconn_destroy(MsnDirectConn *directconn) { - if (directconn->connect_info != NULL) - gaim_proxy_connect_cancel(directconn->connect_info); + if (directconn->connect_data != NULL) + gaim_proxy_connect_cancel(directconn->connect_data); if (directconn->inpa != 0) gaim_input_remove(directconn->inpa); Modified: trunk/libgaim/protocols/msn/directconn.h =================================================================== --- trunk/libgaim/protocols/msn/directconn.h 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/msn/directconn.h 2006-08-21 05:25:44 UTC (rev 16944) @@ -35,7 +35,7 @@ MsnSlpLink *slplink; MsnSlpCall *initial_call; - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; gboolean acked; Modified: trunk/libgaim/protocols/msn/httpconn.c =================================================================== --- trunk/libgaim/protocols/msn/httpconn.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/msn/httpconn.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -698,7 +698,7 @@ MsnHttpConn *httpconn; httpconn = data; - httpconn->connect_info = NULL; + httpconn->connect_data = NULL; httpconn->fd = source; if (source >= 0) @@ -727,10 +727,10 @@ if (httpconn->connected) msn_httpconn_disconnect(httpconn); - httpconn->connect_info = gaim_proxy_connect(httpconn->session->account, + httpconn->connect_data = gaim_proxy_connect(httpconn->session->account, "gateway.messenger.hotmail.com", 80, connect_cb, httpconn); - if (httpconn->connect_info != NULL) + if (httpconn->connect_data != NULL) { httpconn->waiting_response = TRUE; httpconn->connected = TRUE; @@ -747,10 +747,10 @@ if (!httpconn->connected) return; - if (httpconn->connect_info != NULL) + if (httpconn->connect_data != NULL) { - gaim_proxy_connect_cancel(httpconn->connect_info); - httpconn->connect_info = NULL; + gaim_proxy_connect_cancel(httpconn->connect_data); + httpconn->connect_data = NULL; } if (httpconn->timer) Modified: trunk/libgaim/protocols/msn/httpconn.h =================================================================== --- trunk/libgaim/protocols/msn/httpconn.h 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/msn/httpconn.h 2006-08-21 05:25:44 UTC (rev 16944) @@ -37,7 +37,7 @@ MsnSession *session; /**< The MSN Session. */ MsnServConn *servconn; /**< The connection object. */ - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; char *full_session_id; /**< The full session id. */ char *session_id; /**< The trimmed session id. */ Modified: trunk/libgaim/protocols/msn/servconn.c =================================================================== --- trunk/libgaim/protocols/msn/servconn.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/msn/servconn.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -171,7 +171,7 @@ MsnServConn *servconn; servconn = data; - servconn->connect_info = NULL; + servconn->connect_data = NULL; servconn->processing = FALSE; if (servconn->wasted) @@ -233,10 +233,10 @@ return TRUE; } - servconn->connect_info = gaim_proxy_connect(session->account, host, port, + servconn->connect_data = gaim_proxy_connect(session->account, host, port, connect_cb, servconn); - if (servconn->connect_info != NULL) + if (servconn->connect_data != NULL) { servconn->processing = TRUE; return TRUE; @@ -268,10 +268,10 @@ return; } - if (servconn->connect_info != NULL) + if (servconn->connect_data != NULL) { - gaim_proxy_connect_cancel(servconn->connect_info); - servconn->connect_info = NULL; + gaim_proxy_connect_cancel(servconn->connect_data); + servconn->connect_data = NULL; } if (servconn->inpa > 0) Modified: trunk/libgaim/protocols/msn/servconn.h =================================================================== --- trunk/libgaim/protocols/msn/servconn.h 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/msn/servconn.h 2006-08-21 05:25:44 UTC (rev 16944) @@ -63,7 +63,7 @@ MsnSession *session; /**< The MSN session of this connection. */ MsnCmdProc *cmdproc; /**< The command processor of this connection. */ - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; gboolean connected; /**< A flag that states if it's connected. */ gboolean processing; /**< A flag that states if something is working Modified: trunk/libgaim/protocols/oscar/flap_connection.c =================================================================== --- trunk/libgaim/protocols/oscar/flap_connection.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/oscar/flap_connection.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -140,17 +140,17 @@ void flap_connection_close(OscarData *od, FlapConnection *conn) { - if (conn->connect_info != NULL) + if (conn->connect_data != NULL) { - gaim_proxy_connect_cancel(conn->connect_info); - conn->connect_info = NULL; + gaim_proxy_connect_cancel(conn->connect_data); + conn->connect_data = NULL; } if (conn->connect_data != NULL) { if (conn->type == SNAC_FAMILY_CHAT) { - oscar_chat_destroy(conn->connect_data); + oscar_chat_destroy(conn->new_conn_data); conn->connect_data = NULL; } } Modified: trunk/libgaim/protocols/oscar/oscar.c =================================================================== --- trunk/libgaim/protocols/oscar/oscar.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/oscar/oscar.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -919,7 +919,7 @@ gc = od->gc; account = gaim_connection_get_account(gc); - conn->connect_info = NULL; + conn->connect_data = NULL; conn->fd = source; if (source < 0) @@ -972,8 +972,8 @@ } else if (conn->type == SNAC_FAMILY_CHAT) { - od->oscar_chats = g_slist_append(od->oscar_chats, conn->connect_data); - conn->connect_data = NULL; + od->oscar_chats = g_slist_append(od->oscar_chats, conn->new_conn_data); + conn->new_conn_data = NULL; } } @@ -1197,11 +1197,11 @@ gaim_prefs_connect_callback(gc, "/plugins/prpl/oscar/recent_buddies", recent_buddies_cb, gc); newconn = flap_connection_new(od, SNAC_FAMILY_AUTH); - newconn->connect_info = gaim_proxy_connect(account, + newconn->connect_data = gaim_proxy_connect(account, gaim_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER), gaim_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT), connection_established_cb, newconn); - if (newconn->connect_info == NULL) + if (newconn->connect_data == NULL) { gaim_connection_error(gc, _("Couldn't connect to host")); return; @@ -1314,10 +1314,10 @@ newconn = flap_connection_new(od, SNAC_FAMILY_LOCATE); newconn->cookielen = info->cookielen; newconn->cookie = g_memdup(info->cookie, info->cookielen); - newconn->connect_info = gaim_proxy_connect(account, host, port, + newconn->connect_data = gaim_proxy_connect(account, host, port, connection_established_cb, newconn); g_free(host); - if (newconn->connect_info == NULL) + if (newconn->connect_data == NULL) { gaim_connection_error(gc, _("Could Not Connect")); od->killme = TRUE; @@ -1609,13 +1609,13 @@ cc->exchange = redir->chat.exchange; cc->instance = redir->chat.instance; cc->show = extract_name(redir->chat.room); - newconn->connect_data = cc; + newconn->new_conn_data = cc; gaim_debug_info("oscar", "Connecting to chat room %s exchange %hu\n", cc->name, cc->exchange); } - newconn->connect_info = gaim_proxy_connect(account, host, port, + newconn->connect_data = gaim_proxy_connect(account, host, port, connection_established_cb, newconn); - if (newconn->connect_info == NULL) + if (newconn->connect_data == NULL) { flap_connection_schedule_destroy(newconn, OSCAR_DISCONNECT_COULD_NOT_CONNECT); gaim_debug_error("oscar", "Unable to connect to FLAP server " Modified: trunk/libgaim/protocols/oscar/oscar.h =================================================================== --- trunk/libgaim/protocols/oscar/oscar.h 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/oscar/oscar.h 2006-08-21 05:25:44 UTC (rev 16944) @@ -368,10 +368,10 @@ OscarDisconnectReason disconnect_reason; /* A few variables that are only used when connecting */ - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; guint16 cookielen; guint8 *cookie; - gpointer connect_data; + gpointer new_conn_data; int fd; FlapFrame buffer_incoming; Modified: trunk/libgaim/protocols/oscar/peer.c =================================================================== --- trunk/libgaim/protocols/oscar/peer.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/oscar/peer.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -139,10 +139,10 @@ else if (conn->type == OSCAR_CAPABILITY_SENDFILE) peer_oft_close(conn); - if (conn->connect_info != NULL) + if (conn->connect_data != NULL) { - gaim_proxy_connect_cancel(conn->connect_info); - conn->connect_info = NULL; + gaim_proxy_connect_cancel(conn->connect_data); + conn->connect_data = NULL; } if (conn->connect_timeout_timer != 0) @@ -488,7 +488,7 @@ conn = data; - conn->connect_info = NULL; + conn->connect_data = NULL; gaim_timeout_remove(conn->connect_timeout_timer); conn->connect_timeout_timer = 0; @@ -702,10 +702,10 @@ g_free(tmp); } - conn->connect_info = gaim_proxy_connect(account, + conn->connect_data = gaim_proxy_connect(account, conn->verifiedip, conn->port, peer_connection_established_cb, conn); - if (conn->connect_info != NULL) + if (conn->connect_data != NULL) { /* Connecting... */ conn->connect_timeout_timer = gaim_timeout_add(15000, @@ -737,10 +737,10 @@ g_free(tmp); } - conn->connect_info = gaim_proxy_connect(account, + conn->connect_data = gaim_proxy_connect(account, conn->clientip, conn->port, peer_connection_established_cb, conn); - if (conn->connect_info != NULL) + if (conn->connect_data != NULL) { /* Connecting... */ conn->connect_timeout_timer = gaim_timeout_add(15000, @@ -808,11 +808,11 @@ g_free(tmp); } - conn->connect_info = gaim_proxy_connect(account, + conn->connect_data = gaim_proxy_connect(account, (conn->proxyip != NULL) ? conn->proxyip : PEER_PROXY_SERVER, PEER_PROXY_PORT, peer_proxy_connection_established_cb, conn); - if (conn->connect_info != NULL) + if (conn->connect_data != NULL) { /* Connecting... */ return; Modified: trunk/libgaim/protocols/oscar/peer.h =================================================================== --- trunk/libgaim/protocols/oscar/peer.h 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/oscar/peer.h 2006-08-21 05:25:44 UTC (rev 16944) @@ -161,7 +161,7 @@ /** * This is only used when the peer connection is being established. */ - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; /** * This is only used when the peer connection is being established. Modified: trunk/libgaim/protocols/oscar/peer_proxy.c =================================================================== --- trunk/libgaim/protocols/oscar/peer_proxy.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/oscar/peer_proxy.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -332,7 +332,7 @@ conn = data; - conn->connect_info = NULL; + conn->connect_data = NULL; if (source < 0) { Modified: trunk/libgaim/protocols/sametime/sametime.c =================================================================== --- trunk/libgaim/protocols/sametime/sametime.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/sametime/sametime.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -226,7 +226,7 @@ /** socket fd */ int socket; gint outpa; /* like inpa, but the other way */ - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; /** circular buffer for outgoing data */ GaimCircBuffer *sock_buf; @@ -1675,7 +1675,7 @@ struct mwGaimPluginData *pd = data; GaimConnection *gc = pd->gc; - pd->connect_info = NULL; + pd->connect_data = NULL; if(source < 0) { /* connection failed */ @@ -3681,8 +3681,8 @@ gaim_connection_update_progress(gc, _("Connecting"), 1, MW_CONNECT_STEPS); - pd->connect_info = gaim_proxy_connect(account, host, port, connect_cb, pd); - if(pd->connect_info == NULL) { + pd->connect_data = gaim_proxy_connect(account, host, port, connect_cb, pd); + if(pd->connect_data == NULL) { gaim_connection_error(gc, _("Unable to connect to host")); } } @@ -3715,9 +3715,9 @@ gc->inpa = 0; } - if(pd->connect_info != NULL) { - gaim_proxy_connect_cancel(pd->connect_info); - pd->connect_info = NULL; + if(pd->connect_data != NULL) { + gaim_proxy_connect_cancel(pd->connect_data); + pd->connect_data = NULL; } /* clean up the rest */ Modified: trunk/libgaim/protocols/silc/silc.c =================================================================== --- trunk/libgaim/protocols/silc/silc.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/silc/silc.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -154,7 +154,7 @@ g_return_if_fail(gc != NULL); sg = gc->proto_data; - sg->connect_info = NULL; + sg->connect_data = NULL; if (source < 0) { gaim_connection_error(gc, _("Connection failed")); @@ -357,12 +357,12 @@ gc->proto_data = sg; /* Connect to the SILC server */ - sg->connect_info = gaim_proxy_connect(account, + sg->connect_data = gaim_proxy_connect(account, gaim_account_get_string(account, "server", "silc.silcnet.org"), gaim_account_get_int(account, "port", 706), silcgaim_login_connected, gc); - if (sg->connect_info == NULL) + if (sg->connect_data == NULL) { gaim_connection_error(gc, _("Unable to create connection")); return; @@ -382,8 +382,8 @@ SilcGaim sg = (SilcGaim)context; silc_client_stop(sg->client); silc_client_free(sg->client); - if (sg->connect_info != NULL) - gaim_proxy_connect_cancel(sg->connect_info); + if (sg->connect_data != NULL) + gaim_proxy_connect_cancel(sg->connect_data); #ifdef HAVE_SILCMIME_H if (sg->mimeass) silc_mime_assembler_free(sg->mimeass); Modified: trunk/libgaim/protocols/silc/silcgaim.h =================================================================== --- trunk/libgaim/protocols/silc/silcgaim.h 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/silc/silcgaim.h 2006-08-21 05:25:44 UTC (rev 16944) @@ -67,7 +67,7 @@ SilcClient client; SilcClientConnection conn; - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; guint scheduler; GaimConnection *gc; GaimAccount *account; Modified: trunk/libgaim/protocols/simple/simple.c =================================================================== --- trunk/libgaim/protocols/simple/simple.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/protocols/simple/simple.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -457,12 +457,12 @@ static void sendlater(GaimConnection *gc, const char *buf) { struct simple_account_data *sip = gc->proto_data; - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; if(!sip->connecting) { gaim_debug_info("simple", "connecting to %s port %d\n", sip->realhostname ? sip->realhostname : "{NULL}", sip->realport); - connect_info = gaim_proxy_connect(sip->account, sip->realhostname, sip->realport, send_later_cb, gc); - if(connect_info == NULL) { + connect_data = gaim_proxy_connect(sip->account, sip->realhostname, sip->realport, send_later_cb, gc); + if(connect_data == NULL) { gaim_connection_error(gc, _("Couldn't create socket")); } sip->connecting = TRUE; @@ -1556,7 +1556,7 @@ static void simple_tcp_connect_listen_cb(int listenfd, gpointer data) { struct simple_account_data *sip = (struct simple_account_data*) data; - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; sip->listenfd = listenfd; if(sip->listenfd == -1) { @@ -1571,9 +1571,9 @@ gaim_debug_info("simple", "connecting to %s port %d\n", sip->realhostname, sip->realport); /* open tcp connection to the server */ - connect_info = gaim_proxy_connect(sip->account, sip->realhostname, + connect_data = gaim_proxy_connect(sip->account, sip->realhostname, sip->realport, login_cb, sip->gc); - if(connect_info == NULL) { + if(connect_data == NULL) { gaim_connection_error(sip->gc, _("Couldn't create socket")); } } Modified: trunk/libgaim/proxy.c =================================================================== --- trunk/libgaim/proxy.c 2006-08-21 05:07:42 UTC (rev 16943) +++ trunk/libgaim/proxy.c 2006-08-21 05:25:44 UTC (rev 16944) @@ -39,7 +39,7 @@ #include "proxy.h" #include "util.h" -struct _GaimProxyConnectInfo { +struct _GaimProxyConnectData { GaimProxyConnectFunction connect_cb; gpointer data; char *host; @@ -87,9 +87,9 @@ * of the return value from that function this linked list * will no longer be needed. */ -static GSList *connect_infos = NULL; +static GSList *connect_datas = NULL; -static void try_connect(GaimProxyConnectInfo *connect_info); +static void try_connect(GaimProxyConnectData *connect_data); /************************************************************************** * Proxy structure API @@ -281,63 +281,63 @@ * be called immediately after this. */ static void -gaim_proxy_connect_info_disconnect(GaimProxyConnectInfo *connect_info) +gaim_proxy_connect_data_disconnect(GaimProxyConnectData *connect_data) { - if (connect_info->inpa > 0) + if (connect_data->inpa > 0) { - gaim_input_remove(connect_info->inpa); - connect_info->inpa = 0; + gaim_input_remove(connect_data->inpa); + connect_data->inpa = 0; } - if (connect_info->fd >= 0) + if (connect_data->fd >= 0) { - close(connect_info->fd); - connect_info->fd = -1; + close(connect_data->fd); + connect_data->fd = -1; } - g_free(connect_info->write_buffer); - connect_info->write_buffer = NULL; + g_free(connect_data->write_buffer); + connect_data->write_buffer = NULL; - g_free(connect_info->read_buffer); - connect_info->read_buffer = NULL; + g_free(connect_data->read_buffer); + connect_data->read_buffer = NULL; } static void -gaim_proxy_connect_info_destroy(GaimProxyConnectInfo *connect_info) +gaim_proxy_connect_data_destroy(GaimProxyConnectData *connect_data) { - gaim_proxy_connect_info_disconnect(connect_info); + gaim_proxy_connect_data_disconnect(connect_data); - connect_infos = g_slist_remove(connect_infos, connect_info); + connect_datas = g_slist_remove(connect_datas, connect_data); - if (connect_info->query_data != NULL) - gaim_dnsquery_destroy(connect_info->query_data); + if (connect_data->query_data != NULL) + gaim_dnsquery_destroy(connect_data->query_data); - while (connect_info->hosts != NULL) + while (connect_data->hosts != NULL) { /* Discard the length... */ - connect_info->hosts = g_slist_remove(connect_info->hosts, connect_info->hosts->data); + connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data); /* Free the address... */ - g_free(connect_info->hosts->data); - connect_info->hosts = g_slist_remove(connect_info->hosts, connect_info->hosts->data); + g_free(connect_data->hosts->data); + connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data); } - g_free(connect_info->host); - g_free(connect_info); + g_free(connect_data->host); + g_free(connect_data); } static void -gaim_proxy_connect_info_connected(GaimProxyConnectInfo *connect_info) +gaim_proxy_connect_data_connected(GaimProxyConnectData *connect_data) { - connect_info->connect_cb(connect_info->data, connect_info->fd, NULL); + connect_data->connect_cb(connect_data->data, connect_data->fd, NULL); /* * We've passed the file descriptor to the protocol, so it's no longer * our responsibility, and we should be careful not to free it when - * we destroy the connect_info. + * we destroy the connect_data. */ - connect_info->fd = -1; + connect_data->fd = -1; - gaim_proxy_connect_info_destroy(connect_info); + gaim_proxy_connect_data_destroy(connect_data); } /** @@ -350,16 +350,16 @@ * good error_message. */ static void -gaim_proxy_connect_info_error(GaimProxyConnectInfo *connect_info, const gchar *error_message) +gaim_proxy_connect_data_error(GaimProxyConnectData *connect_data, const gchar *error_message) { - connect_info->connect_cb(connect_info->data, -1, error_message); - gaim_proxy_connect_info_destroy(connect_info); + connect_data->connect_cb(connect_data->data, -1, error_message); + gaim_proxy_connect_data_destroy(connect_data); } static void no_one_calls(gpointer data, gint source, GaimInputCondition cond) { - GaimProxyConnectInfo *connect_info = data; + GaimProxyConnectData *connect_data = data; socklen_t len; int error=0, ret; @@ -378,7 +378,7 @@ * be overly optimistic sometimes. select is just a hint that you might be * able to do something.) */ - ret = getsockopt(connect_info->fd, SOL_SOCKET, SO_ERROR, &error, &len); + ret = getsockopt(connect_data->fd, SOL_SOCKET, SO_ERROR, &error, &len); if (ret == 0 && error == EINPROGRESS) return; /* we'll be called again later */ if (ret < 0 || error != 0) { @@ -388,57 +388,57 @@ gaim_debug_error("proxy", "getsockopt SO_ERROR check: %s\n", strerror(error)); - gaim_proxy_connect_info_disconnect(connect_info); - try_connect(connect_info); + gaim_proxy_connect_data_disconnect(connect_data); + try_connect(connect_data); return; } - gaim_input_remove(connect_info->inpa); - connect_info->inpa = 0; + gaim_input_remove(connect_data->inpa); + connect_data->inpa = 0; - gaim_proxy_connect_info_connected(connect_info); + gaim_proxy_connect_data_connected(connect_data); } static gboolean clean_connect(gpointer data) { - GaimProxyConnectInfo *connect_info; + GaimProxyConnectData *connect_data; - connect_info = data; - gaim_proxy_connect_info_connected(connect_info); + connect_data = data; + gaim_proxy_connect_data_connected(connect_data); return FALSE; } static int -proxy_connect_none(GaimProxyConnectInfo *connect_info, struct sockaddr *addr, socklen_t addrlen) +proxy_connect_none(GaimProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) { gaim_debug_info("proxy", "Connecting to %s:%d with no proxy\n", - connect_info->host, connect_info->port); + connect_data->host, connect_data->port); - connect_info->fd = socket(addr->sa_family, SOCK_STREAM, 0); - if (connect_info->fd < 0) + connect_data->fd = socket(addr->sa_family, SOCK_STREAM, 0); + if (connect_data->fd < 0) { gaim_debug_error("proxy", "Unable to create socket: %s\n", strerror(errno)); return -1; } - fcntl(connect_info->fd, F_SETFL, O_NONBLOCK); + fcntl(connect_data->fd, F_SETFL, O_NONBLOCK); #ifndef _WIN32 - fcntl(connect_info->fd, F_SETFD, FD_CLOEXEC); + fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); #endif - if (connect(connect_info->fd, (struct sockaddr *)addr, addrlen) != 0) + if (connect(connect_data->fd, (struct sockaddr *)addr, addrlen) != 0) { if ((errno == EINPROGRESS) || (errno == EINTR)) { gaim_debug_info("proxy", "Connection in progress\n"); - connect_info->inpa = gaim_input_add(connect_info->fd, GAIM_INPUT_WRITE, no_one_calls, connect_info); + connect_data->inpa = gaim_input_add(connect_data->fd, GAIM_INPUT_WRITE, no_one_calls, connect_data); } else { gaim_debug_error("proxy", "Connect failed: %s\n", strerror(errno)); - close(connect_info->fd); - connect_info->fd = -1; + close(connect_data->fd); + connect_data->fd = -1; return -1; } } @@ -451,11 +451,11 @@ int error = ETIMEDOUT; gaim_debug_info("proxy", "Connected immediately.\n"); len = sizeof(error); - if (getsockopt(connect_info->fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0) + if (getsockopt(connect_data->fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0) { gaim_debug_error("proxy", "getsockopt failed.\n"); - close(connect_info->fd); - connect_info->fd = -1; + close(connect_data->fd); + connect_data->fd = -1; return -1; } @@ -463,38 +463,38 @@ * We want to call the "connected" callback eventually, but we * don't want to call it before we return, just in case. */ - gaim_timeout_add(10, clean_connect, connect_info); + gaim_timeout_add(10, clean_connect, connect_data); } - return connect_info->fd; + return connect_data->fd; } static void proxy_do_write(gpointer data, gint source, GaimInputCondition cond) { - GaimProxyConnectInfo *connect_info = data; - const guchar *request = connect_info->write_buffer + connect_info->written_len; - gsize request_len = connect_info->write_buf_len - connect_info->written_len; + GaimProxyConnectData *connect_data = data; + const guchar *request = connect_data->write_buffer + connect_data->written_len; + gsize request_len = connect_data->write_buf_len - connect_data->written_len; - int ret = write(connect_info->fd, request, request_len); + int ret = write(connect_data->fd, request, request_len); if(ret < 0 && errno == EAGAIN) return; else if(ret < 0) { - gaim_proxy_connect_info_disconnect(connect_info); - try_connect(connect_info); + gaim_proxy_connect_data_disconnect(connect_data); + try_connect(connect_data); return; } else if (ret < request_len) { - connect_info->written_len += ret; + connect_data->written_len += ret; return; } - gaim_input_remove(connect_info->inpa); - g_free(connect_info->write_buffer); - connect_info->write_buffer = NULL; + gaim_input_remove(connect_data->inpa); + g_free(connect_data->write_buffer); + connect_data->write_buffer = NULL; /* register the response handler for the response */ - connect_info->inpa = gaim_input_add(connect_info->fd, GAIM_INPUT_READ, connect_info->read_cb, connect_info); + connect_data->inpa = gaim_input_add(connect_data->fd, GAIM_INPUT_READ, connect_data->read_cb, connect_data); } #define HTTP_GOODSTRING "HTTP/1.0 200" @@ -506,44 +506,44 @@ { int len, headers_len, status = 0; gboolean error; - GaimProxyConnectInfo *connect_info = data; + GaimProxyConnectData *connect_data = data; guchar *p; gsize max_read; gchar *msg; - if(connect_info->read_buffer == NULL) { - connect_info->read_buf_len = 8192; - connect_info->read_buffer = g_malloc(connect_info->read_buf_len); - connect_info->read_len = 0; + if(connect_data->read_buffer == NULL) { + connect_data->read_buf_len = 8192; + connect_data->read_buffer = g_malloc(connect_data->read_buf_len); + connect_data->read_len = 0; } - p = connect_info->read_buffer + connect_info->read_len; - max_read = connect_info->read_buf_len - connect_info->read_len - 1; + p = connect_data->read_buffer + connect_data->read_len; + max_read = connect_data->read_buf_len - connect_data->read_len - 1; - len = read(connect_info->fd, p, max_read); + len = read(connect_data->fd, p, max_read); if(len < 0 && errno == EAGAIN) return; else if(len <= 0) { - gaim_proxy_connect_info_error(connect_info, _("Lost connection with server for an unknown reason.")); + gaim_proxy_connect_data_error(connect_data, _("Lost connection with server for an unknown reason.")); return; } else { - connect_info->read_len += len; + connect_data->read_len += len; } p[len] = '\0'; - if((p = (guchar *)g_strstr_len((const gchar *)connect_info->read_buffer, connect_info->read_len, "\r\n\r\n"))) { + if((p = (guchar *)g_strstr_len((const gchar *)connect_data->read_buffer, connect_data->read_len, "\r\n\r\n"))) { *p = '\0'; - headers_len = (p - connect_info->read_buffer) + 4; + headers_len = (p - connect_data->read_buffer) + 4; } else if(len == max_read) headers_len = len; else return; - error = strncmp((const char *)connect_info->read_buffer, "HTTP/", 5) != 0; + error = strncmp((const char *)connect_data->read_buffer, "HTTP/", 5) != 0; if (!error) { int major; - p = connect_info->read_buffer + 5; + p = connect_data->read_buffer + 5; major = strtol((const char *)p, (char **)&p, 10); error = (major == 0) || (*p != '.'); if(!error) { @@ -560,7 +560,7 @@ } /* Read the contents */ - p = (guchar *)g_strrstr((const gchar *)connect_info->read_buffer, "Content-Length: "); + p = (guchar *)g_strrstr((const gchar *)connect_data->read_buffer, "Content-Length: "); if (p != NULL) { gchar *tmp; @@ -575,12 +575,12 @@ *tmp = '\r'; /* Compensate for what has already been read */ - len -= connect_info->read_len - headers_len; + len -= connect_data->read_len - headers_len; /* I'm assuming that we're doing this to prevent the server from complaining / breaking since we don't read the whole page */ while(len--) { /* TODO: deal with EAGAIN (and other errors) better */ - if (read(connect_info->fd, &tmpc, 1) < 0 && errno != EAGAIN) + if (read(connect_data->fd, &tmpc, 1) < 0 && errno != EAGAIN) break; } } @@ -588,8 +588,8 @@ if (error) { msg = g_strdup_printf("Unable to parse response from HTTP proxy: %s\n", - connect_info->read_buffer); - gaim_proxy_connect_info_error(connect_info, msg); + connect_data->read_buffer); + gaim_proxy_connect_data_error(connect_data, msg); g_free(msg); return; } @@ -597,15 +597,15 @@ { gaim_debug_error("proxy", "Proxy server replied with:\n%s\n", - connect_info->read_buffer); + connect_data->read_buffer); if(status == 407 /* Proxy Auth */) { gchar *ntlm; - if((ntlm = g_strrstr((const gchar *)connect_info->read_buffer, "Proxy-Authenticate: NTLM "))) { /* Check for Type-2 */ + if((ntlm = g_strrstr((const gchar *)connect_data->read_buffer, "Proxy-Authenticate: NTLM "))) { /* Check for Type-2 */ gchar *tmp = ntlm; guint8 *nonce; - gchar *domain = (gchar*)gaim_proxy_info_get_username(connect_info->gpi); + gchar *domain = (gchar*)gaim_proxy_info_get_username(connect_data->gpi); gchar *username; gchar *request; gchar *response; @@ -613,7 +613,7 @@ if (username == NULL) { msg = g_strdup_printf(_("HTTP proxy connection error %d"), status); - gaim_proxy_connect_info_error(connect_info, msg); + gaim_proxy_connect_data_error(connect_data, msg); g_free(msg); return; } @@ -624,8 +624,8 @@ *tmp = '\0'; nonce = gaim_ntlm_parse_type2(ntlm, NULL); response = gaim_ntlm_gen_type3(username, - (gchar*) gaim_proxy_info_get_password(connect_info->gpi), - (gchar*) gaim_proxy_info_get_host(connect_info->gpi), + (gchar*) gaim_proxy_info_get_password(connect_data->gpi), + (gchar*) gaim_proxy_info_get_host(connect_data->gpi), domain, nonce, NULL); username--; *username = '\\'; @@ -634,35 +634,35 @@ "Host: %s:%d\r\n" "Proxy-Authorization: NTLM %s\r\n" "Proxy-Connection: Keep-Alive\r\n\r\n", - connect_info->host, connect_info->port, connect_info->host, - connect_info->port, response); + connect_data->host, connect_data->port, connect_data->host, + connect_data->port, response); g_free(response); - gaim_input_remove(connect_info->inpa); - g_free(connect_info->read_buffer); - connect_info->read_buffer = NULL; + gaim_input_remove(connect_data->inpa); + g_free(connect_data->read_buffer); + connect_data->read_buffer = NULL; - connect_info->write_buffer = (guchar *)request; - connect_info->write_buf_len = strlen(request); - connect_info->written_len = 0; + connect_data->write_buffer = (guchar *)request; + connect_data->write_buf_len = strlen(request); + connect_data->written_len = 0; - connect_info->read_cb = http_canread; + connect_data->read_cb = http_canread; - connect_info->inpa = gaim_input_add(connect_info->fd, - GAIM_INPUT_WRITE, proxy_do_write, connect_info); + connect_data->inpa = gaim_input_add(connect_data->fd, + GAIM_INPUT_WRITE, proxy_do_write, connect_data); - proxy_do_write(connect_info, connect_info->fd, cond); + proxy_do_write(connect_data, connect_data->fd, cond); return; - } else if((ntlm = g_strrstr((const char *)connect_info->read_buffer, "Proxy-Authenticate: NTLM"))) { /* Empty message */ + } else if((ntlm = g_strrstr((const char *)connect_data->read_buffer, "Proxy-Authenticate: NTLM"))) { /* Empty message */ gchar request[2048]; - gchar *domain = (gchar*) gaim_proxy_info_get_username(connect_info->gpi); + gchar *domain = (gchar*) gaim_proxy_info_get_username(connect_data->gpi); gchar *username; int request_len; username = strchr(domain, '\\'); if (username == NULL) { msg = g_strdup_printf(_("HTTP proxy connection error %d"), status); - gaim_proxy_connect_info_error(connect_info, msg); + gaim_proxy_connect_data_error(connect_data, msg); g_free(msg); return; } @@ -671,8 +671,8 @@ request_len = g_snprintf(request, sizeof(request), "CONNECT %s:%d HTTP/1.1\r\n" "Host: %s:%d\r\n", - connect_info->host, connect_info->port, - connect_info->host, connect_info->port); + connect_data->host, connect_data->port, + connect_data->host, connect_data->port); g_return_if_fail(request_len < sizeof(request)); request_len += g_snprintf(request + request_len, @@ -680,48 +680,48 @@ "Proxy-Authorization: NTLM %s\r\n" "Proxy-Connection: Keep-Alive\r\n\r\n", gaim_ntlm_gen_type1( - (gchar*) gaim_proxy_info_get_host(connect_info->gpi), + (gchar*) gaim_proxy_info_get_host(connect_data->gpi), domain)); *username = '\\'; - gaim_input_remove(connect_info->inpa); - g_free(connect_info->read_buffer); - connect_info->read_buffer = NULL; + gaim_input_remove(connect_data->inpa); + g_free(connect_data->read_buffer); + connect_data->read_buffer = NULL; - connect_info->write_buffer = g_memdup(request, request_len); - connect_info->write_buf_len = request_len; - connect_info->written_len = 0; + connect_data->write_buffer = g_memdup(request, request_len); + connect_data->write_buf_len = request_len; + connect_data->written_len = 0; - connect_info->read_cb = http_canread; + connect_data->read_cb = http_canread; - connect_info->inpa = gaim_input_add(connect_info->fd, - GAIM_INPUT_WRITE, proxy_do_write, connect_info); + connect_data->inpa = gaim_input_add(connect_data->fd, + GAIM_INPUT_WRITE, proxy_do_write, connect_data); - proxy_do_write(connect_info, connect_info->fd, cond); + proxy_do_write(connect_data, connect_data->fd, cond); return; } else { msg = g_strdup_printf(_("HTTP proxy connection error %d"), status); - gaim_proxy_connect_info_error(connect_info, msg); + gaim_proxy_connect_data_error(connect_data, msg); g_free(msg); return; } } if(status == 403 /* Forbidden */ ) { - msg = g_strdup_printf(_("Access denied: HTTP proxy server forbids port %d tunnelling."), connect_info->port); - gaim_proxy_connect_info_error(connect_info, msg); + msg = g_strdup_printf(_("Access denied: HTTP proxy server forbids port %d tunnelling."), connect_data->port); + gaim_proxy_connect_data_error(connect_data, msg); g_free(msg); } else { msg = g_strdup_printf(_("HTTP proxy connection error %d"), status); - gaim_proxy_connect_info_error(connect_info, msg); + gaim_proxy_connect_data_error(connect_data, msg); g_free(msg); } } else { - gaim_input_remove(connect_info->inpa); - connect_info->inpa = 0; - g_free(connect_info->read_buffer); - connect_info->read_buffer = NULL; + gaim_input_remove(connect_data->inpa); + connect_data->inpa = 0; + g_free(connect_data->read_buffer); + connect_data->read_buffer = NULL; gaim_debug_info("proxy", "HTTP proxy connection established\n"); - gaim_proxy_connect_info_connected(connect_info); + gaim_proxy_connect_data_connected(connect_data); return; } } @@ -733,38 +733,38 @@ { char request[8192]; int request_len = 0; - GaimProxyConnectInfo *connect_info = data; + GaimProxyConnectData *connect_data = data; socklen_t len; int error = ETIMEDOUT; gaim_debug_info("http proxy", "Connected.\n"); - if (connect_info->inpa > 0) + if (connect_data->inpa > 0) { - gaim_input_remove(connect_info->inpa); - connect_info->inpa = 0; + gaim_input_remove(connect_data->inpa); + connect_data->inpa = 0; } len = sizeof(error); - if (getsockopt(connect_info->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { - gaim_proxy_connect_info_disconnect(connect_info); - try_connect(connect_info); + if (getsockopt(connect_data->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { + gaim_proxy_connect_data_disconnect(connect_data); + try_connect(connect_data); return; } gaim_debug_info("proxy", "using CONNECT tunnelling for %s:%d\n", - connect_info->host, connect_info->port); + connect_data->host, connect_data->port); request_len = g_snprintf(request, sizeof(request), "CONNECT %s:%d HTTP/1.1\r\nHost: %s:%d\r\n", - connect_info->host, connect_info->port, connect_info->host, connect_info->port); + connect_data->host, connect_data->port, connect_data->host, connect_data->port); - if (gaim_proxy_info_get_username(connect_info->gpi) != NULL) { + if (gaim_proxy_info_get_username(connect_data->gpi) != NULL) { char *t1, *t2; t1 = g_strdup_printf("%s:%s", - gaim_proxy_info_get_username(connect_info->gpi), - gaim_proxy_info_get_password(connect_info->gpi) ? - gaim_proxy_info_get_password(connect_info->gpi) : ""); + gaim_proxy_info_get_username(connect_data->gpi), + gaim_proxy_info_get_password(connect_data->gpi) ? + gaim_proxy_info_get_password(connect_data->gpi) : ""); t2 = gaim_base64_encode((const guchar *)t1, strlen(t1)); g_free(t1); g_return_if_fail(request_len < sizeof(request)); @@ -775,59 +775,59 @@ "Proxy-Authorization: NTLM %s\r\n" "Proxy-Connection: Keep-Alive\r\n", t2, gaim_ntlm_gen_type1( - (gchar*)gaim_proxy_info_get_host(connect_info->gpi),"")); + (gchar*)gaim_proxy_info_get_host(connect_data->gpi),"")); g_free(t2); } g_return_if_fail(request_len < sizeof(request)); strcpy(request + request_len, "\r\n"); request_len += 2; - connect_info->write_buffer = g_memdup(request, request_len); - connect_info->write_buf_len = request_len; - connect_info->written_len = 0; + connect_data->write_buffer = g_memdup(request, request_len); + connect_data->write_buf_len = request_len; + connect_data->written_len = 0; - connect_info->read_cb = http_canread; + connect_data->read_cb = http_canread; - connect_info->inpa = gaim_input_add(connect_info->fd, GAIM_INPUT_WRITE, proxy_do_write, - connect_info); + connect_data->inpa = gaim_input_add(connect_data->fd, GAIM_INPUT_WRITE, proxy_do_write, + connect_data); - proxy_do_write(connect_info, connect_info->fd, cond); + proxy_do_write(connect_data, connect_data->fd, cond); } static int -proxy_connect_http(GaimProxyConnectInfo *connect_info, struct sockaddr *addr, socklen_t addrlen) +proxy_connect_http(GaimProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) { gaim_debug_info("http proxy", "Connecting to %s:%d via %s:%d using HTTP\n", - (connect_info->host ? connect_info->host : "(null)"), connect_info->port, - (gaim_proxy_info_get_host(connect_info->gpi) ? gaim_proxy_info_get_host(connect_info->gpi) : "(null)"), - gaim_proxy_info_get_port(connect_info->gpi)); + (connect_data->host ? connect_data->host : "(null)"), connect_data->port, + (gaim_proxy_info_get_host(connect_data->gpi) ? gaim_proxy_info_get_host(connect_data->gpi) : "(null)"), + gaim_proxy_info_get_port(connect_data->gpi)); - connect_info->fd = socket(addr->sa_family, SOCK_STREAM, 0); - if (connect_info->fd < 0) + connect_data->fd = socket(addr->sa_family, SOCK_STREAM, 0); + if (connect_data->fd < 0) return -1; - fcntl(connect_info->fd, F_SETFL, O_NONBLOCK); + fcntl(connect_data->fd, F_SETFL, O_NONBLOCK); #ifndef _WIN32 - fcntl(connect_info->fd, F_SETFD, FD_CLOEXEC); + fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); #endif - if (connect(connect_info->fd, addr, addrlen) != 0) + if (connect(connect_data->fd, addr, addrlen) != 0) { if ((errno == EINPROGRESS) || (errno == EINTR)) { gaim_debug_info("http proxy", "Connection in progress\n"); - if (connect_info->port != 80) { + if (connect_data->port != 80) { /* we need to do CONNECT first */ - connect_info->inpa = gaim_input_add(connect_info->fd, GAIM_INPUT_WRITE, - http_canwrite, connect_info); + connect_data->inpa = gaim_input_add(connect_data->fd, GAIM_INPUT_WRITE, + http_canwrite, connect_data); } else { gaim_debug_info("proxy", "HTTP proxy connection established\n"); - gaim_proxy_connect_info_connected(connect_info); + gaim_proxy_connect_data_connected(connect_data); } } else { - close(connect_info->fd); - connect_info->fd = -1; + close(connect_data->fd); + connect_data->fd = -1; return -1; } } @@ -838,51 +838,51 @@ gaim_debug_info("http proxy", "Connected immediately.\n"); len = sizeof(error); - if (getsockopt(connect_info->fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0) + if (getsockopt(connect_data->fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0) { - close(connect_info->fd); - connect_info->fd = -1; + close(connect_data->fd); + connect_data->fd = -1; return -1; } - http_canwrite(connect_info, connect_info->fd, GAIM_INPUT_WRITE); + http_canwrite(connect_data, connect_data->fd, GAIM_INPUT_WRITE); } - return connect_info->fd; + return connect_data->fd; } static void s4_canread(gpointer data, gint source, GaimInputCondition cond) { - GaimProxyConnectInfo *connect_info = data; + GaimProxyConnectData *connect_data = data; guchar *buf; int len, max_read; /* This is really not going to block under normal circumstances, but to * be correct, we deal with the unlikely scenario */ - if (connect_info->read_buffer == NULL) { - connect_info->read_buf_len = 12; - connect_info->read_buffer = g_malloc(connect_info->read_buf_len); - connect_info->read_len = 0; + if (connect_data->read_buffer == NULL) { + connect_data->read_buf_len = 12; + connect_data->read_buffer = g_malloc(connect_data->read_buf_len); + connect_data->read_len = 0; } - buf = connect_info->read_buffer + connect_info->read_len; - max_read = connect_info->read_buf_len - connect_info->read_len; + buf = connect_data->read_buffer + connect_data->read_len; + max_read = connect_data->read_buf_len - connect_data->read_len; - len = read(connect_info->fd, buf, max_read); + len = read(connect_data->fd, buf, max_read); - if ((len < 0 && errno == EAGAIN) || (len > 0 && len + connect_info->read_len < 4)) + if ((len < 0 && errno == EAGAIN) || (len > 0 && len + connect_data->read_len < 4)) return; - else if (len + connect_info->read_len >= 4) { - if (connect_info->read_buffer[1] == 90) { - gaim_proxy_connect_info_connected(connect_info); + else if (len + connect_data->read_len >= 4) { + if (connect_data->read_buffer[1] == 90) { + gaim_proxy_connect_data_connected(connect_data); return; } } - gaim_proxy_connect_info_disconnect(connect_info); - try_connect(connect_info); + gaim_proxy_connect_data_disconnect(connect_data); + try_connect(connect_data); } static void @@ -890,23 +890,23 @@ { unsigned char packet[9]; struct hostent *hp; - GaimProxyConnectInfo *connect_info = data; + GaimProxyConnectData *connect_data = data; socklen_t len; int error = ETIMEDOUT; gaim_debug_info("socks4 proxy", "Connected.\n"); - if (connect_info->inpa > 0) + if (connect_data->inpa > 0) { - gaim_input_remove(connect_info->inpa); - connect_info->inpa = 0; + gaim_input_remove(connect_data->inpa); + connect_data->inpa = 0; } len = sizeof(error); - if (getsockopt(connect_info->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { - gaim_proxy_connect_info_disconnect(connect_info); - try_connect(connect_info); + if (getsockopt(connect_data->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { + gaim_proxy_connect_data_disconnect(connect_data); + try_connect(connect_data); return; } @@ -919,60 +919,60 @@ * meantime, stick with plain old SOCKS4. */ /* TODO: This needs to be non-blocking! */ - hp = gethostbyname(connect_info->host); + hp = gethostbyname(connect_data->host); if (hp == NULL) { - gaim_proxy_connect_info_disconnect(connect_info); - try_connect(connect_info); + gaim_proxy_connect_data_disconnect(connect_data); + try_connect(connect_data); return; } packet[0] = 4; packet[1] = 1; - packet[2] = connect_info->port >> 8; - packet[3] = connect_info->port & 0xff; + packet[2] = connect_data->port >> 8; + packet[3] = connect_data->port & 0xff; packet[4] = (unsigned char)(hp->h_addr_list[0])[0]; packet[5] = (unsigned char)(hp->h_addr_list[0])[1]; packet[6] = (unsigned char)(hp->h_addr_list[0])[2]; packet[7] = (unsigned char)(hp->h_addr_list[0])[3]; packet[8] = 0; - connect_info->write_buffer = g_memdup(packet, sizeof(packet)); - connect_info->write_buf_len = sizeof(packet); - connect_info->written_len = 0; - connect_info->read_cb = s4_canread; + connect_data->write_buffer = g_memdup(packet, sizeof(packet)); + connect_data->write_buf_len = sizeof(packet); + connect_data->written_len = 0; + connect_data->read_cb = s4_canread; - connect_info->inpa = gaim_input_add(connect_info->fd, GAIM_INPUT_WRITE, proxy_do_write, connect_info); + connect_data->inpa = gaim_input_add(connect_data->fd, GAIM_INPUT_WRITE, proxy_do_write, connect_data); - proxy_do_write(connect_info, connect_info->fd, cond); + proxy_do_write(connect_data, connect_data->fd, cond); } static int -proxy_connect_socks4(GaimProxyConnectInfo *connect_info, struct sockaddr *addr, socklen_t addrlen) +proxy_connect_socks4(GaimProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) { gaim_debug_info("socks4 proxy", "Connecting to %s:%d via %s:%d using SOCKS4\n", - connect_info->host, connect_info->port, - gaim_proxy_info_get_host(connect_info->gpi), - gaim_proxy_info_get_port(connect_info->gpi)); + connect_data->host, connect_data->port, + gaim_proxy_info_get_host(connect_data->gpi), + gaim_proxy_info_get_port(connect_data->gpi)); - connect_info->fd = socket(addr->sa_family, SOCK_STREAM, 0); - if (connect_info->fd < 0) + connect_data->fd = socket(addr->sa_family, SOCK_STREAM, 0); + if (connect_data->fd < 0) return -1; - fcntl(connect_info->fd, F_SETFL, O_NONBLOCK); + fcntl(connect_data->fd, F_SETFL, O_NONBLOCK); #ifndef _WIN32 - fcntl(connect_info->fd, F_SETFD, FD_CLOEXEC); + fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); #endif - if (connect(connect_info->fd, addr, addrlen) != 0) + if (connect(connect_data->fd, addr, addrlen) != 0) { if ((errno == EINPROGRESS) || (errno == EINTR)) { gaim_debug_info("socks4 proxy", "Connection in progress.\n"); - connect_info->inpa = gaim_input_add(connect_info->fd, GAIM_INPUT_WRITE, s4_canwrite, connect_info); + connect_data->inpa = gaim_input_add(connect_data->fd, GAIM_INPUT_WRITE, s4_canwrite, connect_data); } else { - close(connect_info->fd); - connect_info->fd = -1; + close(connect_data->fd); + connect_data->fd = -1; return -1; } } else { @@ -983,49 +983,49 @@ len = sizeof(error); - if (getsockopt(connect_info->fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0) + if (getsockopt(connect_data->fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0) { - close(connect_info->fd); - connect_info->fd = -1; + close(connect_data->fd); + connect_data->fd = -1; return -1; } - s4_canwrite(connect_info, connect_info->fd, GAIM_INPUT_WRITE); + s4_canwrite(connect_data, connect_data->fd, GAIM_INPUT_WRITE); } - return connect_info->fd; + return connect_data->fd; } static void s5_canread_again(gpointer data, gint source, GaimInputCondition cond) { guchar *dest, *buf; - GaimProxyConnectInfo *connect_info = data; + GaimProxyConnectData *connect_data = data; int len; - if (connect_info->read_buffer == NULL) { - connect_info->read_buf_len = 512; - connect_info->read_buffer = g_malloc(connect_info->read_buf_len); - connect_info->read_len = 0; + if (connect_data->read_buffer == NULL) { + connect_data->read_buf_len = 512; + connect_data->read_buffer = g_malloc(connect_data->read_buf_len); + connect_data->read_len = 0; } - dest = connect_info->read_buffer + connect_info->read_len; - buf = connect_info->read_buffer; + dest = connect_data->read_buffer + connect_data->read_len; + buf = connect_data->read_buffer; gaim_debug_info("socks5 proxy", "Able to read again.\n"); - len = read(connect_info->fd, dest, (connect_info->read_buf_len - connect_info->read_len)); + len = read(connect_data->fd, dest, (connect_data->read_buf_len - connect_data->read_len)); if(len < 0 && errno == EAGAIN) return; else if(len <= 0) { gaim_debug_warning("socks5 proxy", "or not...\n"); - gaim_proxy_connect_info_disconnect(connect_info); - try_connect(connect_info); + gaim_proxy_connect_data_disconnect(connect_data); + try_connect(connect_data); return; } - connect_info->read_len += len; + connect_data->read_len += len; - if(connect_info->read_len < 4) + if(connect_data->read_len < 4) return; if ((buf[0] != 0x05) || (buf[1] != 0x00)) { @@ -1033,109 +1033,109 @@ gaim_debug_error("socks5 proxy", socks5errors[buf[1]]); else gaim_debug_error("socks5 proxy", "Bad data.\n"); - gaim_proxy_connect_info_disconnect(connect_info); - try_connect(connect_info); + gaim_proxy_connect_data_disconnect(connect_data); + try_connect(connect_data); return; } /* Skip past BND.ADDR */ switch(buf[3]) { case 0x01: /* the address is a version-4 IP address, with a length of 4 octets */ - if(connect_info->read_len < 4 + 4) + if(connect_data->read_len < 4 + 4) return; buf += 4 + 4; break; case 0x03: /* the address field contains a fully-qualified domain name. The first octet of the address field contains the number of octets of name that follow, there is no terminating NUL octet. */ - if(connect_info->read_len < 4 + 1) + if(connect_data->read_len < 4 + 1) return; buf += 4 + 1; - if(connect_info->read_len < 4 + 1 + buf[0]) + if(connect_data->read_len < 4 + 1 + buf[0]) return; buf += buf[0]; break; case 0x04: /* the address is a version-6 IP address, with a length of 16 octets */ - if(connect_info->read_len < 4 + 16) + if(connect_data->read_len < 4 + 16) return; buf += 4 + 16; break; } - if(connect_info->read_len < (buf - connect_info->read_buffer) + 2) + if(connect_data->read_len < (buf - connect_data->read_buffer) + 2) return; /* Skip past BND.PORT */ buf += 2; - gaim_proxy_connect_info_connected(connect_info); + gaim_proxy_connect_data_connected(connect_data); } static void s5_sendconnect(gpointer data, int source) { - GaimProxyConnectInfo *connect_info = data; - int hlen = strlen(connect_info->host); - connect_info->write_buf_len = 5 + hlen + 2; - connect_info->write_buffer = g_malloc(connect_info->write_buf_len); - connect_info->written_len = 0; + GaimProxyConnectData *connect_data = data; + int hlen = strlen(connect_data->host); + connect_data->write_buf_len = 5 + hlen + 2; + connect_data->write_buffer = g_malloc(connect_data->write_buf_len); + connect_data->written_len = 0; - connect_info->write_buffer[0] = 0x05; - connect_info->write_buffer[1] = 0x01; /* CONNECT */ - connect_info->write_buffer[2] = 0x00; /* reserved */ - connect_info->write_buffer[3] = 0x03; /* address type -- host name */ - connect_info->write_buffer[4] = hlen; - memcpy(connect_info->write_buffer + 5, connect_info->host, hlen); - connect_info->write_buffer[5 + hlen] = connect_info->port >> 8; - connect_info->write_buffer[5 + hlen + 1] = connect_info->port & 0xff; + connect_data->write_buffer[0] = 0x05; + connect_data->write_buffer[1] = 0x01; /* CONNECT */ + connect_data->write_buffer[2] = 0x00; /* reserved */ + connect_data->write_buffer[3] = 0x03; /* address type -- host name */ + connect_data->write_buffer[4] = hlen; + memcpy(connect_data->write_buffer + 5, connect_data->host, hlen); + connect_data->write_buffer[5 + hlen] = connect_data->port >> 8; + connect_data->write_buffer[5 + hlen + 1] = connect_data->port & 0xff; - connect_info->read_cb = s5_canread_again; + connect_data->read_cb = s5_canread_again; - connect_info->inpa = gaim_input_add(connect_info->fd, GAIM_INPUT_WRITE, proxy_do_write, connect_info); - proxy_do_write(connect_info, connect_info->fd, GAIM_INPUT_WRITE); + connect_data->inpa = gaim_input_add(connect_data->fd, GAIM_INPUT_WRITE, proxy_do_write, connect_data); + proxy_do_write(connect_data, connect_data->fd, GAIM_INPUT_WRITE); } static void s5_readauth(gpointer data, gint source, GaimInputCondition cond) { - GaimProxyConnectInfo *connect_info = data; + GaimProxyConnectData *connect_data = data; int len; - if (connect_info->read_buffer == NULL) { - connect_info->read_buf_len = 2; - connect_info->read_buffer = g_malloc(connect_info->read_buf_len); - connect_i... [truncated message content] |
From: <the...@us...> - 2006-08-21 05:07:47
|
Revision: 16943 Author: thekingant Date: 2006-08-20 22:07:42 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16943&view=rev Log Message: ----------- Get rid of this thread stuff. You can read the whole saga at http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=201791 Basically we were working around some complicated library interactions between d-bus and newer, threaded versions of gnome-vfs. But the d-bus guys were awesome enough to make our working around unnecessary I'm seeing the following error printed to the console when I click on on the Send To menu in conversation windows, but I get this error with or without these threading changes. I'm not sure what's up with that. I should point out that our dnsquery.c stuff is calling g_thread_init() for both Unix and Windows now (it didn't used to do that on Unix) The error is: GLib-GObject: gsignal.c:1713: handler `982' of instance `0xc6d960' is not blocked Modified Paths: -------------- trunk/gtk/gtkmain.c trunk/libgaim/dbus-server.c Modified: trunk/gtk/gtkmain.c =================================================================== --- trunk/gtk/gtkmain.c 2006-08-21 04:54:11 UTC (rev 16942) +++ trunk/gtk/gtkmain.c 2006-08-21 05:07:42 UTC (rev 16943) @@ -640,18 +640,6 @@ gtk_rc_add_default_file(search_path); g_free(search_path); -#if (defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE)) - /* Since threads can be yanked in all unawares by other libraries, - * and some libraries aren't smart enough to initialize the thread - * subsystem when they need it, we need to do this here. We also - * threadify dbus when that gets initialized. Ugh. */ - if (!g_thread_supported()) - g_thread_init(NULL); -#ifndef _WIN32 - gdk_threads_init(); -#endif -#endif /* Glib has threads */ - gui_check = gtk_init_check(&argc, &argv); if (!gui_check) { char *display = gdk_get_display(); Modified: trunk/libgaim/dbus-server.c =================================================================== --- trunk/libgaim/dbus-server.c 2006-08-21 04:54:11 UTC (rev 16942) +++ trunk/libgaim/dbus-server.c 2006-08-21 05:07:42 UTC (rev 16943) @@ -757,9 +757,6 @@ void gaim_dbus_init(void) { - if (g_thread_supported()) - dbus_g_thread_init(); - gaim_dbus_init_ids(); g_free(init_error); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-21 04:54:14
|
Revision: 16942 Author: thekingant Date: 2006-08-20 21:54:11 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16942&view=rev Log Message: ----------- This was warning marv Modified Paths: -------------- trunk/libgaim/protocols/yahoo/yahoo_packet.c Modified: trunk/libgaim/protocols/yahoo/yahoo_packet.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo_packet.c 2006-08-21 04:42:11 UTC (rev 16941) +++ trunk/libgaim/protocols/yahoo/yahoo_packet.c 2006-08-21 04:54:11 UTC (rev 16942) @@ -113,7 +113,8 @@ void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len) { int pos = 0; - char key[64], *delimiter; + char key[64]; + const guchar *delimiter; gboolean accept; int x; struct yahoo_pair *pair; @@ -160,7 +161,7 @@ } if (accept) { - delimiter = strstr((char *)&data[pos], "\xc0\x80"); + delimiter = (const guchar *)strstr((char *)&data[pos], "\xc0\x80"); if (delimiter == NULL) { /* Malformed packet! (it doesn't end in 0xc0 0x80) */ @@ -168,7 +169,7 @@ pos = len; continue; } - x = (guint64)delimiter - (guint64)data; + x = delimiter - data; pair->value = g_strndup((const gchar *)&data[pos], x - pos); pos = x; pkt->hash = g_slist_prepend(pkt->hash, pair); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2006-08-21 04:42:16
|
Revision: 16941 Author: marv_sf Date: 2006-08-20 21:42:11 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16941&view=rev Log Message: ----------- silence some warnings by casting several things to (char *) that are actually unsigned char *'s. Modified Paths: -------------- trunk/libgaim/protocols/yahoo/yahoo.c trunk/libgaim/protocols/yahoo/yahoo_packet.c trunk/libgaim/protocols/yahoo/yahoo_picture.c Modified: trunk/libgaim/protocols/yahoo/yahoo.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo.c 2006-08-21 04:12:07 UTC (rev 16940) +++ trunk/libgaim/protocols/yahoo/yahoo.c 2006-08-21 04:42:11 UTC (rev 16941) @@ -2382,7 +2382,7 @@ yd->rxqueue = g_realloc(yd->rxqueue, yd->rxlen + len + 1); memcpy(yd->rxqueue + yd->rxlen, buf, len); yd->rxlen += len; - i = buf = yd->rxqueue; + i = buf = (char *)yd->rxqueue; len = yd->rxlen; } buf[len] = '\0'; Modified: trunk/libgaim/protocols/yahoo/yahoo_packet.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo_packet.c 2006-08-21 04:12:07 UTC (rev 16940) +++ trunk/libgaim/protocols/yahoo/yahoo_packet.c 2006-08-21 04:42:11 UTC (rev 16941) @@ -113,7 +113,7 @@ void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len) { int pos = 0; - char key[64], *delimiter, *esc; + char key[64], *delimiter; gboolean accept; int x; struct yahoo_pair *pair; @@ -174,10 +174,13 @@ pkt->hash = g_slist_prepend(pkt->hash, pair); #ifdef DEBUG - esc = g_strescape(pair->value, NULL); - gaim_debug(GAIM_DEBUG_MISC, "yahoo", - "Key: %d \tValue: %s\n", pair->key, esc); - g_free(esc); + { + char *esc; + esc = g_strescape(pair->value, NULL); + gaim_debug(GAIM_DEBUG_MISC, "yahoo", + "Key: %d \tValue: %s\n", pair->key, esc); + g_free(esc); + } #endif } else { g_free(pair); Modified: trunk/libgaim/protocols/yahoo/yahoo_picture.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo_picture.c 2006-08-21 04:12:07 UTC (rev 16940) +++ trunk/libgaim/protocols/yahoo/yahoo_picture.c 2006-08-21 04:42:11 UTC (rev 16941) @@ -464,7 +464,7 @@ pkt_buf_len = yahoo_packet_build(pkt, 8, FALSE, &pkt_buf); yahoo_packet_free(pkt); - g_string_prepend_len(d->str, pkt_buf, pkt_buf_len); + g_string_prepend_len(d->str, (char *)pkt_buf, pkt_buf_len); g_free(pkt_buf); g_string_prepend(d->str, header); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2006-08-21 04:12:11
|
Revision: 16940 Author: marv_sf Date: 2006-08-20 21:12:07 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16940&view=rev Log Message: ----------- up the protocol version, handle the new buddy list message (which i renamed the service for again), pretend auth type 2 is auth type 1, note when a buddy is an msn buddy, and possibly even send msn buddy messages correctly. I haven't really tested if everything works with the new protocol version, but I can always lower it again if bad things start happening and I don't have time to fix them before the release. I don't know if sending messages to msn users really works or not, it seems to be down server side at the moment. Someone test when msn gets it working again :P There's no way to add msn contacts to your yahoo account from within gaim. Not sure how we'll do the UI for that. Modified Paths: -------------- trunk/libgaim/protocols/yahoo/yahoo.c trunk/libgaim/protocols/yahoo/yahoo_friend.h trunk/libgaim/protocols/yahoo/yahoo_packet.h Modified: trunk/libgaim/protocols/yahoo/yahoo.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo.c 2006-08-21 04:06:33 UTC (rev 16939) +++ trunk/libgaim/protocols/yahoo/yahoo.c 2006-08-21 04:12:07 UTC (rev 16940) @@ -469,6 +469,65 @@ } } +static void yahoo_process_list_15(GaimConnection *gc, struct yahoo_packet *pkt) +{ + GSList *l = pkt->hash; + + GaimAccount *account = gaim_connection_get_account(gc); + GHashTable *ht; + char *grp = NULL; + char *norm_bud = NULL; + + ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); + + while (l) { + struct yahoo_pair *pair = l->data; + YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ + /* But what if you had no friends? */ + GaimBuddy *b; + GaimGroup *g; + + + l = l->next; + + switch (pair->key) { + case 302: /* what is this? it's always 318 before a group, 319 before a s/n */ + case 300: /* ditto */ + break; + case 65: /* This is the group */ + g_free(grp); + grp = yahoo_string_decode(gc, pair->value, FALSE); + break; + case 7: /* buddy's s/n */ + g_free(norm_bud); + norm_bud = g_strdup(gaim_normalize(account, pair->value)); + f = yahoo_friend_find_or_new(gc, norm_bud); + if (!(b = gaim_find_buddy(account, norm_bud))) { + if (!(g = gaim_find_group(grp))) { + g = gaim_group_new(grp); + gaim_blist_add_group(g, NULL); + } + b = gaim_buddy_new(account, norm_bud, NULL); + gaim_blist_add_buddy(b, NULL, g, NULL); + } + yahoo_do_group_check(account, ht, norm_bud, grp); + + break; + case 241: /* msn user */ + if (f && *pair->value == '1') + f->msn = TRUE; + break; + /* case 242: */ /* this seems related to 241 */ + /* break; */ + } + } + + g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); + g_hash_table_destroy(ht); + g_free(grp); + g_free(norm_bud); +} + static void yahoo_process_list(GaimConnection *gc, struct yahoo_packet *pkt) { GSList *l = pkt->hash; @@ -1710,6 +1769,7 @@ yahoo_process_auth_old(gc, seed); break; case 1: + case 2: /* This case seems to work, could probably use testing */ yahoo_process_auth_new(gc, seed); break; default: @@ -2042,6 +2102,7 @@ case YAHOO_SERVICE_CHATLOGON: case YAHOO_SERVICE_CHATLOGOFF: case YAHOO_SERVICE_Y6_STATUS_UPDATE: + case YAHOO_SERVICE_STATUS_15: yahoo_process_status(gc, pkt); break; case YAHOO_SERVICE_NOTIFY: @@ -2067,6 +2128,9 @@ case YAHOO_SERVICE_LIST: yahoo_process_list(gc, pkt); break; + case YAHOO_SERVICE_LIST_15: + yahoo_process_list_15(gc, pkt); + break; case YAHOO_SERVICE_AUTH: yahoo_process_auth(gc, pkt); break; @@ -3121,10 +3185,14 @@ gboolean utf8 = TRUE; GaimWhiteboard *wb; int ret = 1; + YahooFriend *f = NULL; msg2 = yahoo_string_encode(gc, msg, &utf8); yahoo_packet_hash(pkt, "ss", 1, gaim_connection_get_display_name(gc), 5, who); + if ((f = yahoo_friend_find(gc, who)) && f->msn) + yahoo_packet_hash_str(pkt, 241, "1"); + if (utf8) yahoo_packet_hash_str(pkt, 97, "1"); yahoo_packet_hash_str(pkt, 14, msg2); Modified: trunk/libgaim/protocols/yahoo/yahoo_friend.h =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo_friend.h 2006-08-21 04:06:33 UTC (rev 16939) +++ trunk/libgaim/protocols/yahoo/yahoo_friend.h 2006-08-21 04:12:07 UTC (rev 16940) @@ -47,6 +47,7 @@ char *ip; gboolean bicon_sent_request; YahooPresenceVisibility presence; + gboolean msn; } YahooFriend; YahooFriend *yahoo_friend_find(GaimConnection *gc, const char *name); Modified: trunk/libgaim/protocols/yahoo/yahoo_packet.h =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo_packet.h 2006-08-21 04:06:33 UTC (rev 16939) +++ trunk/libgaim/protocols/yahoo/yahoo_packet.h 2006-08-21 04:12:07 UTC (rev 16940) @@ -98,7 +98,7 @@ YAHOO_SERVICE_VERIFY_ID_EXISTS = 0xc8, YAHOO_SERVICE_AUDIBLE = 0xd0, YAHOO_SERVICE_STATUS_15 = 0xf0, - YAHOO_SERVICE_BUDDYLIST_15 = 0Xf1, + YAHOO_SERVICE_LIST_15 = 0Xf1, YAHOO_SERVICE_WEBLOGIN = 0x0226, YAHOO_SERVICE_SMS_MSG = 0x02ea }; @@ -116,7 +116,7 @@ }; #define YAHOO_WEBMESSENGER_PROTO_VER 0x0065 -#define YAHOO_PROTO_VER 0x000c +#define YAHOO_PROTO_VER 0x000f #define YAHOO_PACKET_HDRLEN (4 + 2 + 2 + 2 + 2 + 4 + 4) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dat...@us...> - 2006-08-21 04:06:38
|
Revision: 16939 Author: datallah Date: 2006-08-20 21:06:33 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16939&view=rev Log Message: ----------- When a second instance of wingaim is started, bring the Buddy List into focus instead of popping up the "Already Running" message (if we can). Modified Paths: -------------- trunk/gtk/win32/gtkwin32dep.c trunk/gtk/win32/win_gaim.c Modified: trunk/gtk/win32/gtkwin32dep.c =================================================================== --- trunk/gtk/win32/gtkwin32dep.c 2006-08-21 03:40:12 UTC (rev 16938) +++ trunk/gtk/win32/gtkwin32dep.c 2006-08-21 04:06:33 UTC (rev 16939) @@ -53,6 +53,7 @@ */ HINSTANCE gaimexe_hInstance = 0; HINSTANCE gtkgaimdll_hInstance = 0; +HWND messagewin_hwnd; /* * PUBLIC CODE @@ -70,19 +71,19 @@ if((fin = gzopen(in, "rb"))) { if(!(fout = g_fopen(out, "wb"))) { - gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "Error opening file: %s\n", out); + gaim_debug_error("gtkwgaim_gz_decompress", "Error opening file: %s\n", out); gzclose(fin); return 0; } } else { - gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "gzopen failed to open: %s\n", in); + gaim_debug_error("gtkwgaim_gz_decompress", "gzopen failed to open: %s\n", in); return 0; } while((ret = gzread(fin, buf, 1024))) { if(fwrite(buf, 1, ret, fout) < ret) { - gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "Error writing %d bytes to file\n", ret); + gaim_debug_error("wgaim_gz_decompress", "Error writing %d bytes to file\n", ret); gzclose(fin); fclose(fout); return 0; @@ -92,7 +93,7 @@ gzclose(fin); if(ret < 0) { - gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "gzread failed while reading: %s\n", in); + gaim_debug_error("gtkwgaim_gz_decompress", "gzread failed while reading: %s\n", in); return 0; } @@ -109,14 +110,14 @@ if(untar(tmpfile, destdir, UNTAR_FORCE | UNTAR_QUIET)) ret = 1; else { - gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_untar", "Failure untaring %s\n", tmpfile); + gaim_debug_error("gtkwgaim_gz_untar", "Failure untaring %s\n", tmpfile); ret = 0; } g_unlink(tmpfile); return ret; } else { - gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_untar", "Failed to gz decompress %s\n", filename); + gaim_debug_error("gtkwgaim_gz_untar", "Failed to gz decompress %s\n", filename); return 0; } } @@ -141,9 +142,8 @@ wsinfo.nShow = SW_SHOWNORMAL; wsinfo.lpClass = L"http"; - gaim_debug(GAIM_DEBUG_INFO, "wgaim_notify_uri", "The wide uri is %s\n", uri); if(!ShellExecuteExW(&wsinfo)) - gaim_debug_error("wgaim", "Error opening URI: %s error: %d\n", + gaim_debug_error("gtkwgaim", "Error opening URI: %s error: %d\n", uri, (int) wsinfo.hInstApp); g_free(w_uri); @@ -162,13 +162,60 @@ sinfo.lpClass = "http"; if(!ShellExecuteExA(&sinfo)) - gaim_debug_error("wgaim", "Error opening URI: %s error: %d\n", + gaim_debug_error("gtkwgaim", "Error opening URI: %s error: %d\n", uri, (int) sinfo.hInstApp); g_free(locale_uri); } } +#define WM_FOCUS_REQUEST (WM_APP + 13) + +static LRESULT CALLBACK message_window_handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { + + if (msg == WM_FOCUS_REQUEST) { + gaim_debug_info("gtkwgaim", "Got external Buddy List focus request."); + gaim_blist_set_visible(TRUE); + return TRUE; + } + + return DefWindowProc(hwnd, msg, wparam, lparam); +} + +static HWND wgaim_message_window_init(void) { + HWND win_hwnd; + WNDCLASSEX wcx; + LPCTSTR wname; + + wname = TEXT("WingaimMsgWinCls"); + + wcx.cbSize = sizeof(wcx); + wcx.style = 0; + wcx.lpfnWndProc = message_window_handler; + wcx.cbClsExtra = 0; + wcx.cbWndExtra = 0; + wcx.hInstance = gtkwgaim_hinstance(); + wcx.hIcon = NULL; + wcx.hCursor = NULL; + wcx.hbrBackground = NULL; + wcx.lpszMenuName = NULL; + wcx.lpszClassName = wname; + wcx.hIconSm = NULL; + + RegisterClassEx(&wcx); + + /* Create the window */ + if(!(win_hwnd = CreateWindow(wname, TEXT("WingaimMsgWin"), 0, 0, 0, 0, 0, + NULL, NULL, gtkwgaim_hinstance(), 0))) { + gaim_debug_error("gtkwgaim", + "Unable to create message window.\n"); + return NULL; + } + + return win_hwnd; +} + + void gtkwgaim_init(HINSTANCE hint) { gaim_debug_info("gtkwgaim", "gtkwgaim_init start\n"); @@ -176,20 +223,25 @@ /* IdleTracker Initialization */ if(!wgaim_set_idlehooks()) - gaim_debug(GAIM_DEBUG_ERROR, "gtkwgaim", "Failed to initialize idle tracker\n"); + gaim_debug_error("gtkwgaim", "Failed to initialize idle tracker\n"); wgaim_gtkspell_init(); gaim_debug_info("gtkwgaim", "GTK+ :%u.%u.%u\n", gtk_major_version, gtk_minor_version, gtk_micro_version); - gaim_debug(GAIM_DEBUG_INFO, "gtkwgaim", "gtkwgaim_init end\n"); + messagewin_hwnd = wgaim_message_window_init(); + + gaim_debug_info("gtkwgaim", "gtkwgaim_init end\n"); } /* Windows Cleanup */ void gtkwgaim_cleanup(void) { - gaim_debug(GAIM_DEBUG_INFO, "gtkwgaim", "gtkwgaim_cleanup\n"); + gaim_debug_info("gtkwgaim", "gtkwgaim_cleanup\n"); + if(messagewin_hwnd) + DestroyWindow(messagewin_hwnd); + /* Idle tracker cleanup */ wgaim_remove_idlehooks(); Modified: trunk/gtk/win32/win_gaim.c =================================================================== --- trunk/gtk/win32/win_gaim.c 2006-08-21 03:40:12 UTC (rev 16938) +++ trunk/gtk/win32/win_gaim.c 2006-08-21 04:06:33 UTC (rev 16939) @@ -409,14 +409,25 @@ putenv(envstr); } +#define WM_FOCUS_REQUEST (WM_APP + 13) + static BOOL wgaim_set_running() { HANDLE h; if ((h = CreateMutex(NULL, FALSE, "gaim_is_running"))) { if (GetLastError() == ERROR_ALREADY_EXISTS) { + HWND msg_win; + + if((msg_win = FindWindow(TEXT("WingaimMsgWinCls"), NULL))) + if(SendMessage(msg_win, WM_FOCUS_REQUEST, (WPARAM) NULL, (LPARAM) NULL)) + return FALSE; + + /* If we get here, the focus request wasn't successful */ + MessageBox(NULL, "An instance of Gaim is already running", NULL, MB_OK | MB_TOPMOST); + return FALSE; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-21 03:40:19
|
Revision: 16938 Author: sadrul Date: 2006-08-20 20:40:12 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16938&view=rev Log Message: ----------- Mostly minor cleanups Modified Paths: -------------- trunk/console/gntconv.c trunk/console/gntgaim.c trunk/console/libgnt/gntcolors.c trunk/console/libgnt/gntentry.c trunk/console/libgnt/gntmain.c Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-21 03:19:16 UTC (rev 16937) +++ trunk/console/gntconv.c 2006-08-21 03:40:12 UTC (rev 16938) @@ -360,7 +360,7 @@ static void gg_chat_rename_user(GaimConversation *conv, const char *old, const char *new_n, const char *new_a) { - /* XXX: Update the name for string completion */ + /* Update the name for string completion */ GGConv *ggc = conv->ui_data; GntEntry *entry = GNT_ENTRY(ggc->entry); gnt_entry_remove_suggest(entry, old); @@ -371,7 +371,7 @@ static void gg_chat_remove_user(GaimConversation *conv, GList *list) { - /* XXX: Remove the name from string completion */ + /* Remove the name from string completion */ GGConv *ggc = conv->ui_data; GntEntry *entry = GNT_ENTRY(ggc->entry); for (; list; list = list->next) Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-08-21 03:19:16 UTC (rev 16937) +++ trunk/console/gntgaim.c 2006-08-21 03:40:12 UTC (rev 16938) @@ -249,11 +249,7 @@ gaim_plugins_add_search_path(path); g_free(path); -#ifdef LIBDIR gaim_plugins_add_search_path(LIBDIR); -#else - gaim_plugins_add_search_path("/usr/local/lib/gaim"); /* XXX: Remove this after the restructure */ -#endif if (!gaim_core_init(GAIM_GNT_UI)) { Modified: trunk/console/libgnt/gntcolors.c =================================================================== --- trunk/console/libgnt/gntcolors.c 2006-08-21 03:19:16 UTC (rev 16937) +++ trunk/console/libgnt/gntcolors.c 2006-08-21 03:40:12 UTC (rev 16938) @@ -40,7 +40,7 @@ { backup_colors(); - /* XXX: Do some init_color()s */ + /* Do some init_color()s */ init_color(GNT_COLOR_BLACK, 0, 0, 0); init_color(GNT_COLOR_RED, 1000, 0, 0); init_color(GNT_COLOR_GREEN, 0, 1000, 0); @@ -115,8 +115,9 @@ if (error) { - /* XXX: some error happened. */ + g_printerr("GntColors: %s\n", error->message); g_error_free(error); + error = NULL; } else { @@ -156,7 +157,7 @@ if (error) { - /* XXX: some error happened. */ + g_printerr("GntColors: %s\n", error->message); g_error_free(error); return; } Modified: trunk/console/libgnt/gntentry.c =================================================================== --- trunk/console/libgnt/gntentry.c 2006-08-21 03:19:16 UTC (rev 16937) +++ trunk/console/libgnt/gntentry.c 2006-08-21 03:40:12 UTC (rev 16938) @@ -304,7 +304,6 @@ return TRUE; } } - /* XXX: handle other keys, like home/end, and ctrl+ goodness */ else if (text[1] == 0) { destroy_suggest(entry); Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-08-21 03:19:16 UTC (rev 16937) +++ trunk/console/libgnt/gntmain.c 2006-08-21 03:40:12 UTC (rev 16938) @@ -1,4 +1,4 @@ -#include <panel.h> +#include <ncursesw/panel.h> #include "gnt.h" #include "gntbox.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2006-08-21 03:19:25
|
Revision: 16937 Author: marv_sf Date: 2006-08-20 20:19:16 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16937&view=rev Log Message: ----------- I think I was wrong about the purpose of the last packet. Oops. There's actually two packets for this purpose still. Modified Paths: -------------- trunk/libgaim/protocols/yahoo/yahoo_packet.h Modified: trunk/libgaim/protocols/yahoo/yahoo_packet.h =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo_packet.h 2006-08-21 03:13:08 UTC (rev 16936) +++ trunk/libgaim/protocols/yahoo/yahoo_packet.h 2006-08-21 03:19:16 UTC (rev 16937) @@ -97,7 +97,8 @@ YAHOO_SERVICE_AVATAR_UPDATE = 0xc7, YAHOO_SERVICE_VERIFY_ID_EXISTS = 0xc8, YAHOO_SERVICE_AUDIBLE = 0xd0, - YAHOO_SERVICE_LIST_AND_STATUS = 0xf0, + YAHOO_SERVICE_STATUS_15 = 0xf0, + YAHOO_SERVICE_BUDDYLIST_15 = 0Xf1, YAHOO_SERVICE_WEBLOGIN = 0x0226, YAHOO_SERVICE_SMS_MSG = 0x02ea }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-21 03:13:23
|
Revision: 16936 Author: sadrul Date: 2006-08-20 20:13:08 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16936&view=rev Log Message: ----------- Cleaning up after myself: free data *after* using it. And if gstreamer fails, and the user switches to a different method, sound should stil work. Modified Paths: -------------- trunk/gtk/gtksound.c trunk/gtk/gtkstatusbox.c Modified: trunk/gtk/gtksound.c =================================================================== --- trunk/gtk/gtksound.c 2006-08-21 03:04:12 UTC (rev 16935) +++ trunk/gtk/gtksound.c 2006-08-21 03:13:08 UTC (rev 16936) @@ -314,7 +314,6 @@ g_error_free(error); error = NULL; } - return; } #endif /* USE_GSTREAMER */ Modified: trunk/gtk/gtkstatusbox.c =================================================================== --- trunk/gtk/gtkstatusbox.c 2006-08-21 03:04:12 UTC (rev 16935) +++ trunk/gtk/gtkstatusbox.c 2006-08-21 03:13:08 UTC (rev 16936) @@ -1055,9 +1055,9 @@ if (prplinfo && prplinfo->icon_spec.format) { char *icon = gaim_gtk_convert_buddy_icon(plug, filename); gaim_account_set_buddy_icon(box->account, icon); - g_free(icon); gaim_account_set_ui_bool(box->account, GAIM_GTK_UI, "use-global-buddyicon", FALSE); gaim_account_set_ui_string(box->account, GAIM_GTK_UI, "non-global-buddyicon", icon); + g_free(icon); } } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-21 03:04:17
|
Revision: 16935 Author: sadrul Date: 2006-08-20 20:04:12 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16935&view=rev Log Message: ----------- If gstreamer fails, show an error message and continue to load. Modified Paths: -------------- trunk/gtk/gtksound.c Modified: trunk/gtk/gtksound.c =================================================================== --- trunk/gtk/gtksound.c 2006-08-21 02:55:56 UTC (rev 16934) +++ trunk/gtk/gtksound.c 2006-08-21 03:04:12 UTC (rev 16935) @@ -55,6 +55,10 @@ static guint mute_login_sounds_timeout = 0; static gboolean mute_login_sounds = FALSE; +#ifdef USE_GSTREAMER +static gboolean gst_init_failed; +#endif /* USE_GSTREAMER */ + static struct gaim_sound_event sounds[GAIM_NUM_SOUNDS] = { {N_("Buddy logs in"), "login", "login.wav"}, {N_("Buddy logs out"), "logout", "logout.wav"}, @@ -261,6 +265,9 @@ void *gtk_sound_handle = gaim_gtk_sound_get_handle(); void *blist_handle = gaim_blist_get_handle(); void *conv_handle = gaim_conversations_get_handle(); +#ifdef USE_GSTREAMER + GError *error = NULL; +#endif gaim_signal_connect(gaim_connections_get_handle(), "signed-on", gtk_sound_handle, GAIM_CALLBACK(account_signon_cb), @@ -299,7 +306,16 @@ #ifdef USE_GSTREAMER gaim_debug_info("sound", "Initializing sound output drivers.\n"); - gst_init(NULL, NULL); + if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) { + gaim_notify_error(NULL, _("GStreamer Failure"), + _("GStreamer failed to initialize."), + error ? error->message : ""); + if (error) { + g_error_free(error); + error = NULL; + } + return; + } #endif /* USE_GSTREAMER */ gaim_signal_connect(blist_handle, "buddy-signed-on", @@ -332,7 +348,8 @@ gaim_gtk_sound_uninit(void) { #ifdef USE_GSTREAMER - gst_deinit(); + if (!gst_init_failed) + gst_deinit(); #endif gaim_signals_disconnect_by_handle(gaim_gtk_sound_get_handle()); @@ -428,6 +445,8 @@ return; } #ifdef USE_GSTREAMER + if (gst_init_failed) /* Perhaps do gdk_beep instead? */ + return; volume = (float)(CLAMP(gaim_prefs_get_int("/gaim/gtk/sound/volume"),0,100)) / 50; if (!strcmp(method, "automatic")) { if (gaim_running_gnome()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2006-08-21 02:56:01
|
Revision: 16934 Author: marv_sf Date: 2006-08-20 19:55:56 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16934&view=rev Log Message: ----------- new packet type, looks to be a combination of "this dude is on the buddy list" and "this dude is online" Modified Paths: -------------- trunk/libgaim/protocols/yahoo/yahoo_packet.h Modified: trunk/libgaim/protocols/yahoo/yahoo_packet.h =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo_packet.h 2006-08-21 02:49:42 UTC (rev 16933) +++ trunk/libgaim/protocols/yahoo/yahoo_packet.h 2006-08-21 02:55:56 UTC (rev 16934) @@ -97,6 +97,7 @@ YAHOO_SERVICE_AVATAR_UPDATE = 0xc7, YAHOO_SERVICE_VERIFY_ID_EXISTS = 0xc8, YAHOO_SERVICE_AUDIBLE = 0xd0, + YAHOO_SERVICE_LIST_AND_STATUS = 0xf0, YAHOO_SERVICE_WEBLOGIN = 0x0226, YAHOO_SERVICE_SMS_MSG = 0x02ea }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-21 02:49:45
|
Revision: 16933 Author: thekingant Date: 2006-08-20 19:49:42 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16933&view=rev Log Message: ----------- Don't do icon stuff if the protocol doesn't support icons. Most of this is indentation changes. Modified Paths: -------------- trunk/gtk/gtkaccount.c Modified: trunk/gtk/gtkaccount.c =================================================================== --- trunk/gtk/gtkaccount.c 2006-08-21 02:42:14 UTC (rev 16932) +++ trunk/gtk/gtkaccount.c 2006-08-21 02:49:42 UTC (rev 16933) @@ -1095,6 +1095,7 @@ char *tmp; gboolean new = FALSE, icon_change = FALSE; GaimAccount *account; + GaimPluginProtocolInfo *prpl_info; if (dialog->account == NULL) { @@ -1121,21 +1122,29 @@ gaim_account_set_alias(account, NULL); /* Buddy Icon */ - if (new || gaim_account_get_ui_bool(account, GAIM_GTK_UI, "use-global-buddyicon", TRUE) == - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check))) { - icon_change = TRUE; + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin); + if ((prpl_info != NULL) && (prpl_info->options & OPT_PROTO_IM_IMAGE)) + { + if (new || gaim_account_get_ui_bool(account, GAIM_GTK_UI, "use-global-buddyicon", TRUE) == + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check))) + { + icon_change = TRUE; + } + gaim_account_set_ui_bool(account, GAIM_GTK_UI, "use-global-buddyicon", !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check))); + gaim_account_set_ui_string(account, GAIM_GTK_UI, "non-global-buddyicon", dialog->icon_path); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check))) + { + gaim_account_set_buddy_icon(account, dialog->icon_path); + } + else if (gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon") && icon_change) + { + char *icon = gaim_gtk_convert_buddy_icon(dialog->plugin, gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon")); + gaim_account_set_buddy_icon(account, icon); + g_free(icon); + } } - gaim_account_set_ui_bool(account, GAIM_GTK_UI, "use-global-buddyicon", !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check))); - gaim_account_set_ui_string(account, GAIM_GTK_UI, "non-global-buddyicon", dialog->icon_path); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check))) { - gaim_account_set_buddy_icon(account, dialog->icon_path); - } else if (gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon") && icon_change) { - char *icon = gaim_gtk_convert_buddy_icon(dialog->plugin, gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon")); - gaim_account_set_buddy_icon(account, icon); - g_free(icon); - } - + /* Remember Password */ gaim_account_set_remember_password(account, gtk_toggle_button_get_active( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-21 02:42:20
|
Revision: 16932 Author: thekingant Date: 2006-08-20 19:42:14 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16932&view=rev Log Message: ----------- More sslconn improvements Modified Paths: -------------- trunk/libgaim/protocols/jabber/jabber.c trunk/libgaim/protocols/novell/novell.c trunk/libgaim/sslconn.h Modified: trunk/libgaim/protocols/jabber/jabber.c =================================================================== --- trunk/libgaim/protocols/jabber/jabber.c 2006-08-21 02:21:51 UTC (rev 16931) +++ trunk/libgaim/protocols/jabber/jabber.c 2006-08-21 02:42:14 UTC (rev 16932) @@ -407,13 +407,6 @@ GaimConnection *gc = data; JabberStream *js = gc->proto_data; - if(!g_list_find(gaim_connections_get_all(), gc)) { - gaim_ssl_close(gsc); - return; - } - - js->gsc = gsc; - if(js->state == JABBER_STREAM_CONNECTING) jabber_send_raw(js, "<?xml version='1.0' ?>", -1); jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); @@ -450,6 +443,8 @@ GaimConnection *gc = data; JabberStream *js = gc->proto_data; + js->gsc = NULL; + switch(error) { case GAIM_SSL_CONNECT_FAILED: gaim_connection_error(gc, _("Connection Failed")); @@ -458,8 +453,6 @@ gaim_connection_error(gc, _("SSL Handshake Failed")); break; } - - js->gsc = NULL; } static void tls_init(JabberStream *js) Modified: trunk/libgaim/protocols/novell/novell.c =================================================================== --- trunk/libgaim/protocols/novell/novell.c 2006-08-21 02:21:51 UTC (rev 16931) +++ trunk/libgaim/protocols/novell/novell.c 2006-08-21 02:42:14 UTC (rev 16932) @@ -1663,8 +1663,14 @@ novell_ssl_connect_error(GaimSslConnection * gsc, GaimSslErrorType error, gpointer data) { - gaim_connection_error((GaimConnection *)data, - _("Unable to make SSL connection to server.")); + GaimConnection *gc; + NMUser *user; + + gc = data; + user = gc->proto_data; + user->conn->ssl_conn->data = NULL; + + gaim_connection_error(gc, _("Unable to make SSL connection to server.")); } static void @@ -1717,7 +1723,6 @@ return; conn->ssl_conn = g_new0(NMSSLConn, 1); - conn->ssl_conn->data = gsc; conn->ssl_conn->read = (nm_ssl_read_cb) gaim_ssl_read; conn->ssl_conn->write = (nm_ssl_write_cb) gaim_ssl_write; @@ -2182,9 +2187,10 @@ 1, NOVELL_CONNECT_STEPS); user->conn->use_ssl = TRUE; - if (gaim_ssl_connect(user->client_data, user->conn->addr, - user->conn->port, novell_ssl_connected_cb, - novell_ssl_connect_error, gc) == NULL) { + user->conn->ssl_conn->data = gaim_ssl_connect(user->client_data, + user->conn->addr, user->conn->port, + novell_ssl_connected_cb, novell_ssl_connect_error, gc); + if (user->conn->ssl_conn->data == NULL) { gaim_connection_error(gc, _("Error." " SSL support is not installed.")); } Modified: trunk/libgaim/sslconn.h =================================================================== --- trunk/libgaim/sslconn.h 2006-08-21 02:21:51 UTC (rev 16931) +++ trunk/libgaim/sslconn.h 2006-08-21 02:42:14 UTC (rev 16932) @@ -92,13 +92,18 @@ gboolean gaim_ssl_is_supported(void); /** - * Makes a SSL connection to the specified host and port. + * Makes a SSL connection to the specified host and port. The caller + * should keep track of the returned value and use it to cancel the + * connection, if needed. * * @param account The account making the connection. * @param host The destination host. * @param port The destination port. * @param func The SSL input handler function. - * @param error_func The SSL error handler function. + * @param error_func The SSL error handler function. This function + * should NOT call gaim_ssl_close(). In the event + * of an error the GaimSslConnection will be + * destroyed for you. * @param data User-defined data. * * @return The SSL connection handle. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-21 02:21:55
|
Revision: 16931 Author: thekingant Date: 2006-08-20 19:21:51 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16931&view=rev Log Message: ----------- I was wrong when I said PRPLs wouldn't need to be changed to handle cancelable ssl connections. This makes MSN not crash when canceling half-way through sign on. Try it, I dare you. Modified Paths: -------------- trunk/libgaim/protocols/msn/nexus.c Modified: trunk/libgaim/protocols/msn/nexus.c =================================================================== --- trunk/libgaim/protocols/msn/nexus.c 2006-08-21 02:05:55 UTC (rev 16930) +++ trunk/libgaim/protocols/msn/nexus.c 2006-08-21 02:21:51 UTC (rev 16931) @@ -45,6 +45,9 @@ void msn_nexus_destroy(MsnNexus *nexus) { + if (nexus->gsc) + gaim_ssl_close(nexus->gsc); + g_free(nexus->login_host); g_free(nexus->login_path); @@ -99,7 +102,7 @@ return; else if (len <= 0) { gaim_input_remove(nexus->input_handler); - nexus->input_handler = -1; + nexus->input_handler = 0; /* TODO: notify of the error */ return; } @@ -109,7 +112,7 @@ return; gaim_input_remove(nexus->input_handler); - nexus->input_handler = -1; + nexus->input_handler = 0; g_free(nexus->write_buf); nexus->write_buf = NULL; @@ -135,6 +138,8 @@ nexus = data; g_return_if_fail(nexus != NULL); + nexus->gsc = NULL; + session = nexus->session; g_return_if_fail(session != NULL); @@ -153,7 +158,8 @@ session = nexus->session; g_return_if_fail(session != NULL); - if (nexus->input_handler == -1) + if (nexus->input_handler == 0) + //TODO: Use gaim_ssl_input_add()? nexus->input_handler = gaim_input_add(nexus->gsc->fd, GAIM_INPUT_READ, nexus_login_written_cb, nexus); @@ -164,7 +170,7 @@ return; else if (len < 0) { gaim_input_remove(nexus->input_handler); - nexus->input_handler = -1; + nexus->input_handler = 0; g_free(nexus->read_buf); nexus->read_buf = NULL; nexus->read_len = 0; @@ -177,7 +183,7 @@ return; gaim_input_remove(nexus->input_handler); - nexus->input_handler = -1; + nexus->input_handler = 0; gaim_ssl_close(nexus->gsc); nexus->gsc = NULL; @@ -218,9 +224,9 @@ g_free(nexus->login_host); nexus->login_host = g_strdup(location); - gaim_ssl_connect(session->account, nexus->login_host, - GAIM_SSL_DEFAULT_PORT, login_connect_cb, - login_error_cb, nexus); + nexus->gsc = gaim_ssl_connect(session->account, + nexus->login_host, GAIM_SSL_DEFAULT_PORT, + login_connect_cb, login_error_cb, nexus); } else if (strstr(nexus->read_buf, "HTTP/1.1 401 Unauthorized") != NULL) { @@ -320,8 +326,6 @@ session = nexus->session; g_return_if_fail(session != NULL); - nexus->gsc = gsc; - msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); username = @@ -393,7 +397,8 @@ char *da_login; char *base, *c; - if (nexus->input_handler == -1) + if (nexus->input_handler == 0) + //TODO: Use gaim_ssl_input_add()? nexus->input_handler = gaim_input_add(nexus->gsc->fd, GAIM_INPUT_READ, nexus_connect_written_cb, nexus); @@ -404,7 +409,7 @@ return; else if (len < 0) { gaim_input_remove(nexus->input_handler); - nexus->input_handler = -1; + nexus->input_handler = 0; g_free(nexus->read_buf); nexus->read_buf = NULL; nexus->read_len = 0; @@ -417,7 +422,7 @@ return; gaim_input_remove(nexus->input_handler); - nexus->input_handler = -1; + nexus->input_handler = 0; base = strstr(nexus->read_buf, "PassportURLs"); @@ -451,12 +456,11 @@ nexus->read_len = 0; gaim_ssl_close(nexus->gsc); - nexus->gsc = NULL; /* Now begin the connection to the login server. */ - gaim_ssl_connect(nexus->session->account, nexus->login_host, - GAIM_SSL_DEFAULT_PORT, login_connect_cb, login_error_cb, - nexus); + nexus->gsc = gaim_ssl_connect(nexus->session->account, + nexus->login_host, GAIM_SSL_DEFAULT_PORT, + login_connect_cb, login_error_cb, nexus); } @@ -477,8 +481,6 @@ session = nexus->session; g_return_if_fail(session != NULL); - nexus->gsc = gsc; - msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH); nexus->write_buf = g_strdup("GET /rdr/pprdr.asp\r\n\r\n"); @@ -497,7 +499,7 @@ void msn_nexus_connect(MsnNexus *nexus) { - gaim_ssl_connect(nexus->session->account, "nexus.passport.com", - GAIM_SSL_DEFAULT_PORT, nexus_connect_cb, - login_error_cb, nexus); + nexus->gsc = gaim_ssl_connect(nexus->session->account, + "nexus.passport.com", GAIM_SSL_DEFAULT_PORT, + nexus_connect_cb, login_error_cb, nexus); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-21 02:05:57
|
Revision: 16930 Author: thekingant Date: 2006-08-20 19:05:55 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16930&view=rev Log Message: ----------- And this needs to be done before calling gaim_connection_error(). The IRC PPRL should only free the sslconn if the connection is canceled half-way through, or if the connection has completed and the user signs offline. If the connection fails normally then sslconn.c is responsible for destroying the sslconn. Modified Paths: -------------- trunk/libgaim/protocols/irc/irc.c Modified: trunk/libgaim/protocols/irc/irc.c =================================================================== --- trunk/libgaim/protocols/irc/irc.c 2006-08-21 02:01:38 UTC (rev 16929) +++ trunk/libgaim/protocols/irc/irc.c 2006-08-21 02:05:55 UTC (rev 16930) @@ -411,6 +411,8 @@ GaimConnection *gc = data; struct irc_conn *irc = gc->proto_data; + irc->gsc = NULL; + switch(error) { case GAIM_SSL_CONNECT_FAILED: gaim_connection_error(gc, _("Connection Failed")); @@ -419,8 +421,6 @@ gaim_connection_error(gc, _("SSL Handshake Failed")); break; } - - irc->gsc = NULL; } static void irc_close(GaimConnection *gc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-21 02:01:45
|
Revision: 16929 Author: thekingant Date: 2006-08-20 19:01:38 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16929&view=rev Log Message: ----------- This stuff should no longer be necessary Modified Paths: -------------- trunk/libgaim/protocols/irc/irc.c Modified: trunk/libgaim/protocols/irc/irc.c =================================================================== --- trunk/libgaim/protocols/irc/irc.c 2006-08-21 01:47:51 UTC (rev 16928) +++ trunk/libgaim/protocols/irc/irc.c 2006-08-21 02:01:38 UTC (rev 16929) @@ -379,15 +379,7 @@ GaimInputCondition cond) { GaimConnection *gc = data; - struct irc_conn *irc = gc->proto_data; - if(!g_list_find(gaim_connections_get_all(), gc)) { - gaim_ssl_close(gsc); - return; - } - - irc->gsc = gsc; - if (do_login(gc)) { gaim_ssl_input_add(gsc, irc_input_cb_ssl, gc); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-21 01:47:54
|
Revision: 16928 Author: sadrul Date: 2006-08-20 18:47:51 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16928&view=rev Log Message: ----------- update the manual. Modified Paths: -------------- trunk/doc/gntgaim.1.in Modified: trunk/doc/gntgaim.1.in =================================================================== --- trunk/doc/gntgaim.1.in 2006-08-21 01:44:07 UTC (rev 16927) +++ trunk/doc/gntgaim.1.in 2006-08-21 01:47:51 UTC (rev 16928) @@ -93,6 +93,9 @@ .B Alt \+ , Move the position of the current window in the window list one place to the left. +.TP +.B Alt \+ l +Refresh the windows. This is useful after resizing the terminal window. .SH FILES \fI~/.gntrc\fR: configuration file for gnt applications. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-21 01:44:15
|
Revision: 16927 Author: sadrul Date: 2006-08-20 18:44:07 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16927&view=rev Log Message: ----------- Press alt+l to refresh the screen, useful if you resize the terminal. Modified Paths: -------------- trunk/console/libgnt/gntmain.c Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-08-21 01:00:31 UTC (rev 16926) +++ trunk/console/libgnt/gntmain.c 2006-08-21 01:44:07 UTC (rev 16927) @@ -57,7 +57,7 @@ static GHashTable *nodes; static void free_node(gpointer data); -static void draw_taskbar(); +static void draw_taskbar(gboolean reposition); static void bring_on_top(GntWidget *widget); static gboolean @@ -88,7 +88,7 @@ gnt_widget_set_focus(widget, TRUE); if (w) gnt_widget_set_focus(w, FALSE); - draw_taskbar(); + draw_taskbar(FALSE); } void gnt_screen_remove_widget(GntWidget *widget) @@ -112,7 +112,7 @@ { bring_on_top(focus_list->data); } - draw_taskbar(); + draw_taskbar(FALSE); } static void @@ -136,7 +136,7 @@ top_panel(nd->panel); } update_screen(NULL); - draw_taskbar(); + draw_taskbar(FALSE); } static void @@ -156,7 +156,7 @@ } static void -draw_taskbar() +draw_taskbar(gboolean reposition) { static WINDOW *taskbar = NULL; GList *iter; @@ -167,6 +167,10 @@ { taskbar = newwin(1, getmaxx(stdscr), getmaxy(stdscr) - 1, 0); } + else if (reposition) + { + mvwin(taskbar, Y_MAX, 0); + } wbkgdset(taskbar, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); werase(taskbar); @@ -343,7 +347,7 @@ all = g_list_delete_link(all, list); if (focus_list == list) focus_list = g_list_find(all, widget); - draw_taskbar(); + draw_taskbar(FALSE); } static void @@ -452,6 +456,27 @@ fclose(file); } +static void +refresh_node(GntWidget *widget, GntNode *node, gpointer null) +{ + int x, y, w, h; + int nw, nh; + + gnt_widget_get_position(widget, &x, &y); + gnt_widget_get_size(widget, &w, &h); + + if (x + w >= X_MAX) + x = MAX(0, X_MAX - w); + if (y + h >= Y_MAX) + y = MAX(0, Y_MAX - h); + gnt_screen_move_widget(widget, x, y); + + nw = MIN(w, X_MAX); + nh = MIN(h, Y_MAX); + if (nw != w || nh != h) + gnt_screen_resize_widget(widget, nw, nh); +} + static gboolean io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) { @@ -547,11 +572,17 @@ } else if (strcmp(buffer + 1, "l") == 0) { - touchwin(stdscr); - touchwin(newscr); - wrefresh(newscr); update_screen(NULL); - draw_taskbar(); + werase(stdscr); + wrefresh(stdscr); + + X_MAX = getmaxx(stdscr); + Y_MAX = getmaxy(stdscr) - 1; + + g_hash_table_foreach(nodes, (GHFunc)refresh_node, NULL); + + update_screen(NULL); + draw_taskbar(TRUE); } else if (strlen(buffer) == 2 && isdigit(*(buffer + 1))) { @@ -882,7 +913,7 @@ return; GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_URGENT); - draw_taskbar(); + draw_taskbar(FALSE); } void gnt_quit() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-21 01:00:39
|
Revision: 16926 Author: thekingant Date: 2006-08-20 18:00:31 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16926&view=rev Log Message: ----------- Get rid of the child-process DNS lookup method and use threads everywhere 1 file changed, 13 insertions(+), 611 deletions(-) Modified Paths: -------------- trunk/libgaim/dnsquery.c Modified: trunk/libgaim/dnsquery.c =================================================================== --- trunk/libgaim/dnsquery.c 2006-08-21 00:23:12 UTC (rev 16925) +++ trunk/libgaim/dnsquery.c 2006-08-21 01:00:31 UTC (rev 16926) @@ -44,46 +44,15 @@ gpointer data; guint timeout; -#if defined(__unix__) || defined(__APPLE__) - GaimDnsQueryResolverProcess *resolver; -#elif defined _WIN32 /* end __unix__ || __APPLE__ */ GThread *resolver; GSList *hosts; gchar *error_message; -#endif }; -#if defined(__unix__) || defined(__APPLE__) - -#define MAX_DNS_CHILDREN 4 - -/* - * This structure keeps a reference to a child resolver process. - */ -struct _GaimDnsQueryResolverProcess { - guint inpa; - int fd_in, fd_out; - pid_t dns_pid; -}; - -static GSList *free_dns_children = NULL; -static GQueue *queued_requests = NULL; - -static int number_of_dns_children = 0; - -/* - * This is a convenience struct used to pass data to - * the child resolver process. - */ -typedef struct { - char hostname[512]; - int port; -} dns_params_t; -#endif - static void gaim_dnsquery_resolved(GaimDnsQueryData *query_data, GSList *hosts) { + gaim_debug_info("dnsquery", "IP resolved for %s\n", query_data->hostname); if (query_data->callback != NULL) query_data->callback(hosts, query_data->data, NULL); gaim_dnsquery_destroy(query_data); @@ -98,500 +67,7 @@ gaim_dnsquery_destroy(query_data); } -#if defined(__unix__) || defined(__APPLE__) - -/* - * Unix! - */ - -/* - * Begin the DNS resolver child process functions. - */ -#ifdef HAVE_SIGNAL_H -static void -trap_gdb_bug() -{ - const char *message = - "Gaim's DNS child got a SIGTRAP signal.\n" - "This can be caused by trying to run gaim inside gdb.\n" - "There is a known gdb bug which prevents this. Supposedly gaim\n" - "should have detected you were using gdb and used an ugly hack,\n" - "check cope_with_gdb_brokenness() in dnsquery.c.\n\n" - "For more info about this bug, see http://sources.redhat.com/ml/gdb/2001-07/msg00349.html\n"; - fputs("\n* * *\n",stderr); - fputs(message,stderr); - fputs("* * *\n\n",stderr); - execlp("xmessage","xmessage","-center", message, NULL); - _exit(1); -} -#endif - -static void -gaim_dnsquery_resolver_run(int child_out, int child_in, gboolean show_debug) -{ - dns_params_t dns_params; - const size_t zero = 0; - int rc; -#ifdef HAVE_GETADDRINFO - struct addrinfo hints, *res, *tmp; - char servname[20]; -#else - struct sockaddr_in sin; - const size_t addrlen = sizeof(sin); -#endif - -#ifdef HAVE_SIGNAL_H - signal(SIGHUP, SIG_DFL); - signal(SIGINT, SIG_DFL); - signal(SIGQUIT, SIG_DFL); - signal(SIGCHLD, SIG_DFL); - signal(SIGTERM, SIG_DFL); - signal(SIGTRAP, trap_gdb_bug); -#endif - - /* - * We resolve 1 host name for each iteration of this - * while loop. - * - * The top half of this reads in the hostname and port - * number from the socket with our parent. The bottom - * half of this resolves the IP (blocking) and sends - * the result back to our parent, when finished. - */ - while (1) { - const char ch = 'Y'; - fd_set fds; - struct timeval tv = { .tv_sec = 40 , .tv_usec = 0 }; - FD_ZERO(&fds); - FD_SET(child_in, &fds); - rc = select(child_in + 1, &fds, NULL, NULL, &tv); - if (!rc) { - if (show_debug) - printf("dns[%d]: nobody needs me... =(\n", getpid()); - break; - } - rc = read(child_in, &dns_params, sizeof(dns_params_t)); - if (rc < 0) { - perror("read()"); - break; - } - if (rc == 0) { - if (show_debug) - printf("dns[%d]: Oops, father has gone, wait for me, wait...!\n", getpid()); - _exit(0); - } - if (dns_params.hostname[0] == '\0') { - printf("dns[%d]: hostname = \"\" (port = %d)!!!\n", getpid(), dns_params.port); - _exit(1); - } - /* Tell our parent that we read the data successfully */ - write(child_out, &ch, sizeof(ch)); - - /* We have the hostname and port, now resolve the IP */ - -#ifdef HAVE_GETADDRINFO - g_snprintf(servname, sizeof(servname), "%d", dns_params.port); - memset(&hints, 0, sizeof(hints)); - - /* This is only used to convert a service - * name to a port number. As we know we are - * passing a number already, we know this - * value will not be really used by the C - * library. - */ - hints.ai_socktype = SOCK_STREAM; - rc = getaddrinfo(dns_params.hostname, servname, &hints, &res); - write(child_out, &rc, sizeof(rc)); - if (rc != 0) { - close(child_out); - if (show_debug) - printf("dns[%d] Error: getaddrinfo returned %d\n", - getpid(), rc); - dns_params.hostname[0] = '\0'; - continue; - } - tmp = res; - while (res) { - size_t ai_addrlen = res->ai_addrlen; - write(child_out, &ai_addrlen, sizeof(ai_addrlen)); - write(child_out, res->ai_addr, res->ai_addrlen); - res = res->ai_next; - } - freeaddrinfo(tmp); - write(child_out, &zero, sizeof(zero)); -#else - if (!inet_aton(dns_params.hostname, &sin.sin_addr)) { - struct hostent *hp; - if (!(hp = gethostbyname(dns_params.hostname))) { - write(child_out, &h_errno, sizeof(int)); - close(child_out); - if (show_debug) - printf("DNS Error: %d\n", h_errno); - _exit(0); - } - memset(&sin, 0, sizeof(struct sockaddr_in)); - memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length); - sin.sin_family = hp->h_addrtype; - } else - sin.sin_family = AF_INET; - - sin.sin_port = htons(dns_params.port); - write(child_out, &addrlen, sizeof(addrlen)); - write(child_out, &sin, addrlen); - write(child_out, &zero, sizeof(zero)); -#endif - dns_params.hostname[0] = '\0'; - } - - close(child_out); - close(child_in); - - _exit(0); -} -/* - * End the DNS resolver child process functions. - */ - -/* - * Begin the functions for dealing with the DNS child processes. - */ -static void -cope_with_gdb_brokenness() -{ -#ifdef __linux__ - static gboolean already_done = FALSE; - char s[256], e[512]; - int n; - pid_t ppid; - - if(already_done) - return; - already_done = TRUE; - ppid = getppid(); - snprintf(s, sizeof(s), "/proc/%d/exe", ppid); - n = readlink(s, e, sizeof(e)); - if(n < 0) - return; - - e[MIN(n,sizeof(e)-1)] = '\0'; - - if(strstr(e,"gdb")) { - gaim_debug_info("dns", - "Debugger detected, performing useless query...\n"); - gethostbyname("x.x.x.x.x"); - } -#endif -} - -static void -gaim_dnsquery_resolver_destroy(GaimDnsQueryResolverProcess *resolver) -{ - g_return_if_fail(resolver != NULL); - - /* - * We might as well attempt to kill our child process. It really - * doesn't matter if this fails, because children will expire on - * their own after a few seconds. - */ - if (resolver->dns_pid > 0) - kill(resolver->dns_pid, SIGKILL); - - if (resolver->inpa != 0) - gaim_input_remove(resolver->inpa); - - close(resolver->fd_in); - close(resolver->fd_out); - - g_free(resolver); - - number_of_dns_children--; -} - -static GaimDnsQueryResolverProcess * -gaim_dnsquery_resolver_new(gboolean show_debug) -{ - GaimDnsQueryResolverProcess *resolver; - int child_out[2], child_in[2]; - - /* Create pipes for communicating with the child process */ - if (pipe(child_out) || pipe(child_in)) { - gaim_debug_error("dns", - "Could not create pipes: %s\n", strerror(errno)); - return NULL; - } - - resolver = g_new(GaimDnsQueryResolverProcess, 1); - resolver->inpa = 0; - - cope_with_gdb_brokenness(); - - /* "Go fork and multiply." --Tommy Caldwell (Emily's dad, not the climber) */ - resolver->dns_pid = fork(); - - /* If we are the child process... */ - if (resolver->dns_pid == 0) { - /* We should not access the parent's side of the pipes, so close them */ - close(child_out[0]); - close(child_in[1]); - - gaim_dnsquery_resolver_run(child_out[1], child_in[0], show_debug); - /* The thread calls _exit() rather than returning, so we never get here */ - } - - /* We should not access the child's side of the pipes, so close them */ - close(child_out[1]); - close(child_in[0]); - if (resolver->dns_pid == -1) { - gaim_debug_error("dns", - "Could not create child process for DNS: %s\n", - strerror(errno)); - gaim_dnsquery_resolver_destroy(resolver); - return NULL; - } - - resolver->fd_out = child_out[0]; - resolver->fd_in = child_in[1]; - number_of_dns_children++; - gaim_debug_info("dns", - "Created new DNS child %d, there are now %d children.\n", - resolver->dns_pid, number_of_dns_children); - - return resolver; -} - -/** - * @return TRUE if the request was sent succesfully. FALSE - * if the request could not be sent. This isn't - * necessarily an error. If the child has expired, - * for example, we won't be able to send the message. - */ static gboolean -send_dns_request_to_child(GaimDnsQueryData *query_data, - GaimDnsQueryResolverProcess *resolver) -{ - pid_t pid; - dns_params_t dns_params; - int rc; - char ch; - - /* This waitpid might return the child's PID if it has recently - * exited, or it might return an error if it exited "long - * enough" ago that it has already been reaped; in either - * instance, we can't use it. */ - pid = waitpid(resolver->dns_pid, NULL, WNOHANG); - if (pid > 0) { - gaim_debug_warning("dns", "DNS child %d no longer exists\n", - resolver->dns_pid); - gaim_dnsquery_resolver_destroy(resolver); - return FALSE; - } else if (pid < 0) { - gaim_debug_warning("dns", "Wait for DNS child %d failed: %s\n", - resolver->dns_pid, strerror(errno)); - gaim_dnsquery_resolver_destroy(resolver); - return FALSE; - } - - /* Copy the hostname and port into a single data structure */ - strncpy(dns_params.hostname, query_data->hostname, sizeof(dns_params.hostname) - 1); - dns_params.hostname[sizeof(dns_params.hostname) - 1] = '\0'; - dns_params.port = query_data->port; - - /* Send the data structure to the child */ - rc = write(resolver->fd_in, &dns_params, sizeof(dns_params)); - if (rc < 0) { - gaim_debug_error("dns", "Unable to write to DNS child %d: %d\n", - resolver->dns_pid, strerror(errno)); - gaim_dnsquery_resolver_destroy(resolver); - return FALSE; - } - - g_return_val_if_fail(rc == sizeof(dns_params), -1); - - /* Did you hear me? (This avoids some race conditions) */ - rc = read(resolver->fd_out, &ch, sizeof(ch)); - if (rc != 1 || ch != 'Y') - { - gaim_debug_warning("dns", - "DNS child %d not responding. Killing it!\n", - resolver->dns_pid); - gaim_dnsquery_resolver_destroy(resolver); - return FALSE; - } - - gaim_debug_info("dns", - "Successfully sent DNS request to child %d\n", - resolver->dns_pid); - - query_data->resolver = resolver; - - return TRUE; -} - -static void host_resolved(gpointer data, gint source, GaimInputCondition cond); - -static void -handle_next_queued_request() -{ - GaimDnsQueryData *query_data; - GaimDnsQueryResolverProcess *resolver; - - if ((queued_requests == NULL) || (g_queue_is_empty(queued_requests))) - /* No more DNS queries, yay! */ - return; - - query_data = g_queue_pop_head(queued_requests); - - /* - * If we have any children, attempt to have them perform the DNS - * query. If we're able to send the query then resolver will be - * set to the GaimDnsQueryResolverProcess. Otherwise, resolver - * will be NULL and we'll need to create a new DNS request child. - */ - while (free_dns_children != NULL) - { - resolver = free_dns_children->data; - free_dns_children = g_slist_remove(free_dns_children, resolver); - - if (send_dns_request_to_child(query_data, resolver)) - /* We found an acceptable child, yay */ - break; - } - - /* We need to create a new DNS request child */ - if (query_data->resolver == NULL) - { - if (number_of_dns_children >= MAX_DNS_CHILDREN) - { - /* Apparently all our children are busy */ - g_queue_push_head(queued_requests, query_data); - return; - } - - resolver = gaim_dnsquery_resolver_new(gaim_debug_is_enabled()); - if (resolver == NULL) - { - gaim_dnsquery_failed(query_data, _("Unable to create new resolver process\n")); - return; - } - if (!send_dns_request_to_child(query_data, resolver)) - { - gaim_dnsquery_failed(query_data, _("Unable to send request to resolver process\n")); - return; - } - } - - query_data->resolver->inpa = gaim_input_add(query_data->resolver->fd_out, - GAIM_INPUT_READ, host_resolved, query_data); -} - -/* - * End the functions for dealing with the DNS child processes. - */ - -static void -host_resolved(gpointer data, gint source, GaimInputCondition cond) -{ - GaimDnsQueryData *query_data; - int rc, err; - GSList *hosts = NULL; - struct sockaddr *addr = NULL; - size_t addrlen; - char message[1024]; - - query_data = data; - - gaim_debug_info("dns", "Got response for '%s'\n", query_data->hostname); - gaim_input_remove(query_data->resolver->inpa); - query_data->resolver->inpa = 0; - - rc = read(query_data->resolver->fd_out, &err, sizeof(err)); - if ((rc == 4) && (err != 0)) - { -#ifdef HAVE_GETADDRINFO - g_snprintf(message, sizeof(message), _("Error resolving %s: %s"), - query_data->hostname, gai_strerror(err)); -#else - g_snprintf(message, sizeof(message), _("Error resolving %s: %d"), - query_data->hostname, err); -#endif - gaim_dnsquery_failed(query_data, message); - - } else if (rc > 0) { - /* Success! */ - while (rc > 0) { - rc = read(query_data->resolver->fd_out, &addrlen, sizeof(addrlen)); - if (rc > 0 && addrlen > 0) { - addr = g_malloc(addrlen); - rc = read(query_data->resolver->fd_out, addr, addrlen); - hosts = g_slist_append(hosts, GINT_TO_POINTER(addrlen)); - hosts = g_slist_append(hosts, addr); - } else { - break; - } - } - /* wait4(resolver->dns_pid, NULL, WNOHANG, NULL); */ - gaim_dnsquery_resolved(query_data, hosts); - - } else if (rc == -1) { - g_snprintf(message, sizeof(message), _("Error reading from resolver process: %s"), strerror(errno)); - gaim_dnsquery_failed(query_data, message); - - } else if (rc == 0) { - g_snprintf(message, sizeof(message), _("EOF while reading from resolver process")); - gaim_dnsquery_failed(query_data, message); - } - - handle_next_queued_request(); -} - -static gboolean -resolve_host(gpointer data) -{ - GaimDnsQueryData *query_data; - - query_data = data; - query_data->timeout = 0; - - handle_next_queued_request(); - - return FALSE; -} - -GaimDnsQueryData * -gaim_dnsquery_a(const char *hostname, int port, - GaimDnsQueryConnectFunction callback, gpointer data) -{ - GaimDnsQueryData *query_data; - - g_return_val_if_fail(hostname != NULL, NULL); - g_return_val_if_fail(port != 0, NULL); - - query_data = g_new(GaimDnsQueryData, 1); - query_data->hostname = g_strdup(hostname); - g_strstrip(query_data->hostname); - query_data->port = port; - query_data->callback = callback; - query_data->data = data; - query_data->resolver = NULL; - - if (!queued_requests) - queued_requests = g_queue_new(); - g_queue_push_tail(queued_requests, query_data); - - gaim_debug_info("dns", "DNS query for '%s' queued\n", query_data->hostname); - - query_data->timeout = gaim_timeout_add(0, resolve_host, query_data); - - return query_data; -} - -#elif defined _WIN32 /* end __unix__ || __APPLE__ */ - -/* - * Windows! - */ - -static gboolean dns_main_thread_cb(gpointer data) { GaimDnsQueryData *query_data; @@ -603,7 +79,8 @@ else { GSList *hosts; - /* We don't want gaim_dns_query_resolved() to free(hosts) */ + + /* We don't want gaim_dns_query_resolved() to free hosts */ hosts = query_data->hosts; query_data->hosts = NULL; gaim_dnsquery_resolved(query_data, hosts); @@ -686,6 +163,10 @@ if (inet_aton(query_data->hostname, &sin.sin_addr)) { + /* + * The given "hostname" is actually an IP address, so we + * don't need to do anything. + */ GSList *hosts = NULL; sin.sin_family = AF_INET; sin.sin_port = htons(query_data->port); @@ -695,6 +176,10 @@ } else { + /* + * Spin off a separate thread to perform the DNS lookup so + * that we don't block the UI. + */ query_data->resolver = g_thread_create(dns_thread, query_data, FALSE, &err); if (query_data->resolver == NULL) @@ -719,6 +204,8 @@ g_return_val_if_fail(hostname != NULL, NULL); g_return_val_if_fail(port != 0, NULL); + gaim_debug_info("dnsquery", "Performing DNS lookup for %s\n", hostname); + query_data = g_new(GaimDnsQueryData, 1); query_data->hostname = g_strdup(hostname); g_strstrip(query_data->hostname); @@ -734,85 +221,10 @@ return query_data; } -#else /* not __unix__ or __APPLE__ or _WIN32 */ - -/* - * We weren't able to do anything fancier above, so use the - * fail-safe name resolution code, which is blocking. - */ - -static gboolean -resolve_host(gpointer data) -{ - GaimDnsQueryData *query_data; - struct sockaddr_in sin; - GSList *hosts = NULL; - - query_data = data; - query_data->timeout = 0; - - if (!inet_aton(query_data->hostname, &sin.sin_addr)) { - struct hostent *hp; - if(!(hp = gethostbyname(query_data->hostname))) { - char message[1024]; - g_snprintf(message, sizeof(message), _("Error resolving %s: %d"), - query_data->hostname, h_errno); - gaim_dnsquery_failed(query_data, message); - return FALSE; - } - memset(&sin, 0, sizeof(struct sockaddr_in)); - memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length); - sin.sin_family = hp->h_addrtype; - } else - sin.sin_family = AF_INET; - sin.sin_port = htons(query_data->port); - - hosts = g_slist_append(hosts, GINT_TO_POINTER(sizeof(sin))); - hosts = g_slist_append(hosts, g_memdup(&sin, sizeof(sin))); - - gaim_dnsquery_resolved(query_data, hosts); - - return FALSE; -} - -GaimDnsQueryData * -gaim_dnsquery_a(const char *hostname, int port, - GaimDnsQueryConnectFunction callback, gpointer data) -{ - GaimDnsQueryData *query_data; - - g_return_val_if_fail(hostname != NULL, NULL); - g_return_val_if_fail(port != 0, NULL); - - query_data = g_new(GaimDnsQueryData, 1); - query_data->hostname = g_strdup(hostname); - g_strstrip(query_data->hostname); - query_data->port = port; - query_data->callback = callback; - query_data->data = data; - - /* Don't call the callback before returning */ - query_data->timeout = gaim_timeout_add(0, resolve_host, query_data); - - return query_data; -} - -#endif /* not __unix__ or __APPLE__ or _WIN32 */ - void gaim_dnsquery_destroy(GaimDnsQueryData *query_data) { -#if defined(__unix__) || defined(__APPLE__) if (query_data->resolver != NULL) - /* - * Ideally we would tell our resolver child to stop resolving - * shit and then we would add it back to the free_dns_children - * linked list. However, it's hard to tell children stuff, - * they just don't listen. - */ - gaim_dnsquery_resolver_destroy(query_data->resolver); -#elif defined _WIN32 /* end __unix__ || __APPLE__ */ - if (query_data->resolver != NULL) { /* * It's not really possible to kill a thread. So instead we @@ -832,7 +244,6 @@ query_data->hosts = g_slist_remove(query_data->hosts, query_data->hosts->data); } g_free(query_data->error_message); -#endif if (query_data->timeout > 0) gaim_timeout_remove(query_data->timeout); @@ -844,20 +255,11 @@ void gaim_dnsquery_init(void) { -#ifdef _WIN32 if (!g_thread_supported()) g_thread_init(NULL); -#endif } void gaim_dnsquery_uninit(void) { -#if defined(__unix__) || defined(__APPLE__) - while (free_dns_children != NULL) - { - gaim_dnsquery_resolver_destroy(free_dns_children->data); - free_dns_children = g_slist_remove(free_dns_children, free_dns_children->data); - } -#endif } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-08-21 00:23:20
|
Revision: 16925 Author: markhuetsch Date: 2006-08-20 17:23:12 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16925&view=rev Log Message: ----------- One more warning removed. Modified Paths: -------------- trunk/libgaim/protocols/qq/group_search.c Modified: trunk/libgaim/protocols/qq/group_search.c =================================================================== --- trunk/libgaim/protocols/qq/group_search.c 2006-08-20 23:16:44 UTC (rev 16924) +++ trunk/libgaim/protocols/qq/group_search.c 2006-08-21 00:23:12 UTC (rev 16925) @@ -73,7 +73,7 @@ qd = (qq_data *) gc->proto_data; i = 0; - bytes += read_packet_b(data, cursor, len, &search_type); + read_packet_b(data, cursor, len, &search_type); group = g_newa(qq_group, 1); /* now it starts with group_info_entry */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-08-20 23:16:56
|
Revision: 16924 Author: markhuetsch Date: 2006-08-20 16:16:44 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16924&view=rev Log Message: ----------- Got rid of a bunch of warnings. Modified Paths: -------------- trunk/libgaim/protocols/qq/file_trans.c trunk/libgaim/protocols/qq/group_opt.c trunk/libgaim/protocols/qq/im.c trunk/libgaim/protocols/qq/qq.c trunk/libgaim/protocols/qq/send_core.h trunk/libgaim/protocols/qq/send_file.c trunk/libgaim/protocols/qq/send_file.h trunk/libgaim/protocols/qq/utils.c trunk/libgaim/protocols/qq/utils.h Modified: trunk/libgaim/protocols/qq/file_trans.c =================================================================== --- trunk/libgaim/protocols/qq/file_trans.c 2006-08-20 23:08:42 UTC (rev 16923) +++ trunk/libgaim/protocols/qq/file_trans.c 2006-08-20 23:16:44 UTC (rev 16924) @@ -38,9 +38,8 @@ #include "proxy.h" #include "send_core.h" #include "send_file.h" +#include "utils.h" -extern gchar *hex_dump_to_str (const guint8 *buffer, gint bytes); - struct _qq_file_header { guint8 tag; guint16 client_ver; @@ -76,7 +75,7 @@ return (~uid) ^ key; } -static void _fill_filename_md5(const gchar *filename, gchar *md5) +static void _fill_filename_md5(const gchar *filename, guint8 *md5) { GaimCipher *cipher; GaimCipherContext *context; @@ -90,7 +89,7 @@ gaim_cipher_context_destroy(context); } -static void _fill_file_md5(const gchar *filename, gint filelen, gchar *md5) +static void _fill_file_md5(const gchar *filename, gint filelen, guint8 *md5) { FILE *fp; guint8 *buffer; @@ -274,7 +273,6 @@ bytes += create_packet_dw(buf, &cursor, _encrypt_qq_uid(to_uid, file_key)); bytes += create_packet_data(buf, &cursor, data, len); - ssize_t _qq_xfer_write(const char *buf, size_t len, GaimXfer *xfer); if (bytes == len + 12) { _qq_xfer_write(buf, bytes, qd->xfer); } else @@ -282,15 +280,12 @@ return bytes; } -extern gchar *_gen_session_md5(gint uid, guint8 *session_key); - /* send a file to udp channel with QQ_FILE_CONTROL_PACKET_TAG */ void qq_send_file_ctl_packet(GaimConnection *gc, guint16 packet_type, guint32 to_uid, guint8 hellobyte) { qq_data *qd; gint bytes, bytes_expected, encrypted_len; - guint8 *raw_data, *cursor, *encrypted_data; - gchar *md5; + guint8 *raw_data, *cursor, *encrypted_data, *md5; time_t now; ft_info *info; @@ -393,9 +388,9 @@ guint32 fragment_index, guint16 seq, guint8 *data, gint len) { gint bytes; - guint8 *raw_data, *cursor; + guint8 *raw_data, *cursor, filename_md5[QQ_KEY_LENGTH], file_md5[QQ_KEY_LENGTH]; guint32 fragment_size = 1000; - gchar file_md5[16], filename_md5[16], *filename; + gchar *filename; gint filename_len, filesize; qq_data *qd; ft_info *info; @@ -529,7 +524,7 @@ guint16 packet_type; guint16 seq; guint8 hellobyte; - gchar *md5; + guint8 *md5; ft_info *info = (ft_info *) qd->xfer->data; decrypted_data = g_newa(guint8, len); Modified: trunk/libgaim/protocols/qq/group_opt.c =================================================================== --- trunk/libgaim/protocols/qq/group_opt.c 2006-08-20 23:08:42 UTC (rev 16923) +++ trunk/libgaim/protocols/qq/group_opt.c 2006-08-20 23:16:44 UTC (rev 16924) @@ -75,7 +75,7 @@ gint i; for (i = 0; list[i] < 0xffffffff; i++) {; } - _quick_sort(list, 0, i - 1); + _quick_sort((gint *) list, 0, i - 1); } static void _qq_group_member_opt(GaimConnection *gc, qq_group *group, gint operation, guint32 *members) Modified: trunk/libgaim/protocols/qq/im.c =================================================================== --- trunk/libgaim/protocols/qq/im.c 2006-08-20 23:08:42 UTC (rev 16923) +++ trunk/libgaim/protocols/qq/im.c 2006-08-20 23:16:44 UTC (rev 16924) @@ -23,7 +23,6 @@ #include "conversation.h" #include "debug.h" #include "internal.h" -#include "cipher.h" #include "notify.h" #include "server.h" #include "util.h" @@ -209,27 +208,6 @@ } } -/* generate a md5 key using uid and session_key */ -gchar *_gen_session_md5(gint uid, guint8 *session_key) -{ - guint8 *src, md5_str[QQ_KEY_LENGTH], *cursor; - GaimCipher *cipher; - GaimCipherContext *context; - - src = g_newa(guint8, 20); - cursor = src; - create_packet_dw(src, &cursor, uid); - create_packet_data(src, &cursor, session_key, QQ_KEY_LENGTH); - - cipher = gaim_ciphers_find_cipher("md5"); - context = gaim_cipher_context_new(cipher, NULL); - gaim_cipher_context_append(context, src, 20); - gaim_cipher_context_digest(context, sizeof(md5_str), md5_str, NULL); - gaim_cipher_context_destroy(context); - - return g_memdup(md5_str, QQ_KEY_LENGTH); -} - /* when we receive a message, * we send an ACK which is the first 16 bytes of incoming packet */ static void _qq_send_packet_recv_im_ack(GaimConnection *gc, guint16 seq, guint8 *data) @@ -449,11 +427,11 @@ void qq_send_packet_im(GaimConnection *gc, guint32 to_uid, gchar *msg, gint type) { qq_data *qd; - guint8 *cursor, *raw_data, *send_im_tail; + guint8 *cursor, *raw_data, *send_im_tail, *md5; guint16 client_tag, normal_im_type; gint msg_len, raw_len, font_name_len, tail_len, bytes; time_t now; - gchar *md5, *msg_filtered; + gchar *msg_filtered; GData *attribs; gchar *font_size = NULL, *font_color = NULL, *font_name = NULL, *tmp; gboolean is_bold = FALSE, is_italic = FALSE, is_underline = FALSE; Modified: trunk/libgaim/protocols/qq/qq.c =================================================================== --- trunk/libgaim/protocols/qq/qq.c 2006-08-20 23:08:42 UTC (rev 16923) +++ trunk/libgaim/protocols/qq/qq.c 2006-08-20 23:16:44 UTC (rev 16924) @@ -511,10 +511,12 @@ g_string_free(info, TRUE); } +/* static void _qq_menu_search_or_add_permanent_group(GaimPluginAction *action) { gaim_roomlist_show_with_account(NULL); } +*/ /* static void _qq_menu_create_permanent_group(GaimPluginAction * action) Modified: trunk/libgaim/protocols/qq/send_core.h =================================================================== --- trunk/libgaim/protocols/qq/send_core.h 2006-08-20 23:08:42 UTC (rev 16923) +++ trunk/libgaim/protocols/qq/send_core.h 2006-08-20 23:16:44 UTC (rev 16924) @@ -33,5 +33,7 @@ gint qq_send_cmd(GaimConnection *gc, guint16 cmd, gboolean is_auto_seq, guint16 seq, gboolean need_ack, guint8 *data, gint len); gint _qq_send_packet(GaimConnection * gc, guint8 *buf, gint len, guint16 cmd); +gint _create_packet_head_seq(guint8 *buf, guint8 **cursor, + GaimConnection *gc, guint16 cmd, gboolean is_auto_seq, guint16 *seq); #endif Modified: trunk/libgaim/protocols/qq/send_file.c =================================================================== --- trunk/libgaim/protocols/qq/send_file.c 2006-08-20 23:08:42 UTC (rev 16923) +++ trunk/libgaim/protocols/qq/send_file.c 2006-08-20 23:16:44 UTC (rev 16924) @@ -166,6 +166,7 @@ } /* start file transfer process */ +/* static void _qq_xfer_send_start (GaimXfer *xfer) { GaimAccount *account; @@ -176,7 +177,9 @@ gc = gaim_account_get_connection(account); info = (ft_info *) xfer->data; } +*/ +/* static void _qq_xfer_send_ack (GaimXfer *xfer, const char *buffer, size_t len) { GaimAccount *account; @@ -186,10 +189,13 @@ gc = gaim_account_get_connection(account); qq_process_recv_file(gc, (guint8 *) buffer, len); } +*/ +/* static void _qq_xfer_recv_start(GaimXfer *xfer) { } +*/ static void _qq_xfer_end(GaimXfer *xfer) { @@ -269,15 +275,13 @@ } -extern gchar *_gen_session_md5(gint uid, guint8 *session_key); - /* fill in the common information of file transfer */ static gint _qq_create_packet_file_header (guint8 *raw_data, guint8 **cursor, guint32 to_uid, guint16 message_type, qq_data *qd, gboolean seq_ack) { gint bytes; time_t now; - gchar *md5; + guint8 *md5; guint16 seq; ft_info *info; @@ -934,6 +938,7 @@ gaim_xfer_request (xfer); } +/* static void qq_send_packet_request_key(GaimConnection *gc, guint8 key) { qq_send_cmd(gc, QQ_CMD_REQUEST_KEY, TRUE, 0, TRUE, &key, 1); @@ -942,3 +947,4 @@ static void qq_process_recv_request_key(GaimConnection *gc) { } +*/ Modified: trunk/libgaim/protocols/qq/send_file.h =================================================================== --- trunk/libgaim/protocols/qq/send_file.h 2006-08-20 23:08:42 UTC (rev 16923) +++ trunk/libgaim/protocols/qq/send_file.h 2006-08-20 23:16:44 UTC (rev 16924) @@ -58,4 +58,6 @@ void qq_send_file(GaimConnection *gc, const char *who, const char *file); void qq_get_conn_info(guint8 *data, guint8 **cursor, gint data_len, ft_info *info); gint qq_fill_conn_info(guint8 *data, guint8 **cursor, ft_info *info); +gssize _qq_xfer_write(const guint8 *buf, size_t len, GaimXfer *xfer); + #endif Modified: trunk/libgaim/protocols/qq/utils.c =================================================================== --- trunk/libgaim/protocols/qq/utils.c 2006-08-20 23:08:42 UTC (rev 16923) +++ trunk/libgaim/protocols/qq/utils.c 2006-08-20 23:16:44 UTC (rev 16924) @@ -20,8 +20,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "cipher.h" +#include "limits.h" #include "stdlib.h" -#include "limits.h" #include "string.h" #ifdef _WIN32 @@ -31,6 +32,7 @@ #include "char_conv.h" #include "debug.h" #include "prefs.h" +#include "qq.h" #include "util.h" #include "utils.h" @@ -109,6 +111,26 @@ return segments; } +/* generate a md5 key using uid and session_key */ +guint8 *_gen_session_md5(gint uid, guint8 *session_key) +{ + guint8 *src, md5_str[QQ_KEY_LENGTH]; + GaimCipher *cipher; + GaimCipherContext *context; + + src = g_newa(guint8, 20); + memcpy(src, &uid, 4); + memcpy(src, session_key, QQ_KEY_LENGTH); + + cipher = gaim_ciphers_find_cipher("md5"); + context = gaim_cipher_context_new(cipher, NULL); + gaim_cipher_context_append(context, src, 20); + gaim_cipher_context_digest(context, sizeof(md5_str), md5_str, NULL); + gaim_cipher_context_destroy(context); + + return g_memdup(md5_str, QQ_KEY_LENGTH); +} + /* given a four-byte ip data, convert it into a human readable ip string * the return needs to be freed */ gchar *gen_ip_str(guint8 *ip) Modified: trunk/libgaim/protocols/qq/utils.h =================================================================== --- trunk/libgaim/protocols/qq/utils.h 2006-08-20 23:08:42 UTC (rev 16923) +++ trunk/libgaim/protocols/qq/utils.h 2006-08-20 23:16:44 UTC (rev 16924) @@ -33,6 +33,7 @@ gint qq_string_to_dec_value(const gchar *str); gchar **split_data(guint8 *data, gint len, const gchar *delimit, gint expected_fields); +guint8 *_gen_session_md5(gint uid, guint8 *session_key); gchar *gen_ip_str(guint8 *ip); guint8 *str_ip_gen(gchar *str); gchar *uid_to_gaim_name(guint32 uid); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dat...@us...> - 2006-08-20 23:08:57
|
Revision: 16923 Author: datallah Date: 2006-08-20 16:08:42 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16923&view=rev Log Message: ----------- Now featuring a working wingaim! Modified Paths: -------------- trunk/Makefile.mingw trunk/gaim-installer.nsi trunk/gtk/Makefile.mingw trunk/gtk/pixmaps/Makefile.mingw trunk/gtk/pixmaps/smileys/Makefile.mingw trunk/gtk/pixmaps/smileys/default/Makefile.mingw trunk/gtk/pixmaps/smileys/none/Makefile.mingw trunk/gtk/pixmaps/status/Makefile.mingw trunk/gtk/pixmaps/status/default/Makefile.mingw trunk/libgaim/Makefile.mingw Modified: trunk/Makefile.mingw =================================================================== --- trunk/Makefile.mingw 2006-08-20 22:47:25 UTC (rev 16922) +++ trunk/Makefile.mingw 2006-08-20 23:08:42 UTC (rev 16923) @@ -5,96 +5,28 @@ # Description: Top Makefile for win32 (mingw) port of Gaim # -GAIM_SRC = ./src -GAIM_PROTOS = $(GAIM_SRC)/protocols -GAIM_PLUGINS = ./plugins -GAIM_PIXMAPS = ./pixmaps +LIBGAIM_TOP = ./libgaim +GTKGAIM_TOP = ./gtk GAIM_SOUNDS = ./sounds GAIM_INSTALL_DIR = ./win32-install-dir -GTKSPELL_TOP = ../win32-dev/gtkspell-2.0.6/gtkspell -LIBXML2_DIR = ../win32-dev/libxml2 -IDLETRACK_TOP = $(GAIM_SRC)/win32/IdleTracker -GTKRC_TOP = ../win32-dev/gtkrc -OSCAR = $(GAIM_PROTOS)/oscar -YAHOO = $(GAIM_PROTOS)/yahoo -MSN = $(GAIM_PROTOS)/msn -TOC = $(GAIM_PROTOS)/toc -IRC = $(GAIM_PROTOS)/irc -JABBER = $(GAIM_PROTOS)/jabber -GG = $(GAIM_PROTOS)/gg -NOVELL = $(GAIM_PROTOS)/novell -SILC = $(GAIM_PROTOS)/silc -SIMPLE = $(GAIM_PROTOS)/simple -SAMETIME = $(GAIM_PROTOS)/sametime PO = ./po MAKENSIS := makensis.exe VERSION := $(shell cat ./VERSION) -NEEDED_DLLS = $(GTKSPELL_TOP)/libgtkspell.dll \ - $(IDLETRACK_TOP)/idletrack.dll \ - $(LIBXML2_DIR)/bin/libxml2.dll -SOUNDS = $(GAIM_SOUNDS)/alert.wav \ - $(GAIM_SOUNDS)/login.wav \ - $(GAIM_SOUNDS)/logout.wav \ - $(GAIM_SOUNDS)/receive.wav \ - $(GAIM_SOUNDS)/send.wav - - -## -## Don't forget to change STATIC_PROTO_INIT, in config.h.mingw if you -## change the status of a protocol (static/plugin) -## - -OSCAR_TYPE = PLUGIN -YAHOO_TYPE = PLUGIN -MSN_TYPE = PLUGIN -TOC_TYPE = PLUGIN -IRC_TYPE = PLUGIN -JABBER_TYPE = PLUGIN -GG_TYPE = PLUGIN -NOVELL_TYPE = PLUGIN -SILC_TYPE = PLUGIN -SIMPLE_TYPE = PLUGIN -SAMETIME_TYPE = PLUGIN - all: cp config.h.mingw config.h - $(MAKE) TYPE='$(OSCAR_TYPE)' -C $(OSCAR) -f Makefile.mingw - $(MAKE) TYPE='$(YAHOO_TYPE)' -C $(YAHOO) -f Makefile.mingw - $(MAKE) TYPE='$(MSN_TYPE)' -C $(MSN) -f Makefile.mingw - $(MAKE) TYPE='$(IRC_TYPE)' -C $(IRC) -f Makefile.mingw - $(MAKE) TYPE='$(JABBER_TYPE)' -C $(JABBER) -f Makefile.mingw - $(MAKE) TYPE='$(GG_TYPE)' -C $(GG) -f Makefile.mingw - $(MAKE) TYPE='$(NOVELL_TYPE)' -C $(NOVELL) -f Makefile.mingw - $(MAKE) TYPE='$(SILC_TYPE)' -C $(SILC) -f Makefile.mingw - $(MAKE) TYPE='$(SIMPLE_TYPE)' -C $(SIMPLE) -f Makefile.mingw - $(MAKE) TYPE='$(SAMETIME_TYPE)' -C $(SAMETIME) -f Makefile.mingw - $(MAKE) -C $(GAIM_SRC) -f Makefile.mingw - $(MAKE) -C $(GAIM_PLUGINS) -f Makefile.mingw + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw + $(MAKE) -C $(GTKGAIM_TOP) -f Makefile.mingw - install: all mkdir -p $(GAIM_INSTALL_DIR)/plugins mkdir -p $(GAIM_INSTALL_DIR)/sounds/gaim - $(MAKE) -C $(GAIM_PIXMAPS) -f Makefile.mingw install $(MAKE) -C $(PO) -f Makefile.mingw install - $(MAKE) -C $(GAIM_SRC) -f Makefile.mingw install - $(MAKE) -C $(GAIM_PLUGINS) -f Makefile.mingw install - $(MAKE) TYPE='$(OSCAR_TYPE)' -C $(OSCAR) -f Makefile.mingw install - $(MAKE) TYPE='$(YAHOO_TYPE)' -C $(YAHOO) -f Makefile.mingw install - $(MAKE) TYPE='$(MSN_TYPE)' -C $(MSN) -f Makefile.mingw install - $(MAKE) TYPE='$(IRC_TYPE)' -C $(IRC) -f Makefile.mingw install - $(MAKE) TYPE='$(JABBER_TYPE)' -C $(JABBER) -f Makefile.mingw install - $(MAKE) TYPE='$(GG_TYPE)' -C $(GG) -f Makefile.mingw install - $(MAKE) TYPE='$(NOVELL_TYPE)' -C $(NOVELL) -f Makefile.mingw install - $(MAKE) TYPE='$(SILC_TYPE)' -C $(SILC) -f Makefile.mingw install - $(MAKE) TYPE='$(SIMPLE_TYPE)' -C $(SIMPLE) -f Makefile.mingw install - $(MAKE) TYPE='$(SAMETIME_TYPE)' -C $(SAMETIME) -f Makefile.mingw install - cp $(NEEDED_DLLS) $(GAIM_INSTALL_DIR) - cp $(SOUNDS) $(GAIM_INSTALL_DIR)/sounds/gaim + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw install + $(MAKE) -C $(GTKGAIM_TOP) -f Makefile.mingw install installer: $(MAKENSIS) /DGAIM_VERSION="$(VERSION)" /DWITH_GTK gaim-installer.nsi @@ -110,17 +42,7 @@ clean: $(MAKE) -C $(PO) -f Makefile.mingw clean - $(MAKE) -C $(OSCAR) -f Makefile.mingw clean - $(MAKE) -C $(YAHOO) -f Makefile.mingw clean - $(MAKE) -C $(MSN) -f Makefile.mingw clean - $(MAKE) -C $(IRC) -f Makefile.mingw clean - $(MAKE) -C $(JABBER) -f Makefile.mingw clean - $(MAKE) -C $(GG) -f Makefile.mingw clean - $(MAKE) -C $(NOVELL) -f Makefile.mingw clean - $(MAKE) -C $(SILC) -f Makefile.mingw clean - $(MAKE) -C $(SIMPLE) -f Makefile.mingw clean - $(MAKE) -C $(SAMETIME) -f Makefile.mingw clean - $(MAKE) -C $(GAIM_SRC) -f Makefile.mingw clean - $(MAKE) -C $(GAIM_PLUGINS) -f Makefile.mingw clean + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw clean + $(MAKE) -C $(GTKGAIM_TOP) -f Makefile.mingw clean rm -rf config.h $(GAIM_INSTALL_DIR) rm -rf gaim*.exe Modified: trunk/gaim-installer.nsi =================================================================== --- trunk/gaim-installer.nsi 2006-08-20 22:47:25 UTC (rev 16922) +++ trunk/gaim-installer.nsi 2006-08-20 23:08:42 UTC (rev 16923) @@ -740,9 +740,10 @@ Delete "$INSTDIR\sounds\gaim\send.wav" RMDir "$INSTDIR\sounds\gaim" RMDir "$INSTDIR\sounds" - Delete "$INSTDIR\gaim.dll" Delete "$INSTDIR\gaim.exe" + Delete "$INSTDIR\gtkgaim.dll" Delete "$INSTDIR\idletrack.dll" + Delete "$INSTDIR\libgaim.dll" Delete "$INSTDIR\libgtkspell.dll" Delete "$INSTDIR\libmeanwhile-1.dll" Delete "$INSTDIR\libxml2.dll" Modified: trunk/gtk/Makefile.mingw =================================================================== --- trunk/gtk/Makefile.mingw 2006-08-20 22:47:25 UTC (rev 16922) +++ trunk/gtk/Makefile.mingw 2006-08-20 23:08:42 UTC (rev 16923) @@ -11,13 +11,25 @@ GTK_TOP := ../../win32-dev/gtk_2_0 GAIM_TOP := .. GTKGAIM_TOP := . -LIBGAIM_TOP := ../libgaim +LIBGAIM_TOP := $(GAIM_TOP)/libgaim +PLUGINS_TOP := $(GTKGAIM_TOP)/plugins +PIXMAPS_TOP := $(GTKGAIM_TOP)/pixmaps +SOUNDS_TOP := $(GTKGAIM_TOP)/sounds ASPELL_TOP := ../../win32-dev/aspell-dev-0-50-3-3 GTKSPELL_TOP := ../../win32-dev/gtkspell-2.0.6 IDLETRACK_TOP := $(GTKGAIM_TOP)/win32/IdleTracker GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir #LIBXML2_DIR := ../../win32-dev/libxml2 +NEEDED_DLLS = $(GTKSPELL_TOP)/gtkspell/libgtkspell.dll \ + $(IDLETRACK_TOP)/idletrack.dll + +SOUNDS = $(SOUNDS_TOP)/alert.wav \ + $(SOUNDS_TOP)/login.wav \ + $(SOUNDS_TOP)/logout.wav \ + $(SOUNDS_TOP)/receive.wav \ + $(SOUNDS_TOP)/send.wav + ## ## VARIABLE DEFINITIONS ## @@ -181,12 +193,17 @@ ## TARGET DEFINITIONS ## -.PHONY: all clean libgaim_include_path gtkgaim_include_path +.PHONY: all clean all: $(EXE_TARGET).exe $(GTKGAIM_TARGET).dll + $(MAKE) -C $(PLUGINS_TOP) -f Makefile.mingw install: all + $(MAKE) -C $(PLUGINS_TOP) -f Makefile.mingw install + $(MAKE) -C $(PIXMAPS_TOP) -f Makefile.mingw install cp $(GTKGAIM_TOP)/$(EXE_TARGET).exe $(GTKGAIM_TOP)/$(GTKGAIM_TARGET).dll $(GAIM_INSTALL_DIR) + cp $(NEEDED_DLLS) $(GAIM_INSTALL_DIR) + cp $(SOUNDS) $(GAIM_INSTALL_DIR)/sounds/gaim $(LIBGAIM_TOP)/libgaim.dll.a: S(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a @@ -197,9 +214,6 @@ # # BUILD DLL # -#$(GTKGAIM_TARGET).dll.a $(GTKGAIM_TARGET).dll: INCLUDE_PATHS = $(GTKGAIM_INCLUDE_PATHS) -#Once the UI split has finished for server.c, this will be the correct line -#$(GTKGAIM_TARGET).dll.a $(GTKGAIM_TARGET).dll: $(LIBGAIM_TARGET).dll.a $(GTKGAIM_OBJECTS) $(GTKGAIM_TARGET).dll.a $(GTKGAIM_TARGET).dll: $(LIBGAIM_TOP)/libgaim.dll.a $(GTKGAIM_OBJECTS) $(IDLETRACK_TOP)/idletrack.dll $(CC) -shared $(LIBGAIM_OBJECTS) $(GTKGAIM_OBJECTS) $(LIB_PATHS) $(GTKGAIM_LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(GTKGAIM_TARGET).dll.a -o $(GTKGAIM_TARGET).dll @@ -224,6 +238,7 @@ rm -rf $(GTKGAIM_TARGET).dll rm -rf $(GTKGAIM_TARGET).dll.a rm -rf $(EXE_TARGET).exe + $(MAKE) -C $(PLUGINS_TOP) -f Makefile.mingw clean clean_exe: rm -rf win_gaim.o Modified: trunk/gtk/pixmaps/Makefile.mingw =================================================================== --- trunk/gtk/pixmaps/Makefile.mingw 2006-08-20 22:47:25 UTC (rev 16922) +++ trunk/gtk/pixmaps/Makefile.mingw 2006-08-20 23:08:42 UTC (rev 16923) @@ -4,8 +4,10 @@ # Description: Makefile for win32 (mingw) version of Gaim pixmaps # -datadir = ../win32-install-dir +GAIM_TOP := ../.. +datadir = $(GAIM_TOP)/win32-install-dir + include ./Makefile.am install: Modified: trunk/gtk/pixmaps/smileys/Makefile.mingw =================================================================== --- trunk/gtk/pixmaps/smileys/Makefile.mingw 2006-08-20 22:47:25 UTC (rev 16922) +++ trunk/gtk/pixmaps/smileys/Makefile.mingw 2006-08-20 23:08:42 UTC (rev 16923) @@ -4,8 +4,10 @@ # Description: Makefile for win32 (mingw) version of Gaim pixmaps # -INSTALL_DIR = ../../win32-install-dir/pixmaps/gaim/smileys +GAIM_TOP = ../../.. +INSTALL_DIR = $(GAIM_TOP)/win32-install-dir/pixmaps/gaim/smileys + include ./Makefile.am install: Modified: trunk/gtk/pixmaps/smileys/default/Makefile.mingw =================================================================== --- trunk/gtk/pixmaps/smileys/default/Makefile.mingw 2006-08-20 22:47:25 UTC (rev 16922) +++ trunk/gtk/pixmaps/smileys/default/Makefile.mingw 2006-08-20 23:08:42 UTC (rev 16923) @@ -4,7 +4,9 @@ # Description: Makefile for win32 (mingw) version of Gaim pixmaps # -datadir = ../../../win32-install-dir +GAIM_TOP = ../../../.. + +datadir = $(GAIM_TOP)/win32-install-dir include ./Makefile.am install: Modified: trunk/gtk/pixmaps/smileys/none/Makefile.mingw =================================================================== --- trunk/gtk/pixmaps/smileys/none/Makefile.mingw 2006-08-20 22:47:25 UTC (rev 16922) +++ trunk/gtk/pixmaps/smileys/none/Makefile.mingw 2006-08-20 23:08:42 UTC (rev 16923) @@ -4,7 +4,9 @@ # Description: Makefile for win32 (mingw) version of Gaim pixmaps # -datadir = ../../../win32-install-dir +GAIM_TOP = ../../../.. + +datadir = $(GAIM_TOP)/win32-install-dir include ./Makefile.am install: Modified: trunk/gtk/pixmaps/status/Makefile.mingw =================================================================== --- trunk/gtk/pixmaps/status/Makefile.mingw 2006-08-20 22:47:25 UTC (rev 16922) +++ trunk/gtk/pixmaps/status/Makefile.mingw 2006-08-20 23:08:42 UTC (rev 16923) @@ -4,8 +4,10 @@ # Description: Makefile for win32 (mingw) version of Gaim pixmaps # -INSTALL_DIR = ../../win32-install-dir/pixmaps/gaim/status +GAIM_TOP = ../../.. +INSTALL_DIR = $(GAIM_TOP)/win32-install-dir/pixmaps/gaim/status + include ./Makefile.am install: Modified: trunk/gtk/pixmaps/status/default/Makefile.mingw =================================================================== --- trunk/gtk/pixmaps/status/default/Makefile.mingw 2006-08-20 22:47:25 UTC (rev 16922) +++ trunk/gtk/pixmaps/status/default/Makefile.mingw 2006-08-20 23:08:42 UTC (rev 16923) @@ -4,7 +4,9 @@ # Description: Makefile for win32 (mingw) version of Gaim pixmaps # -datadir = ../../../win32-install-dir +GAIM_TOP = ../../../.. + +datadir = $(GAIM_TOP)/win32-install-dir include ./Makefile.am install: Modified: trunk/libgaim/Makefile.mingw =================================================================== --- trunk/libgaim/Makefile.mingw 2006-08-20 22:47:25 UTC (rev 16922) +++ trunk/libgaim/Makefile.mingw 2006-08-20 23:08:42 UTC (rev 16923) @@ -8,13 +8,17 @@ # PATHS # -INCLUDE_DIR := . GTK_TOP := ../../win32-dev/gtk_2_0 GAIM_TOP := .. -GAIM_SRC := . +LIBGAIM_TOP := . +PLUGINS_TOP := $(LIBGAIM_TOP)/plugins +PROTOCOLS_TOP := $(LIBGAIM_TOP)/protocols GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir LIBXML2_DIR := ../../win32-dev/libxml2 +NEEDED_DLLS = $(LIBXML2_DIR)/bin/libxml2.dll + + ## ## VARIABLE DEFINITIONS ## @@ -31,15 +35,15 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/libgaim/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS ## INCLUDE_PATHS = \ - -I$(INCLUDE_DIR) \ - -I$(INCLUDE_DIR)/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ -I$(GAIM_TOP) \ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/glib-2.0 \ @@ -47,7 +51,7 @@ -I$(LIBXML2_DIR)/include LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_SRC) \ + -L$(LIBGAIM_TOP) \ -L$(LIBXML2_DIR)/lib ## @@ -134,11 +138,14 @@ .PHONY: all clean include_path all: $(TARGET).dll - $(MAKE) -C protocols -f Makefile.mingw + $(MAKE) -C $(PROTOCOLS_TOP) -f Makefile.mingw + $(MAKE) -C $(PLUGINS_TOP) -f Makefile.mingw install: all - $(MAKE) -C protocols -f Makefile.mingw install - cp $(GAIM_SRC)/$(TARGET).dll $(GAIM_INSTALL_DIR) + $(MAKE) -C $(PROTOCOLS_TOP) -f Makefile.mingw install + $(MAKE) -C $(PLUGINS_TOP) -f Makefile.mingw install + cp $(LIBGAIM_TOP)/$(TARGET).dll $(GAIM_INSTALL_DIR) + cp $(NEEDED_DLLS) $(GAIM_INSTALL_DIR) # # BUILD DLL @@ -155,4 +162,5 @@ rm -rf *.o ./win32/*.o rm -rf $(TARGET).dll rm -rf $(TARGET).dll.a - $(MAKE) -C protocols -f Makefile.mingw clean + $(MAKE) -C $(PROTOCOLS_TOP) -f Makefile.mingw clean + $(MAKE) -C $(PLUGINS_TOP) -f Makefile.mingw clean This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-20 22:47:28
|
Revision: 16922 Author: sadrul Date: 2006-08-20 15:47:25 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16922&view=rev Log Message: ----------- Update the manual, and add a sample for remapping keys. Modified Paths: -------------- trunk/doc/gntgaim.1.in Modified: trunk/doc/gntgaim.1.in =================================================================== --- trunk/doc/gntgaim.1.in 2006-08-20 22:46:20 UTC (rev 16921) +++ trunk/doc/gntgaim.1.in 2006-08-20 22:47:25 UTC (rev 16922) @@ -145,6 +145,39 @@ disabled = gray; black .br +.br +# Remap some keys for GntEntry +.br +[GntEntry::remap] +.br +# Remap the up-arrow to the left-arrow +.br +^[[A = ^[[D +.br +# Remap the down-arrow to the right-arrow +.br +^[[B = ^[[C +.br +# Remap 'a' to 'bcd' +.br +a = bcd +.br +# Completely ignore the key 'q' +.br +q = +.br +# But the following will NOT work +.br +#abc = bcd +.br + +# Hitting 'space' will activate a button +.br +[GntButton::remap] +.br +\\ = \\r +.br + .SH Conversation Commands There are a few helpful commands in addition to the regular commands. You can use these from any conversation to access other windows. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-20 22:46:29
|
Revision: 16921 Author: sadrul Date: 2006-08-20 15:46:20 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16921&view=rev Log Message: ----------- Allow remapping keys for widgets. Modified Paths: -------------- trunk/console/libgnt/gntstyle.c trunk/console/libgnt/gntstyle.h trunk/console/libgnt/gntwidget.c trunk/console/libgnt/gntwidget.h Modified: trunk/console/libgnt/gntstyle.c =================================================================== --- trunk/console/libgnt/gntstyle.c 2006-08-20 22:24:13 UTC (rev 16920) +++ trunk/console/libgnt/gntstyle.c 2006-08-20 22:46:20 UTC (rev 16921) @@ -3,6 +3,10 @@ #include <string.h> +#if GLIB_CHECK_VERSION(2,6,0) +static GKeyFile *gkfile; +#endif + static char * str_styles[GNT_STYLES]; static int int_styles[GNT_STYLES]; static int bool_styles[GNT_STYLES]; @@ -41,7 +45,90 @@ return bool_styles[style]; } +void refine(char *text) +{ + char *s = text, *t = text; + + while (*s) + { + if (*s == '^' && *(s + 1) == '[') + { + *t = '\033'; /* escape */ + s++; + } + else if (*s == '\\') + { + if (*(s + 1) == '\0') + *t = ' '; + else + { + s++; + if (*s == 'r' || *s == 'n') + *t = '\r'; + else if (*s == 't') + *t = '\t'; + else + *t = *s; + } + } + else + *t = *s; + t++; + s++; + } + *t = '\0'; +} + +void gnt_styles_get_keyremaps(GType type, GHashTable *hash) +{ #if GLIB_CHECK_VERSION(2,6,0) + char *name; + GError *error = NULL; + + name = g_strdup_printf("%s::remap", g_type_name(type)); + + if (g_key_file_has_group(gkfile, name)) + { + unsigned int len = 0; + char **keys; + + keys = g_key_file_get_keys(gkfile, name, &len, &error); + if (error) + { + g_printerr("GntStyle: %s\n", error->message); + g_error_free(error); + return; + } + + while (len--) + { + char *key, *replace; + + key = g_strdup(keys[len]); + replace = g_key_file_get_string(gkfile, name, keys[len], &error); + + if (error) + { + g_printerr("GntStyle: %s\n", error->message); + g_error_free(error); + error = NULL; + g_free(key); + } + else + { + refine(key); + refine(replace); + g_hash_table_insert(hash, key, replace); + } + } + g_strfreev(keys); + } + + g_free(name); +#endif +} + +#if GLIB_CHECK_VERSION(2,6,0) static void read_general_style(GKeyFile *kfile) { @@ -58,7 +145,7 @@ if (error) { - /* XXX: some error happened. */ + g_printerr("GntStyle: %s\n", error->message); g_error_free(error); } else @@ -70,25 +157,24 @@ g_key_file_get_string(kfile, "general", styles[i].style, &error); } } + g_strfreev(keys); } #endif void gnt_style_read_configure_file(const char *filename) { #if GLIB_CHECK_VERSION(2,6,0) - GKeyFile *kfile = g_key_file_new(); + gkfile = g_key_file_new(); GError *error = NULL; - if (!g_key_file_load_from_file(kfile, filename, G_KEY_FILE_NONE, &error)) + if (!g_key_file_load_from_file(gkfile, filename, G_KEY_FILE_NONE, &error)) { - /* XXX: Print the error or something */ + g_printerr("GntStyle: %s\n", error->message); g_error_free(error); return; } - gnt_colors_parse(kfile); - read_general_style(kfile); - - g_key_file_free(kfile); + gnt_colors_parse(gkfile); + read_general_style(gkfile); #endif } @@ -108,5 +194,9 @@ int i; for (i = 0; i < GNT_STYLES; i++) g_free(str_styles[i]); + +#if GLIB_CHECK_VERSION(2,6,0) + g_key_file_free(gkfile); +#endif } Modified: trunk/console/libgnt/gntstyle.h =================================================================== --- trunk/console/libgnt/gntstyle.h 2006-08-20 22:24:13 UTC (rev 16920) +++ trunk/console/libgnt/gntstyle.h 2006-08-20 22:46:20 UTC (rev 16921) @@ -13,6 +13,9 @@ gboolean gnt_style_get_bool(GntStyle style, gboolean def); +/* This should be called only once for the each type */ +void gnt_styles_get_keyremaps(GType type, GHashTable *hash); + void gnt_init_styles(); void gnt_uninit_styles(); Modified: trunk/console/libgnt/gntwidget.c =================================================================== --- trunk/console/libgnt/gntwidget.c 2006-08-20 22:24:13 UTC (rev 16920) +++ trunk/console/libgnt/gntwidget.c 2006-08-20 22:46:20 UTC (rev 16921) @@ -96,7 +96,6 @@ return continue_emission; } - static void gnt_widget_class_init(GntWidgetClass *klass) { @@ -214,6 +213,7 @@ gnt_boolean_handled_accumulator, NULL, gnt_closure_marshal_BOOLEAN__STRING, G_TYPE_BOOLEAN, 1, G_TYPE_STRING); + DEBUG; } @@ -231,7 +231,7 @@ NULL, /* base_init */ NULL, /* base_finalize */ (GClassInitFunc)gnt_widget_class_init, - NULL, /* class_finalize */ + NULL, NULL, /* class_data */ sizeof(GntWidget), 0, /* n_preallocs */ @@ -246,6 +246,24 @@ return type; } +static const char * +gnt_widget_remap_keys(GntWidget *widget, const char *text) +{ + const char *remap = NULL; + GType type = G_OBJECT_TYPE(widget); + GntWidgetClass *klass = GNT_WIDGET_CLASS(G_OBJECT_GET_CLASS(widget)); + + if (klass->remaps == NULL) + { + klass->remaps = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + gnt_styles_get_keyremaps(type, klass->remaps); + } + + remap = g_hash_table_lookup(klass->remaps, text); + + return (remap ? remap : text); +} + static void gnt_widget_take_focus(GntWidget *widget) { @@ -327,6 +345,8 @@ gboolean ret; if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS)) return FALSE; + + keys = gnt_widget_remap_keys(widget, keys); g_signal_emit(widget, signals[SIG_KEY_PRESSED], 0, keys, &ret); return ret; } Modified: trunk/console/libgnt/gntwidget.h =================================================================== --- trunk/console/libgnt/gntwidget.h 2006-08-20 22:24:13 UTC (rev 16920) +++ trunk/console/libgnt/gntwidget.h 2006-08-20 22:46:20 UTC (rev 16921) @@ -76,6 +76,8 @@ { GObjectClass parent; + GHashTable *remaps; /* Key remaps */ + void (*map)(GntWidget *obj); void (*show)(GntWidget *obj); /* This will call draw() and take focus (if it can take focus) */ void (*destroy)(GntWidget *obj); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |