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-20 22:24:21
|
Revision: 16920 Author: thekingant Date: 2006-08-20 15:24:13 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16920&view=rev Log Message: ----------- Cancelable DNS queries. This eliminates crashes when you cancel a connection attempt while we're waiting for a response from a DNS server. I tested with all three methods, so they SHOULD be ok. Let me know if you have problems. I should be around today, starting in maybe an hour. I feel like it's kinda dumb for us to have three implementations for the same thing. I want to get rid of the child-process method (currently used in Unix and OS-X) and use the thread-based method (currently used in Windows) everywhere. Then we can get rid of the third method, too (currently used when !Unix and !OS-X and !Windows) Any objections? Modified Paths: -------------- trunk/libgaim/core.c trunk/libgaim/dnsquery.c trunk/libgaim/dnsquery.h trunk/libgaim/protocols/simple/simple.c trunk/libgaim/protocols/simple/simple.h trunk/libgaim/proxy.c Modified: trunk/libgaim/core.c =================================================================== --- trunk/libgaim/core.c 2006-08-20 22:16:13 UTC (rev 16919) +++ trunk/libgaim/core.c 2006-08-20 22:24:13 UTC (rev 16920) @@ -28,6 +28,7 @@ #include "conversation.h" #include "core.h" #include "debug.h" +#include "dnsquery.h" #include "ft.h" #include "idle.h" #include "network.h" @@ -39,10 +40,10 @@ #include "proxy.h" #include "savedstatuses.h" #include "signals.h" +#include "sound.h" #include "sslconn.h" #include "status.h" #include "stun.h" -#include "sound.h" #ifdef HAVE_DBUS # include "dbus-server.h" @@ -128,6 +129,7 @@ gaim_privacy_init(); gaim_pounces_init(); gaim_proxy_init(); + gaim_dnsquery_init(); gaim_sound_init(); gaim_ssl_init(); gaim_stun_init(); @@ -172,6 +174,8 @@ gaim_status_uninit(); gaim_prefs_uninit(); gaim_xfers_uninit(); + gaim_proxy_uninit(); + gaim_dnsquery_uninit(); gaim_debug_info("main", "Unloading all plugins\n"); gaim_plugins_destroy_all(); Modified: trunk/libgaim/dnsquery.c =================================================================== --- trunk/libgaim/dnsquery.c 2006-08-20 22:16:13 UTC (rev 16919) +++ trunk/libgaim/dnsquery.c 2006-08-20 22:24:13 UTC (rev 16920) @@ -26,16 +26,31 @@ #include "internal.h" #include "debug.h" +#include "dnsquery.h" #include "notify.h" #include "prefs.h" -#include "dnsquery.h" #include "util.h" /************************************************************************** * DNS query API **************************************************************************/ +typedef struct _GaimDnsQueryResolverProcess GaimDnsQueryResolverProcess; + struct _GaimDnsQueryData { + char *hostname; + int port; + GaimDnsQueryConnectFunction callback; + 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__) @@ -43,36 +58,53 @@ #define MAX_DNS_CHILDREN 4 /* - * This structure represents both a pending DNS request and - * a free child process. + * This structure keeps a reference to a child resolver process. */ -typedef struct { - char *host; - int port; - GaimDnsQueryConnectFunction callback; - gpointer data; +struct _GaimDnsQueryResolverProcess { guint inpa; int fd_in, fd_out; pid_t dns_pid; -} pending_dns_request_t; +}; 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 -typedef struct { - dns_params_t params; - GaimDnsQueryConnectFunction callback; - gpointer data; -} queued_dns_request_t; +static void +gaim_dnsquery_resolved(GaimDnsQueryData *query_data, GSList *hosts) +{ + if (query_data->callback != NULL) + query_data->callback(hosts, query_data->data, NULL); + gaim_dnsquery_destroy(query_data); +} +static void +gaim_dnsquery_failed(GaimDnsQueryData *query_data, const gchar *error_message) +{ + gaim_debug_info("dnsquery", "%s\n", error_message); + if (query_data->callback != NULL) + query_data->callback(NULL, query_data->data, error_message); + gaim_dnsquery_destroy(query_data); +} + +#if defined(__unix__) || defined(__APPLE__) + /* + * Unix! + */ + +/* * Begin the DNS resolver child process functions. */ #ifdef HAVE_SIGNAL_H @@ -95,36 +127,8 @@ #endif static void -cope_with_gdb_brokenness() +gaim_dnsquery_resolver_run(int child_out, int child_in, gboolean show_debug) { -#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_dns_resolverthread(int child_out, int child_in, gboolean show_debug) -{ dns_params_t dns_params; const size_t zero = 0; int rc; @@ -244,11 +248,69 @@ _exit(0); } +/* + * End the DNS resolver child process functions. + */ -static pending_dns_request_t * -gaim_dns_new_resolverthread(gboolean show_debug) +/* + * Begin the functions for dealing with the DNS child processes. + */ +static void +cope_with_gdb_brokenness() { - pending_dns_request_t *req; +#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 */ @@ -258,318 +320,302 @@ return NULL; } - req = g_new(pending_dns_request_t, 1); + resolver = g_new(GaimDnsQueryResolverProcess, 1); + resolver->inpa = 0; cope_with_gdb_brokenness(); - /* Fork! */ - req->dns_pid = fork(); + /* "Go fork and multiply." --Tommy Caldwell (Emily's dad, not the climber) */ + resolver->dns_pid = fork(); /* If we are the child process... */ - if (req->dns_pid == 0) { + 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_dns_resolverthread(child_out[1], child_in[0], show_debug); + 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 (req->dns_pid == -1) { + if (resolver->dns_pid == -1) { gaim_debug_error("dns", "Could not create child process for DNS: %s\n", strerror(errno)); - g_free(req); + gaim_dnsquery_resolver_destroy(resolver); return NULL; } - req->fd_out = child_out[0]; - req->fd_in = child_in[1]; + 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", - req->dns_pid, number_of_dns_children); + resolver->dns_pid, number_of_dns_children); - return req; + return resolver; } -/* - * End the DNS resolver child process functions. - */ -/* - * Begin the functions for dealing with the DNS child processes. +/** + * @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 void -req_free(pending_dns_request_t *req) +static gboolean +send_dns_request_to_child(GaimDnsQueryData *query_data, + GaimDnsQueryResolverProcess *resolver) { - g_return_if_fail(req != NULL); - - close(req->fd_in); - close(req->fd_out); - - g_free(req->host); - g_free(req); - - number_of_dns_children--; -} - -static int -send_dns_request_to_child(pending_dns_request_t *req, dns_params_t *dns_params) -{ + pid_t pid; + dns_params_t dns_params; + int rc; char ch; - int rc; - pid_t pid; /* 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. */ - if ((pid = waitpid (req->dns_pid, NULL, WNOHANG)) > 0) { - gaim_debug_warning("dns", - "DNS child %d no longer exists\n", req->dns_pid); - return -1; + 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", - req->dns_pid, strerror(errno)); - return -1; + gaim_debug_warning("dns", "Wait for DNS child %d failed: %s\n", + resolver->dns_pid, strerror(errno)); + gaim_dnsquery_resolver_destroy(resolver); + return FALSE; } - /* Let's contact this lost child! */ - rc = write(req->fd_in, dns_params, sizeof(*dns_params)); + /* 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", - req->dns_pid, strerror(errno)); - close(req->fd_in); - return -1; + 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); + g_return_val_if_fail(rc == sizeof(dns_params), -1); /* Did you hear me? (This avoids some race conditions) */ - rc = read(req->fd_out, &ch, sizeof(ch)); + 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", - req->dns_pid); - kill(req->dns_pid, SIGKILL); - return -1; + "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", req->dns_pid); + "Successfully sent DNS request to child %d\n", + resolver->dns_pid); - return 0; + query_data->resolver = resolver; + + return TRUE; } -static void -host_resolved(gpointer data, gint source, GaimInputCondition cond); +static void host_resolved(gpointer data, gint source, GaimInputCondition cond); static void -release_dns_child(pending_dns_request_t *req) +handle_next_queued_request() { - g_free(req->host); - req->host = NULL; + GaimDnsQueryData *query_data; + GaimDnsQueryResolverProcess *resolver; - if (queued_requests && !g_queue_is_empty(queued_requests)) { - queued_dns_request_t *r = g_queue_pop_head(queued_requests); - req->host = g_strdup(r->params.hostname); - req->port = r->params.port; - req->callback = r->callback; - req->data = r->data; + if ((queued_requests == NULL) || (g_queue_is_empty(queued_requests))) + /* No more DNS queries, yay! */ + return; - gaim_debug_info("dns", - "Processing queued DNS query for '%s' with child %d\n", - req->host, req->dns_pid); + query_data = g_queue_pop_head(queued_requests); - if (send_dns_request_to_child(req, &(r->params)) != 0) { - req_free(req); - req = NULL; + /* + * 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); - gaim_debug_warning("dns", - "Intent of process queued query of '%s' failed, " - "requeueing...\n", r->params.hostname); - g_queue_push_head(queued_requests, r); - } else { - req->inpa = gaim_input_add(req->fd_out, GAIM_INPUT_READ, host_resolved, req); - g_free(r); + 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; } - } else { - req->host = NULL; - req->callback = NULL; - req->data = NULL; - free_dns_children = g_slist_append(free_dns_children, req); + 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) { - pending_dns_request_t *req = (pending_dns_request_t*)data; + GaimDnsQueryData *query_data; int rc, err; GSList *hosts = NULL; struct sockaddr *addr = NULL; size_t addrlen; + char message[1024]; - gaim_debug_info("dns", "Got response for '%s'\n", req->host); - gaim_input_remove(req->inpa); + query_data = data; - rc = read(req->fd_out, &err, sizeof(err)); + 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)) { - char message[1024]; #ifdef HAVE_GETADDRINFO - g_snprintf(message, sizeof(message), "DNS error: %s (pid=%d)", - gai_strerror(err), req->dns_pid); + g_snprintf(message, sizeof(message), _("Error resolving %s: %s"), + query_data->hostname, gai_strerror(err)); #else - g_snprintf(message, sizeof(message), "DNS error: %d (pid=%d)", - err, req->dns_pid); + g_snprintf(message, sizeof(message), _("Error resolving %s: %d"), + query_data->hostname, err); #endif - gaim_debug_error("dns", "%s\n", message); - req->callback(NULL, req->data, message); - release_dns_child(req); - return; - } - if (rc > 0) - { + gaim_dnsquery_failed(query_data, message); + + } else if (rc > 0) { + /* Success! */ while (rc > 0) { - rc = read(req->fd_out, &addrlen, sizeof(addrlen)); + rc = read(query_data->resolver->fd_out, &addrlen, sizeof(addrlen)); if (rc > 0 && addrlen > 0) { addr = g_malloc(addrlen); - rc = read(req->fd_out, addr, 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) { - char message[1024]; - g_snprintf(message, sizeof(message), "Error reading from DNS child: %s",strerror(errno)); - gaim_debug_error("dns", "%s\n", message); - req->callback(NULL, req->data, message); - req_free(req); - return; + g_snprintf(message, sizeof(message), _("Error reading from resolver process: %s"), strerror(errno)); + gaim_dnsquery_failed(query_data, message); + } else if (rc == 0) { - char message[1024]; - g_snprintf(message, sizeof(message), "EOF reading from DNS child"); - close(req->fd_out); - gaim_debug_error("dns", "%s\n", message); - req->callback(NULL, req->data, message); - req_free(req); - return; + g_snprintf(message, sizeof(message), _("EOF while reading from resolver process")); + gaim_dnsquery_failed(query_data, message); } -/* wait4(req->dns_pid, NULL, WNOHANG, NULL); */ - - req->callback(hosts, req->data, NULL); - - release_dns_child(req); + handle_next_queued_request(); } -/* - * End the functions for dealing with the DNS child processes. - */ -GaimDnsQueryData * -gaim_dnsquery_a(const char *hostname, int port, GaimDnsQueryConnectFunction callback, gpointer data) +static gboolean +resolve_host(gpointer data) { - pending_dns_request_t *req = NULL; - dns_params_t dns_params; - gchar *host_temp; - gboolean show_debug; + GaimDnsQueryData *query_data; - show_debug = gaim_debug_is_enabled(); + query_data = data; + query_data->timeout = 0; - host_temp = g_strstrip(g_strdup(hostname)); - strncpy(dns_params.hostname, host_temp, sizeof(dns_params.hostname) - 1); - g_free(host_temp); - dns_params.hostname[sizeof(dns_params.hostname) - 1] = '\0'; - dns_params.port = port; + handle_next_queued_request(); - /* - * If we have any children, attempt to have them perform the DNS - * query. If we're able to send the query to a child, then req - * will be set to the pending_dns_request_t. Otherwise, req will - * be NULL and we'll need to create a new DNS request child. - */ - while (free_dns_children != NULL) { - req = free_dns_children->data; - free_dns_children = g_slist_remove(free_dns_children, req); + return FALSE; +} - if (send_dns_request_to_child(req, &dns_params) == 0) - /* We found an acceptable child, yay */ - break; +GaimDnsQueryData * +gaim_dnsquery_a(const char *hostname, int port, + GaimDnsQueryConnectFunction callback, gpointer data) +{ + GaimDnsQueryData *query_data; - req_free(req); - req = NULL; - } + g_return_val_if_fail(hostname != NULL, NULL); + g_return_val_if_fail(port != 0, NULL); - /* We need to create a new DNS request child */ - if (req == NULL) { - if (number_of_dns_children >= MAX_DNS_CHILDREN) { - queued_dns_request_t *r = g_new(queued_dns_request_t, 1); - memcpy(&(r->params), &dns_params, sizeof(dns_params)); - r->callback = callback; - r->data = data; - if (!queued_requests) - queued_requests = g_queue_new(); - g_queue_push_tail(queued_requests, r); + 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; - gaim_debug_info("dns", - "DNS query for '%s' queued\n", dns_params.hostname); + if (!queued_requests) + queued_requests = g_queue_new(); + g_queue_push_tail(queued_requests, query_data); - return (GaimDnsQueryData *)1; - } + gaim_debug_info("dns", "DNS query for '%s' queued\n", query_data->hostname); - req = gaim_dns_new_resolverthread(show_debug); - if (req == NULL) - { - gaim_debug_error("proxy", "oh dear, this is going to explode, I give up\n"); - return NULL; - } - send_dns_request_to_child(req, &dns_params); - } + query_data->timeout = gaim_timeout_add(0, resolve_host, query_data); - req->host = g_strdup(hostname); - req->port = port; - req->callback = callback; - req->data = data; - req->inpa = gaim_input_add(req->fd_out, GAIM_INPUT_READ, host_resolved, req); - - return (GaimDnsQueryData *)1; + return query_data; } #elif defined _WIN32 /* end __unix__ || __APPLE__ */ -typedef struct _dns_tdata { - char *hostname; - int port; - GaimDnsQueryConnectFunction callback; - gpointer data; - GSList *hosts; - char *errmsg; -} dns_tdata; +/* + * Windows! + */ -static gboolean dns_main_thread_cb(gpointer data) { - dns_tdata *td = (dns_tdata*)data; - if (td->errmsg != NULL) { - gaim_debug_info("dns", "%s\n", td->errmsg); +static gboolean +dns_main_thread_cb(gpointer data) +{ + GaimDnsQueryData *query_data; + + query_data = data; + + if (query_data->error_message != NULL) + gaim_dnsquery_failed(query_data, query_data->error_message); + else + { + GSList *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); } - td->callback(td->hosts, td->data, td->errmsg); - g_free(td->hostname); - g_free(td->errmsg); - g_free(td); + return FALSE; } -static gpointer dns_thread(gpointer data) { - +static gpointer +dns_thread(gpointer data) +{ + GaimDnsQueryData *query_data; #ifdef HAVE_GETADDRINFO int rc; struct addrinfo hints, *res, *tmp; @@ -578,136 +624,240 @@ struct sockaddr_in sin; struct hostent *hp; #endif - dns_tdata *td = (dns_tdata*)data; + query_data = data; + #ifdef HAVE_GETADDRINFO - g_snprintf(servname, sizeof(servname), "%d", td->port); + g_snprintf(servname, sizeof(servname), "%d", query_data->port); memset(&hints,0,sizeof(hints)); - /* This is only used to convert a service + /* + * 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; - if ((rc = getaddrinfo(td->hostname, servname, &hints, &res)) == 0) { + if ((rc = getaddrinfo(query_data->hostname, servname, &hints, &res)) == 0) { tmp = res; while(res) { - td->hosts = g_slist_append(td->hosts, + query_data->hosts = g_slist_append(query_data->hosts, GSIZE_TO_POINTER(res->ai_addrlen)); - td->hosts = g_slist_append(td->hosts, + query_data->hosts = g_slist_append(query_data->hosts, g_memdup(res->ai_addr, res->ai_addrlen)); res = res->ai_next; } freeaddrinfo(tmp); } else { - td->errmsg = g_strdup_printf("DNS getaddrinfo(\"%s\", \"%s\") error: %d", td->hostname, servname, rc); + query_data->error_message = g_strdup_printf(_("Error resolving %s: %s"), query_data->hostname, gai_strerror(rc)); } #else - if ((hp = gethostbyname(td->hostname))) { + 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(td->port); + sin.sin_port = htons(query_data->port); - td->hosts = g_slist_append(td->hosts, + query_data->hosts = g_slist_append(query_data->hosts, GSIZE_TO_POINTER(sizeof(sin))); - td->hosts = g_slist_append(td->hosts, + query_data->hosts = g_slist_append(query_data->hosts, g_memdup(&sin, sizeof(sin))); } else { - td->errmsg = g_strdup_printf("DNS gethostbyname(\"%s\") error: %d", td->hostname, h_errno); + query_data->error_message = g_strdup_printf(_("Error resolving %s: %d"), query_data->hostname, h_errno); } #endif + /* back to main thread */ - g_idle_add(dns_main_thread_cb, td); + g_idle_add(dns_main_thread_cb, query_data); + return 0; } -GaimDnsQueryData * -gaim_dnsquery_a(const char *hostname, int port, - GaimDnsQueryConnectFunction callback, gpointer data) +static gboolean +resolve_host(gpointer data) { - dns_tdata *td; + GaimDnsQueryData *query_data; struct sockaddr_in sin; - GError* err = NULL; + GError *err = NULL; - if(inet_aton(hostname, &sin.sin_addr)) { + query_data = data; + query_data->timeout = 0; + + if (inet_aton(query_data->hostname, &sin.sin_addr)) + { GSList *hosts = NULL; sin.sin_family = AF_INET; - sin.sin_port = htons(port); + 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))); - callback(hosts, data, NULL); - return (GaimDnsQueryData *)1; + gaim_dnsquery_resolved(query_data, hosts); } + else + { + query_data->resolver = g_thread_create(dns_thread, + query_data, FALSE, &err); + if (query_data->resolver == NULL) + { + char message[1024]; + g_snprintf(message, sizeof(message), _("Thread creation failure: %s"), + err ? err->message : _("Unknown reason")); + g_error_free(err); + gaim_dnsquery_failed(query_data, message); + } + } - gaim_debug_info("dns", "DNS Lookup for: %s\n", hostname); - td = g_new0(dns_tdata, 1); - td->hostname = g_strdup(hostname); - td->port = port; - td->callback = callback; - td->data = data; + return FALSE; +} - if(!g_thread_create(dns_thread, td, FALSE, &err)) { - gaim_debug_error("dns", "DNS thread create failure: %s\n", err?err->message:""); - g_error_free(err); - g_free(td->hostname); - g_free(td); - return NULL; - } - return (GaimDnsQueryData *)1; +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->error_message = NULL; + query_data->hosts = NULL; + + /* Don't call the callback before returning */ + query_data->timeout = gaim_timeout_add(0, resolve_host, query_data); + + return query_data; } #else /* not __unix__ or __APPLE__ or _WIN32 */ -typedef struct { - gpointer data; - size_t addrlen; - struct sockaddr *addr; - GaimDnsQueryConnectFunction callback; -} pending_dns_request_t; +/* + * We weren't able to do anything fancier above, so use the + * fail-safe name resolution code, which is blocking. + */ -static gboolean host_resolved(gpointer data) +static gboolean +resolve_host(gpointer data) { - pending_dns_request_t *req = (pending_dns_request_t*)data; + GaimDnsQueryData *query_data; + struct sockaddr_in sin; GSList *hosts = NULL; - hosts = g_slist_append(hosts, GINT_TO_POINTER(req->addrlen)); - hosts = g_slist_append(hosts, req->addr); - req->callback(hosts, req->data, NULL); - g_free(req); - return FALSE; -} -GaimDnsQueryData * -gaim_dnsquery_a(const char *hostname, int port, - GaimDnsQueryConnectFunction callback, gpointer data) -{ - struct sockaddr_in sin; - pending_dns_request_t *req; + query_data = data; + query_data->timeout = 0; - if (!inet_aton(hostname, &sin.sin_addr)) { + if (!inet_aton(query_data->hostname, &sin.sin_addr)) { struct hostent *hp; - if(!(hp = gethostbyname(hostname))) { - gaim_debug_error("dns", - "gaim_gethostbyname(\"%s\", %d) failed: %d\n", - hostname, port, h_errno); - return NULL; + 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(port); + sin.sin_port = htons(query_data->port); - req = g_new(pending_dns_request_t, 1); - req->addr = (struct sockaddr*) g_memdup(&sin, sizeof(sin)); - req->addrlen = sizeof(sin); - req->data = data; - req->callback = callback; - gaim_timeout_add(10, host_resolved, req); - return (GaimDnsQueryData *)1; + 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 + * just set the callback to NULL and let the DNS lookup + * finish. + */ + query_data->callback = NULL; + return; + } + + while (query_data->hosts != NULL) + { + /* Discard the length... */ + query_data->hosts = g_slist_remove(query_data->hosts, query_data->hosts->data); + /* Free the address... */ + g_free(query_data->hosts->data); + 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); + + g_free(query_data->hostname); + g_free(query_data); +} + +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 +} Modified: trunk/libgaim/dnsquery.h =================================================================== --- trunk/libgaim/dnsquery.h 2006-08-20 22:16:13 UTC (rev 16919) +++ trunk/libgaim/dnsquery.h 2006-08-20 22:24:13 UTC (rev 16920) @@ -32,7 +32,8 @@ /** * The "hosts" parameter is a linked list containing pairs of - * one size_t addrlen and one struct sockaddr *addr. + * one size_t addrlen and one struct sockaddr *addr. It should + * be free'd by the callback function. */ typedef void (*GaimDnsQueryConnectFunction)(GSList *hosts, gpointer data, const char *error_message); @@ -49,12 +50,12 @@ /*@{*/ /** - * Do an async dns query + * Perform an asynchronous DNS query. * - * @param hostname The hostname to resolve - * @param port A portnumber which is stored in the struct sockaddr - * @param callback Callback to call after resolving - * @param data Extra data for the callback function + * @param hostname The hostname to resolve. + * @param port A port number which is stored in the struct sockaddr. + * @param callback The callback function to call after resolving. + * @param data Extra data to pass to the callback function. * * @return NULL if there was an error, otherwise return a reference to * a data structure that can be used to cancel the pending @@ -62,6 +63,24 @@ */ GaimDnsQueryData *gaim_dnsquery_a(const char *hostname, int port, GaimDnsQueryConnectFunction callback, gpointer data); +/** + * Cancel a DNS query and destroy the associated data structure. + * + * @param query_data The DNS query to cancel. This data structure + * is freed by this function. + */ +void gaim_dnsquery_destroy(GaimDnsQueryData *query_data); + +/** + * Initializes the DNS query subsystem. + */ +void gaim_dnsquery_init(void); + +/** + * Uninitializes the DNS query subsystem. + */ +void gaim_dnsquery_uninit(void); + /*@}*/ #ifdef __cplusplus Modified: trunk/libgaim/protocols/simple/simple.c =================================================================== --- trunk/libgaim/protocols/simple/simple.c 2006-08-20 22:16:13 UTC (rev 16919) +++ trunk/libgaim/protocols/simple/simple.c 2006-08-20 22:24:13 UTC (rev 16920) @@ -1527,6 +1527,8 @@ struct simple_account_data *sip = (struct simple_account_data*) data; int addr_size; + sip->query_data = NULL; + if (!hosts || !hosts->data) { gaim_connection_error(sip->gc, _("Couldn't resolve host")); return; @@ -1622,7 +1624,10 @@ } else { /* UDP */ gaim_debug_info("simple", "using udp with server %s and port %d\n", hostname, port); - gaim_dnsquery_a(hostname, port, simple_udp_host_resolved, sip); + sip->query_data = gaim_dnsquery_a(hostname, port, simple_udp_host_resolved, sip); + if (sip->query_data == NULL) { + gaim_connection_error(sip->gc, _("Could not resolve hostname")); + } } } @@ -1689,6 +1694,9 @@ do_register_exp(sip, 0); connection_free_all(sip); + if (sip->query_data != NULL) + gaim_dnsquery_destroy(sip->query_data); + g_free(sip->servername); g_free(sip->username); g_free(sip->password); Modified: trunk/libgaim/protocols/simple/simple.h =================================================================== --- trunk/libgaim/protocols/simple/simple.h 2006-08-20 22:16:13 UTC (rev 16919) +++ trunk/libgaim/protocols/simple/simple.h 2006-08-20 22:24:13 UTC (rev 16920) @@ -28,6 +28,7 @@ #include "cipher.h" #include "circbuffer.h" +#include "dnsquery.h" #include "prpl.h" #include "sipmsg.h" @@ -69,6 +70,7 @@ gchar *servername; gchar *username; gchar *password; + GaimDnsQueryData *query_data; int fd; int cseq; time_t reregister; Modified: trunk/libgaim/proxy.c =================================================================== --- trunk/libgaim/proxy.c 2006-08-20 22:16:13 UTC (rev 16919) +++ trunk/libgaim/proxy.c 2006-08-20 22:24:13 UTC (rev 16920) @@ -309,6 +309,9 @@ connect_infos = g_slist_remove(connect_infos, connect_info); + if (connect_info->query_data != NULL) + gaim_dnsquery_destroy(connect_info->query_data); + while (connect_info->hosts != NULL) { /* Discard the length... */ @@ -1571,13 +1574,18 @@ { GaimProxyConnectInfo *connect_info; + connect_info = data; + connect_info->query_data = NULL; + if (error_message != NULL) { - gaim_debug_info("proxy", "Error while resolving hostname: %s\n", error_message); - /* TODO: Destroy connect_info and return? */ + gchar *tmp; + tmp = g_strdup_printf("Error while resolving hostname: %s\n", error_message); + gaim_proxy_connect_info_error(connect_info, tmp); + g_free(tmp); + return; } - connect_info = data; connect_info->hosts = hosts; try_connect(connect_info); @@ -1821,10 +1829,6 @@ proxy_pref_cb, NULL); gaim_prefs_connect_callback(handle, "/core/proxy/password", proxy_pref_cb, NULL); -#ifdef _WIN32 - if(!g_thread_supported()) - g_thread_init(NULL); -#endif } void This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-08-20 22:16:19
|
Revision: 16919 Author: markhuetsch Date: 2006-08-20 15:16:13 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16919&view=rev Log Message: ----------- Enhancements for easier protocol testing. Not much use until I can figure out the new QQ login scheme :-/ Modified Paths: -------------- trunk/libgaim/protocols/qq/qq.c trunk/libgaim/protocols/qq/utils.c Modified: trunk/libgaim/protocols/qq/qq.c =================================================================== --- trunk/libgaim/protocols/qq/qq.c 2006-08-20 21:37:45 UTC (rev 16918) +++ trunk/libgaim/protocols/qq/qq.c 2006-08-20 22:16:13 UTC (rev 16919) @@ -40,6 +40,7 @@ #include "buddy_opt.h" #include "buddy_status.h" #include "char_conv.h" +#include "crypt.h" #include "group.h" #include "group_find.h" #include "group_im.h" @@ -582,22 +583,26 @@ } */ +/* attempt to output the value and byte length of a given field */ +/* static gboolean _qq_parse_custom_packet_field(GaimRequestFields *fields, - const gchar *id, guint8 **value) + const gchar *id, guint8 **value, gint *len, gboolean allow_null) { GaimRequestField *field; const gchar *str; - gint len, i; + gint i; gboolean success; success = FALSE; field = gaim_request_fields_get_field(fields, id); str = gaim_request_field_string_get_value(field); - if (str) { + if (!str && allow_null) { + return TRUE; + } else if (str) { success = TRUE; if (strcmp(id, "uid") != 0) { - *value = hex_str_to_bytes(str, &len); - if (!*value || len != 2) + *value = hex_str_to_bytes(str, len); + if (!*value) success = FALSE; } else { for (i = 0; i < strlen(str); i++) { @@ -617,64 +622,84 @@ gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Invalid entry: %s\n", id); return success; } +*/ +/* attempt to output the field values and body length */ +/* static gboolean _qq_parse_custom_packet_fields(GaimRequestFields *fields, guint8 **client, guint8 **cmd, guint8 **seq, guint32 *uid, - guint8 **body, gint *body_len) + guint8 **body, guint8 **key, gint *body_len) { - GaimRequestField *field; + gint len; gboolean success; - success = TRUE; - *client = *cmd = *seq = *body = NULL; - *uid = 0; - success = _qq_parse_custom_packet_field(fields, "client", client); - if (success) - success = _qq_parse_custom_packet_field(fields, "cmd", cmd); - if (success) - success = _qq_parse_custom_packet_field(fields, "uid", (guint8 **) uid); - if (success) - success = _qq_parse_custom_packet_field(fields, "seq", seq); - if (success) { - field = gaim_request_fields_get_field(fields, "body"); - *body = hex_str_to_bytes(gaim_request_field_string_get_value(field), - body_len); - } else { + success = FALSE; + *client = *cmd = *seq = *body = *key = NULL; + *uid = *body_len = 0; + if ((_qq_parse_custom_packet_field(fields, "client", client, &len, FALSE) + && len == 2 + && _qq_parse_custom_packet_field(fields, "cmd", cmd, &len, FALSE) + && len == 2 + && _qq_parse_custom_packet_field(fields, "uid", (guint8 **) uid, &len, FALSE) + && _qq_parse_custom_packet_field(fields, "seq", seq, &len, FALSE) + && len == 2 + && _qq_parse_custom_packet_field(fields, "body", body, body_len, TRUE))) { + if (*body_len > MAX_PACKET_SIZE / 8) { + g_free(*client); + g_free(*cmd); + g_free(*seq); + g_free(*body); + return FALSE; + } + if (!gaim_request_fields_get_bool(fields, "encrypt")) + return TRUE; + else + success = _qq_parse_custom_packet_field(fields, + "key", key, &len, FALSE) + && len == 16 + && *body_len > 0; + } + if (!success) { if (*client) g_free(*client); if (*cmd) g_free(*cmd); if (*seq) g_free(*seq); + if (*key) + g_free(*key); + return FALSE; } - return success; + return TRUE; } +*/ +/* parses the request fields and attempts to send the packet */ +/* static void _qq_send_custom_packet_cb(GaimConnection *gc, GaimRequestFields *fields) { guint32 uid; - guint8 *buf, *client, *cmd, *seq, *body, *cursor; - gint bytes, len; + guint8 *buf, *client, *cmd, *seq, *body, *encr_body, *key, *cursor; + gint bytes, len, encr_len; qq_data *qd; gboolean success; qd = (qq_data *) gc->proto_data; success = _qq_parse_custom_packet_fields(fields, &client, &cmd, - &seq, &uid, &body, &len); + &seq, &uid, &body, &key, &len); if (!success) { - gaim_notify_error(gc, _("Error"), _("Invalid packet entry"), NULL); + gaim_notify_error(gc, _("Error"), _("Invalid entry"), NULL); return; } - if (body) - g_return_if_fail(len+12 <= MAX_PACKET_SIZE); - bytes = 0; buf = g_newa(guint8, MAX_PACKET_SIZE); cursor = buf; +*/ /* QQ TCP packet has two bytes in the beginning to define packet length * so I leave room here for size */ +/* if (qd->use_tcp) bytes += create_packet_w(buf, &cursor, 0x0000); bytes += create_packet_b(buf, &cursor, QQ_PACKET_TAG); @@ -683,7 +708,17 @@ bytes += create_packet_w(buf, &cursor, *(guint16 *) seq); bytes += create_packet_dw(buf, &cursor, uid); if (body) { - bytes += create_packet_data(buf, &cursor, body, len); + if (gaim_request_fields_get_bool(fields, "encrypt")) { + if (gaim_request_fields_get_bool(fields, "prepend")) + bytes += create_packet_data(buf, &cursor, key, 16); + encr_body = g_newa(guint8, MAX_PACKET_SIZE); + qq_crypt(ENCRYPT, body, len, key, encr_body, &encr_len); + bytes += create_packet_data(buf, &cursor, encr_body, encr_len); + g_free(key); + } else { + bytes += create_packet_data(buf, &cursor, body, len); + } + g_free(body); } bytes += create_packet_b(buf, &cursor, QQ_PACKET_TAIL); @@ -696,8 +731,10 @@ g_free(cmd); g_free(seq); } +*/ /* send a custom packet to the server - for protocol testing */ +/* static void _qq_menu_send_custom_packet(GaimPluginAction *action) { GaimConnection *gc; @@ -712,7 +749,7 @@ g_return_if_fail(gc != NULL && qd != NULL); fields = gaim_request_fields_new(); - group = gaim_request_field_group_new(_("Packet Elements")); + group = gaim_request_field_group_new(_("Basic Elements")); gaim_request_fields_add_group(fields, group); tmp = g_strdup_printf("%04X", QQ_CLIENT); field = gaim_request_field_string_new("client", _("Client (hex)"), tmp, FALSE); @@ -726,15 +763,25 @@ field = gaim_request_field_string_new("uid", _("QQ Number (decimal)"), tmp, FALSE); g_free(tmp); gaim_request_field_group_add_field(group, field); - field = gaim_request_field_string_new("body", _("Body (hex)"), NULL, FALSE); + field = gaim_request_field_string_new("body", _("Body (hex)"), NULL, TRUE); gaim_request_field_group_add_field(group, field); + group = gaim_request_field_group_new(_("Encryption")); + gaim_request_fields_add_group(fields, group); + field = gaim_request_field_bool_new("encrypt", _("Encrypt Packet Body"), FALSE); + gaim_request_field_group_add_field(group, field); + field = gaim_request_field_bool_new("prepend", _("Prepend Key to Body"), FALSE); + gaim_request_field_group_add_field(group, field); + field = gaim_request_field_string_new("key", _("Encryption Key (hex)"), NULL, FALSE); + gaim_request_field_group_add_field(group, field); + gaim_request_fields(gc, _("Send a custom packet"), _("Send a custom packet"), NULL, fields, _("Send"), G_CALLBACK(_qq_send_custom_packet_cb), _("Cancel"), NULL, gc); } +*/ /* protocol related menus */ static GList *_qq_actions(GaimPlugin *plugin, gpointer context) @@ -752,10 +799,10 @@ act = gaim_plugin_action_new(_("Show Login Information"), _qq_menu_show_login_info); m = g_list_append(m, act); - /* +/* act = gaim_plugin_action_new(_("Send Custom Packet"), _qq_menu_send_custom_packet); m = g_list_append(m, act); - */ +*/ /* XXX consider re-enabling this act = gaim_plugin_action_new(_("Show System Message"), _qq_menu_show_system_message); Modified: trunk/libgaim/protocols/qq/utils.c =================================================================== --- trunk/libgaim/protocols/qq/utils.c 2006-08-20 21:37:45 UTC (rev 16918) +++ trunk/libgaim/protocols/qq/utils.c 2006-08-20 22:16:13 UTC (rev 16919) @@ -190,16 +190,16 @@ static gchar *strstrip(const gchar *const buffer) { GString *stripped; - gchar *ret; - int i; + gchar *ret, cur; + gint i; g_return_val_if_fail(buffer != NULL, NULL); stripped = g_string_new(""); for (i=0; i<strlen(buffer); i++) { - if ((int) buffer[i] != 32) { + cur = buffer[i]; + if (cur != ' ' && cur != '\n') g_string_append_c(stripped, buffer[i]); - } } ret = stripped->str; g_string_free(stripped, FALSE); @@ -236,7 +236,7 @@ nibble1 = (gint) *cursor - 87; } else { gaim_debug(GAIM_DEBUG_WARNING, "QQ", - "Invalid char found in hex string!\n"); + "Invalid char \'%c\' found in hex string!\n", *cursor); g_free(hex_str); return NULL; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-08-20 21:37:51
|
Revision: 16918 Author: markhuetsch Date: 2006-08-20 14:37:45 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16918&view=rev Log Message: ----------- Const-correctness to eliminate some warnings. Modified Paths: -------------- trunk/libgaim/protocols/qq/crypt.c trunk/libgaim/protocols/qq/crypt.h trunk/libgaim/protocols/qq/utils.c trunk/libgaim/protocols/qq/utils.h Modified: trunk/libgaim/protocols/qq/crypt.c =================================================================== --- trunk/libgaim/protocols/qq/crypt.c 2006-08-20 20:14:12 UTC (rev 16917) +++ trunk/libgaim/protocols/qq/crypt.c 2006-08-20 21:37:45 UTC (rev 16918) @@ -49,10 +49,9 @@ * encryption *******************************************************************/ -/* TODO: convert these data types to proper glib ones */ -static void qq_encipher(unsigned long *const v, const unsigned long *const k, unsigned long *const w) +static void qq_encipher(guint32 *const v, const guint32 *const k, guint32 *const w) { - register unsigned long y = ntohl(v[0]), + register guint32 y = ntohl(v[0]), z = ntohl(v[1]), a = ntohl(k[0]), b = ntohl(k[1]), @@ -72,13 +71,14 @@ w[1] = htonl(z); } -static int rand(void) { /* it can be the real random seed function */ +static gint rand(void) { /* it can be the real random seed function */ return 0xdead; } /* override with number, convenient for debug */ -/* we encrypt every eight byte block */ -static void encrypt_every_8_byte(unsigned char *plain, unsigned char *plain_pre_8, unsigned char **crypted, - unsigned char **crypted_pre_8, unsigned char *key, int *count, int *pos_in_byte, int *is_header) +/* we encrypt every eight byte chunk */ +static void encrypt_every_8_byte(guint8 *plain, guint8 *plain_pre_8, guint8 **crypted, + guint8 **crypted_pre_8, const guint8 *const key, gint *count, + gint *pos_in_byte, gint *is_header) { /* prepare plain text */ for (*pos_in_byte = 0; *pos_in_byte < 8; (*pos_in_byte)++) { @@ -89,7 +89,7 @@ } } /* encrypt it */ - qq_encipher((unsigned long *) plain, (unsigned long *) key, (unsigned long *) *crypted); + qq_encipher((guint32 *) plain, (guint32 *) key, (guint32 *) *crypted); for (*pos_in_byte = 0; *pos_in_byte < 8; (*pos_in_byte)++) { (*crypted)[*pos_in_byte] ^= plain_pre_8[*pos_in_byte]; @@ -104,15 +104,16 @@ } /* encrypt_every_8_byte */ -static void qq_encrypt(unsigned char *instr, int instrlen, unsigned char *key, - unsigned char *outstr, int *outstrlen_prt) +static void qq_encrypt(const guint8 *const instr, gint instrlen, + const guint8 *const key, + guint8 *outstr, gint *outstrlen_prt) { - unsigned char plain[8], /* plain text buffer */ + guint8 plain[8], /* plain text buffer */ plain_pre_8[8], /* plain text buffer, previous 8 bytes */ *crypted, /* crypted text */ - *crypted_pre_8, /* crypted test, previous 8 bytes */ - *inp; /* current position in instr */ - int pos_in_byte = 1, /* loop in the byte */ + *crypted_pre_8; /* crypted test, previous 8 bytes */ + const guint8 *inp; /* current position in instr */ + gint pos_in_byte = 1, /* loop in the byte */ is_header = 1, /* header is one byte */ count = 0, /* number of bytes being crypted */ padding = 0; /* number of padding stuff */ @@ -135,7 +136,8 @@ padding++; } if (pos_in_byte == 8) { - encrypt_every_8_byte(plain, plain_pre_8, &crypted, &crypted_pre_8, key, &count, &pos_in_byte, &is_header); + encrypt_every_8_byte(plain, plain_pre_8, &crypted, &crypted_pre_8, + key, &count, &pos_in_byte, &is_header); } } @@ -146,7 +148,8 @@ instrlen--; } if (pos_in_byte == 8) { - encrypt_every_8_byte(plain, plain_pre_8, &crypted, &crypted_pre_8, key, &count, &pos_in_byte, &is_header); + encrypt_every_8_byte(plain, plain_pre_8, &crypted, &crypted_pre_8, + key, &count, &pos_in_byte, &is_header); } } @@ -157,7 +160,8 @@ padding++; } if (pos_in_byte == 8) { - encrypt_every_8_byte(plain, plain_pre_8, &crypted, &crypted_pre_8, key, &count, &pos_in_byte, &is_header); + encrypt_every_8_byte(plain, plain_pre_8, &crypted, &crypted_pre_8, + key, &count, &pos_in_byte, &is_header); } } @@ -169,9 +173,9 @@ * decryption ********************************************************************/ -static void qq_decipher(unsigned long *const v, const unsigned long *const k, unsigned long *const w) +static void qq_decipher(guint32 *const v, const guint32 *const k, guint32 *const w) { - register unsigned long y = ntohl(v[0]), + register guint32 y = ntohl(v[0]), z = ntohl(v[1]), a = ntohl(k[0]), b = ntohl(k[1]), @@ -192,15 +196,16 @@ w[1] = htonl(z); } -static int decrypt_every_8_byte(unsigned char **crypt_buff, const int instrlen, const unsigned char * const key, - int *context_start, unsigned char *decrypted, int *pos_in_byte) +static gint decrypt_every_8_byte(const guint8 **crypt_buff, const gint instrlen, + const guint8 *const key, gint *context_start, + guint8 *decrypted, gint *pos_in_byte) { for (*pos_in_byte = 0; *pos_in_byte < 8; (*pos_in_byte)++) { if (*context_start + *pos_in_byte >= instrlen) return 1; decrypted[*pos_in_byte] ^= (*crypt_buff)[*pos_in_byte]; } - qq_decipher((unsigned long *) decrypted, (unsigned long *) key, (unsigned long *) decrypted); + qq_decipher((guint32 *) decrypted, (guint32 *) key, (guint32 *) decrypted); *context_start += 8; *crypt_buff += 8; @@ -210,25 +215,29 @@ } /* return 0 if failed, 1 otherwise */ -static int qq_decrypt(unsigned char *instr, int instrlen, unsigned char *key, - unsigned char *outstr, int *outstrlen_ptr) +static gint qq_decrypt(const guint8 *const instr, gint instrlen, + const guint8 *const key, + guint8 *outstr, gint *outstrlen_ptr) { - unsigned char decrypted[8], m[8], *crypt_buff, *crypt_buff_pre_8, *outp; - int count, context_start, pos_in_byte, padding; + guint8 decrypted[8], m[8], *outp; + const guint8 *crypt_buff, *crypt_buff_pre_8; + gint count, context_start, pos_in_byte, padding; /* at least 16 bytes and %8 == 0 */ if ((instrlen % 8) || (instrlen < 16)) { gaim_debug(GAIM_DEBUG_ERROR, "QQ", - "Packet len is either too short or not a multiple of 8 bytes, read %d bytes\n", instrlen); + "Packet len is either too short or not a multiple of 8 bytes, read %d bytes\n", + instrlen); return 0; } /* get information from header */ - qq_decipher((unsigned long *) instr, (unsigned long *) key, (unsigned long *) decrypted); + qq_decipher((guint32 *) instr, (guint32 *) key, (guint32 *) decrypted); pos_in_byte = decrypted[0] & 0x7; count = instrlen - pos_in_byte - 10; /* this is the plaintext length */ /* return if outstr buffer is not large enough or error plaintext length */ if (*outstrlen_ptr < count || count < 0) { - gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Buffer len %d is less than real len %d", *outstrlen_ptr, count); + gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Buffer len %d is less than real len %d", + *outstrlen_ptr, count); return 0; } @@ -248,7 +257,8 @@ } if (pos_in_byte == 8) { crypt_buff_pre_8 = instr; - if (!decrypt_every_8_byte(&crypt_buff, instrlen, key, &context_start, decrypted, &pos_in_byte)) { + if (!decrypt_every_8_byte(&crypt_buff, instrlen, key, + &context_start, decrypted, &pos_in_byte)) { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "decrypt every 8 bytes error A"); return 0; } @@ -265,7 +275,8 @@ } if (pos_in_byte == 8) { crypt_buff_pre_8 = crypt_buff - 8; - if (!decrypt_every_8_byte(&crypt_buff, instrlen, key, &context_start, decrypted, &pos_in_byte)) { + if (!decrypt_every_8_byte(&crypt_buff, instrlen, key, + &context_start, decrypted, &pos_in_byte)) { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "decrypt every 8 bytes error B"); return 0; } @@ -280,7 +291,8 @@ } if (pos_in_byte == 8) { crypt_buff_pre_8 = crypt_buff; - if (!decrypt_every_8_byte(&crypt_buff, instrlen, key, &context_start, decrypted, &pos_in_byte)) { + if (!decrypt_every_8_byte(&crypt_buff, instrlen, key, + &context_start, decrypted, &pos_in_byte)) { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "decrypt every 8 bytes error C"); return 0; } @@ -289,10 +301,11 @@ return 1; } -/* This is the Public Function */ /* return 1 is succeed, otherwise return 0 */ -int qq_crypt(unsigned char flag, - unsigned char *instr, int instrlen, unsigned char *key, unsigned char *outstr, int *outstrlen_ptr) +gint qq_crypt(gint flag, + const guint8 *const instr, gint instrlen, + const guint8 *const key, + guint8 *outstr, gint *outstrlen_ptr) { if (flag == DECRYPT) return qq_decrypt(instr, instrlen, key, outstr, outstrlen_ptr); Modified: trunk/libgaim/protocols/qq/crypt.h =================================================================== --- trunk/libgaim/protocols/qq/crypt.h 2006-08-20 20:14:12 UTC (rev 16917) +++ trunk/libgaim/protocols/qq/crypt.h 2006-08-20 21:37:45 UTC (rev 16918) @@ -23,10 +23,14 @@ #ifndef _QQ_CRYPT_H_ #define _QQ_CRYPT_H_ +#include <glib.h> + #define DECRYPT 0x00 #define ENCRYPT 0x01 -int qq_crypt(unsigned char flag, - unsigned char *instr, int instrlen, unsigned char *key, unsigned char *outstr, int *outstrlen_ptr); +gint qq_crypt(gint flag, + const guint8 *const instr, gint instrlen, + const guint8 *const key, + guint8 *outstr, gint *outstrlen_ptr); #endif Modified: trunk/libgaim/protocols/qq/utils.c =================================================================== --- trunk/libgaim/protocols/qq/utils.c 2006-08-20 20:14:12 UTC (rev 16917) +++ trunk/libgaim/protocols/qq/utils.c 2006-08-20 21:37:45 UTC (rev 16918) @@ -125,7 +125,8 @@ guint8 *str_ip_gen(gchar *str) { guint8 *ip = g_new(guint8, 4); - int a, b, c, d; + gint a, b, c, d; + sscanf(str, "%d.%d.%d.%d", &a, &b, &c, &d); ip[0] = a; ip[1] = b; @@ -149,7 +150,7 @@ } /* convert GAIM name to original QQ UID */ -guint32 gaim_name_to_uid(const gchar *name) +guint32 gaim_name_to_uid(const gchar *const name) { gchar *p; @@ -160,7 +161,7 @@ } /* try to dump the data as GBK */ -void try_dump_as_gbk(guint8 *data, gint len) +void try_dump_as_gbk(const guint8 *const data, gint len) { gint i; guint8 *incoming; @@ -186,7 +187,7 @@ } /* strips whitespace */ -static gchar *strstrip(const gchar *buffer) +static gchar *strstrip(const gchar *const buffer) { GString *stripped; gchar *ret; @@ -206,10 +207,9 @@ return ret; } -/* Dumps an ASCII hex string to a string of bytes. The return should be freed later. - * Returns NULL if a string with an odd number of nibbles is passed in or if buffer - * isn't a valid hex string */ -guint8 *hex_str_to_bytes(const gchar *buffer, gint *out_len) +/* Attempts to dump an ASCII hex string to a string of bytes. + * The return should be freed later. */ +guint8 *hex_str_to_bytes(const gchar *const buffer, gint *out_len) { gchar *hex_str, *hex_buffer, *cursor, tmp; guint8 *bytes, nibble1, nibble2; @@ -259,8 +259,9 @@ return g_memdup(bytes, *out_len); } -/* Dumps a chunk of raw data into an ASCII hex string. The return should be freed later. */ -gchar *hex_dump_to_str(const guint8 *buffer, gint bytes) +/* Dumps a chunk of raw data into an ASCII hex string. + * The return should be freed later. */ +gchar *hex_dump_to_str(const guint8 *const buffer, gint bytes) { GString *str; gchar *ret; Modified: trunk/libgaim/protocols/qq/utils.h =================================================================== --- trunk/libgaim/protocols/qq/utils.h 2006-08-20 20:14:12 UTC (rev 16917) +++ trunk/libgaim/protocols/qq/utils.h 2006-08-20 21:37:45 UTC (rev 16918) @@ -41,7 +41,7 @@ gchar *get_icon_name(gint set, gint suffix); -void try_dump_as_gbk(guint8 *data, gint len); +void try_dump_as_gbk(const guint8 *const data, gint len); guint8 *hex_str_to_bytes(const gchar *buf, gint *out_len); gchar *hex_dump_to_str(const guint8 *buf, gint buf_len); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rl...@us...> - 2006-08-20 20:14:21
|
Revision: 16917 Author: rlaager Date: 2006-08-20 13:14:12 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16917&view=rev Log Message: ----------- * Enable the log reader plugin. I'm really going to try to work on this some more, but making it available (with a warning) will help shame me into fixing it. * De-activate the stub loggers in the log reader plugin for Fire and Messenger Plus! * Fix up logs of svn:ignore properties so that svn status comes up clean. Modified Paths: -------------- trunk/gaim-installer.nsi trunk/libgaim/plugins/Makefile.am trunk/libgaim/plugins/Makefile.mingw Added Paths: ----------- trunk/libgaim/plugins/log_reader.c Removed Paths: ------------- trunk/gtk/plugins/log_reader.c Property Changed: ---------------- trunk/ trunk/console/libgnt/ trunk/gtk/ trunk/gtk/plugins/ trunk/libgaim/ trunk/libgaim/plugins/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - ABOUT-NLS aclocal.m4 autom4te.cache compile confdefs.h config.cache config.guess config.h config.h.in config.h.in~ config.log config.status config.sub configure configure.2.1x depcomp Doxyfile gaim.apspec gaim.desktop gaim.pc gaim.service gaim.spec install-sh intl intltool-extract intltool-extract.in intltool-merge intltool-merge.in intltool-update intltool-update.in libtool ltconfig ltmain.sh Makefile Makefile.in missing stamp-h stamp-h1 stamp-h.in *.swp .temp-gettextize win32-install-dir gaim-*.exe + ABOUT-NLS aclocal.m4 autom4te.cache compile confdefs.h config.cache config.guess config.h config.h.in config.h.in~ config.log config.status config.sub configure configure.2.1x depcomp Doxyfile gaim.apspec gaim.desktop gaim.pc gaim.service gaim.spec install-sh intl intltool-extract intltool-extract.in intltool-merge intltool-merge.in intltool-update intltool-update.in libtool ltconfig ltmain.sh Makefile Makefile.in missing mkinstalldirs stamp-h stamp-h1 stamp-h.in *.swp .temp-gettextize win32-install-dir gaim-*.exe Property changes on: trunk/console/libgnt ___________________________________________________________________ Name: svn:ignore - Makefile.in .deps .libs + .deps gnt.pc .libs Makefile Makefile.in Modified: trunk/gaim-installer.nsi =================================================================== --- trunk/gaim-installer.nsi 2006-08-20 19:37:33 UTC (rev 16916) +++ trunk/gaim-installer.nsi 2006-08-20 20:14:12 UTC (rev 16917) @@ -717,6 +717,7 @@ Delete "$INSTDIR\plugins\libsimple.dll" Delete "$INSTDIR\plugins\libtoc.dll" Delete "$INSTDIR\plugins\libyahoo.dll" + Delete "$INSTDIR\plugins\log_reader.dll" Delete "$INSTDIR\plugins\notify.dll" Delete "$INSTDIR\plugins\perl.dll" Delete "$INSTDIR\plugins\psychic.dll" Property changes on: trunk/gtk ___________________________________________________________________ Name: svn:ignore - Makefile.in .deps Makefile *.dll gtkgaim.dll.a *.exe + .deps gaim gtkgaim.dll.a .libs Makefile Makefile.in *.dll *.exe Property changes on: trunk/gtk/plugins ___________________________________________________________________ Name: svn:ignore - Makefile.in .deps Makefile *.dll + .deps .libs Makefile Makefile.in *.dll Deleted: trunk/gtk/plugins/log_reader.c =================================================================== --- trunk/gtk/plugins/log_reader.c 2006-08-20 19:37:33 UTC (rev 16916) +++ trunk/gtk/plugins/log_reader.c 2006-08-20 20:14:12 UTC (rev 16917) @@ -1,2008 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdio.h> - -#ifndef GAIM_PLUGINS -# define GAIM_PLUGINS -#endif - -#include "internal.h" - -#include "debug.h" -#include "log.h" -#include "plugin.h" -#include "pluginpref.h" -#include "prefs.h" -#include "stringref.h" -#include "util.h" -#include "version.h" -#include "xmlnode.h" - -/* This must be the last Gaim header included. */ -#ifdef _WIN32 -#include "win32dep.h" -#endif - -/* Where is the Windows partition mounted? */ -#ifndef GAIM_LOG_READER_WINDOWS_MOUNT_POINT -#define GAIM_LOG_READER_WINDOWS_MOUNT_POINT "/mnt/windows" -#endif - -enum name_guesses { - NAME_GUESS_UNKNOWN, - NAME_GUESS_ME, - NAME_GUESS_THEM -}; - - -/***************************************************************************** - * Adium Logger * - *****************************************************************************/ - -/* The adium logger doesn't write logs, only reads them. This is to include - * Adium logs in the log viewer transparently. - */ - -static GaimLogLogger *adium_logger; - -enum adium_log_type { - ADIUM_HTML, - ADIUM_TEXT, -}; - -struct adium_logger_data { - char *path; - enum adium_log_type type; -}; - -static GList *adium_logger_list(GaimLogType type, const char *sn, GaimAccount *account) -{ - GList *list = NULL; - const char *logdir; - GaimPlugin *plugin; - GaimPluginProtocolInfo *prpl_info; - char *prpl_name; - char *temp; - char *path; - GDir *dir; - - g_return_val_if_fail(sn != NULL, list); - g_return_val_if_fail(account != NULL, list); - - logdir = gaim_prefs_get_string("/plugins/core/log_reader/adium/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!*logdir) - return list; - - plugin = gaim_find_prpl(gaim_account_get_protocol_id(account)); - if (!plugin) - return NULL; - - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); - if (!prpl_info->list_icon) - return NULL; - - prpl_name = g_ascii_strup(prpl_info->list_icon(account, NULL), -1); - - temp = g_strdup_printf("%s.%s", prpl_name, account->username); - path = g_build_filename(logdir, temp, sn, NULL); - g_free(temp); - - dir = g_dir_open(path, 0, NULL); - if (dir) { - const gchar *file; - - while ((file = g_dir_read_name(dir))) { - if (!gaim_str_has_prefix(file, sn)) - continue; - if (gaim_str_has_suffix(file, ".html") || gaim_str_has_suffix(file, ".AdiumHTMLLog")) { - struct tm tm; - const char *date = file; - - date += strlen(sn) + 2; - if (sscanf(date, "%u|%u|%u", - &tm.tm_year, &tm.tm_mon, &tm.tm_mday) != 3) { - - gaim_debug(GAIM_DEBUG_ERROR, "Adium log parse", - "Filename timestamp parsing error\n"); - } else { - char *filename = g_build_filename(path, file, NULL); - FILE *handle = g_fopen(filename, "rb"); - char *contents; - char *contents2; - struct adium_logger_data *data; - GaimLog *log; - - if (!handle) { - g_free(filename); - continue; - } - - /* XXX: This is really inflexible. */ - contents = g_malloc(57); - fread(contents, 56, 1, handle); - fclose(handle); - contents[56] = '\0'; - - /* XXX: This is fairly inflexible. */ - contents2 = contents; - while (*contents2 && *contents2 != '>') - contents2++; - if (*contents2) - contents2++; - while (*contents2 && *contents2 != '>') - contents2++; - if (*contents2) - contents2++; - - if (sscanf(contents2, "%u.%u.%u", - &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 3) { - - gaim_debug(GAIM_DEBUG_ERROR, "Adium log parse", - "Contents timestamp parsing error\n"); - g_free(contents); - g_free(filename); - continue; - } - g_free(contents); - - data = g_new0(struct adium_logger_data, 1); - data->path = filename; - data->type = ADIUM_HTML; - - tm.tm_year -= 1900; - tm.tm_mon -= 1; - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = gaim_log_new(GAIM_LOG_IM, sn, account, NULL, mktime(&tm), NULL); - log->logger = adium_logger; - log->logger_data = data; - - list = g_list_append(list, log); - } - } else if (gaim_str_has_suffix(file, ".adiumLog")) { - struct tm tm; - const char *date = file; - - date += strlen(sn) + 2; - if (sscanf(date, "%u|%u|%u", - &tm.tm_year, &tm.tm_mon, &tm.tm_mday) != 3) { - - gaim_debug(GAIM_DEBUG_ERROR, "Adium log parse", - "Filename timestamp parsing error\n"); - } else { - char *filename = g_build_filename(path, file, NULL); - FILE *handle = g_fopen(filename, "rb"); - char *contents; - char *contents2; - struct adium_logger_data *data; - GaimLog *log; - - if (!handle) { - g_free(filename); - continue; - } - - /* XXX: This is really inflexible. */ - contents = g_malloc(14); - fread(contents, 13, 1, handle); - fclose(handle); - contents[13] = '\0'; - - contents2 = contents; - while (*contents2 && *contents2 != '(') - contents2++; - if (*contents2) - contents2++; - - if (sscanf(contents2, "%u.%u.%u", - &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 3) { - - gaim_debug(GAIM_DEBUG_ERROR, "Adium log parse", - "Contents timestamp parsing error\n"); - g_free(contents); - g_free(filename); - continue; - } - - g_free(contents); - - tm.tm_year -= 1900; - tm.tm_mon -= 1; - - data = g_new0(struct adium_logger_data, 1); - data->path = filename; - data->type = ADIUM_TEXT; - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = gaim_log_new(GAIM_LOG_IM, sn, account, NULL, mktime(&tm), NULL); - log->logger = adium_logger; - log->logger_data = data; - - list = g_list_append(list, log); - } - } - } - g_dir_close(dir); - } - - g_free(prpl_name); - g_free(path); - - return list; -} - -static char *adium_logger_read (GaimLog *log, GaimLogReadFlags *flags) -{ - struct adium_logger_data *data; - GError *error = NULL; - gchar *read = NULL; - gsize length; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - g_return_val_if_fail(data->path != NULL, g_strdup("")); - - gaim_debug(GAIM_DEBUG_INFO, "Adium log read", - "Reading %s\n", data->path); - if (!g_file_get_contents(data->path, &read, &length, &error)) { - gaim_debug(GAIM_DEBUG_ERROR, "Adium log read", - "Error reading log\n"); - if (error) - g_error_free(error); - return g_strdup(""); - } - - if (data->type != ADIUM_HTML) { - char *escaped = g_markup_escape_text(read, -1); - g_free(read); - read = escaped; - } - -#ifdef WIN32 - /* This problem only seems to show up on Windows. - * The BOM is displaying as a space at the beginning of the log. - */ - if (gaim_str_has_prefix(read, "\xef\xbb\xbf")) - { - /* FIXME: This feels so wrong... */ - char *temp = g_strdup(&(read[3])); - g_free(read); - read = temp; - } -#endif - - /* TODO: Apply formatting. - * Replace the above hack with something better, since we'll - * be looping over the entire log file contents anyway. - */ - - return read; -} - -static int adium_logger_size (GaimLog *log) -{ - struct adium_logger_data *data; - char *text; - size_t size; - - g_return_val_if_fail(log != NULL, 0); - - data = log->logger_data; - - if (gaim_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) { - struct stat st; - - if (!data->path || stat(data->path, &st)) - st.st_size = 0; - - return st.st_size; - } - - text = adium_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void adium_logger_finalize(GaimLog *log) -{ - struct adium_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - - g_free(data->path); -} - - -/***************************************************************************** - * Fire Logger * - *****************************************************************************/ - -/* The fire logger doesn't write logs, only reads them. This is to include - * Fire logs in the log viewer transparently. - */ - -static GaimLogLogger *fire_logger; - -struct fire_logger_data { -}; - -static GList *fire_logger_list(GaimLogType type, const char *sn, GaimAccount *account) -{ - /* TODO: Do something here. */ - return NULL; -} - -static char * fire_logger_read (GaimLog *log, GaimLogReadFlags *flags) -{ - struct fire_logger_data *data; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - /* TODO: Do something here. */ - return g_strdup(""); -} - -static int fire_logger_size (GaimLog *log) -{ - g_return_val_if_fail(log != NULL, 0); - - if (gaim_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) - return 0; - - /* TODO: Do something here. */ - return 0; -} - -static void fire_logger_finalize(GaimLog *log) -{ - g_return_if_fail(log != NULL); - - /* TODO: Do something here. */ -} - - -/***************************************************************************** - * Messenger Plus! Logger * - *****************************************************************************/ - -/* The messenger_plus logger doesn't write logs, only reads them. This is to include - * Messenger Plus! logs in the log viewer transparently. - */ - -static GaimLogLogger *messenger_plus_logger; - -struct messenger_plus_logger_data { -}; - -static GList *messenger_plus_logger_list(GaimLogType type, const char *sn, GaimAccount *account) -{ - /* TODO: Do something here. */ - return NULL; -} - -static char * messenger_plus_logger_read (GaimLog *log, GaimLogReadFlags *flags) -{ - struct messenger_plus_logger_data *data = log->logger_data; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - /* TODO: Do something here. */ - return g_strdup(""); -} - -static int messenger_plus_logger_size (GaimLog *log) -{ - g_return_val_if_fail(log != NULL, 0); - - if (gaim_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) - return 0; - - /* TODO: Do something here. */ - return 0; -} - -static void messenger_plus_logger_finalize(GaimLog *log) -{ - g_return_if_fail(log != NULL); - - /* TODO: Do something here. */ -} - - -/***************************************************************************** - * MSN Messenger Logger * - *****************************************************************************/ - -/* The msn logger doesn't write logs, only reads them. This is to include - * MSN Messenger message histories in the log viewer transparently. - */ - -static GaimLogLogger *msn_logger; - -struct msn_logger_data { - xmlnode *root; - xmlnode *message; - const char *session_id; - int last_log; - GString *text; -}; - -static time_t msn_logger_parse_timestamp(xmlnode *message) -{ - const char *date; - const char *time; - struct tm tm; - char am_pm; - - g_return_val_if_fail(message != NULL, (time_t)0); - - date = xmlnode_get_attrib(message, "Date"); - if (!(date && *date)) { - gaim_debug(GAIM_DEBUG_ERROR, "MSN log timestamp parse", - "Attribute missing: %s\n", "Date"); - return (time_t)0; - } - - time = xmlnode_get_attrib(message, "Time"); - if (!(time && *time)) { - gaim_debug(GAIM_DEBUG_ERROR, "MSN log timestamp parse", - "Attribute missing: %s\n", "Time"); - return (time_t)0; - } - - if (sscanf(date, "%u/%u/%u", &tm.tm_mon, &tm.tm_mday, &tm.tm_year) != 3) - gaim_debug(GAIM_DEBUG_ERROR, "MSN log timestamp parse", - "%s parsing error\n", "Date"); - - if (sscanf(time, "%u:%u:%u %c", &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &am_pm) != 4) - gaim_debug(GAIM_DEBUG_ERROR, "MSN log timestamp parse", - "%s parsing error\n", "Time"); - - tm.tm_year -= 1900; - tm.tm_mon -= 1; - if (am_pm == 'P') { - tm.tm_hour += 12; - } else if (tm.tm_hour == 12) { - /* 12 AM = 00 hr */ - tm.tm_hour = 0; - } - /* Let the C library deal with daylight savings time. */ - tm.tm_isdst = -1; - - return mktime(&tm); -} - - -static GList *msn_logger_list(GaimLogType type, const char *sn, GaimAccount *account) -{ - GList *list = NULL; - char *username; - GaimBuddy *buddy; - const char *logdir; - const char *savedfilename = NULL; - char *logfile; - char *path; - GError *error = NULL; - gchar *contents = NULL; - gsize length; - xmlnode *root; - xmlnode *message; - const char *old_session_id = ""; - struct msn_logger_data *data = NULL; - - g_return_val_if_fail(sn != NULL, list); - g_return_val_if_fail(account != NULL, list); - - if (strcmp(account->protocol_id, "prpl-msn")) - return list; - - logdir = gaim_prefs_get_string("/plugins/core/log_reader/msn/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!*logdir) - return list; - - buddy = gaim_find_buddy(account, sn); - - if ((username = g_strdup(gaim_account_get_string( - account, "log_reader_msn_log_folder", NULL)))) { - /* As a special case, we allow the null string to kill the parsing - * straight away. This would allow the user to deal with the case - * when two account have the same username at different domains and - * only one has logs stored. - */ - if (!*username) { - g_free(username); - return list; - } - } else { - username = g_strdup(gaim_normalize(account, account->username)); - } - - if (buddy) - savedfilename = gaim_blist_node_get_string(&buddy->node, "log_reader_msn_log_filename"); - - if (savedfilename) { - /* As a special case, we allow the null string to kill the parsing - * straight away. This would allow the user to deal with the case - * when two buddies have the same username at different domains and - * only one has logs stored. - */ - if (!*savedfilename) { - g_free(username); - return list; - } - - logfile = g_strdup(savedfilename); - } else { - logfile = g_strdup_printf("%s.xml", gaim_normalize(account, sn)); - } - - path = g_build_filename(logdir, username, "History", logfile, NULL); - - if (!g_file_test(path, G_FILE_TEST_EXISTS)) { - gboolean found = FALSE; - char *at_sign; - GDir *dir; - - g_free(path); - - if (savedfilename) { - /* We had a saved filename, but it doesn't exist. - * Returning now is the right course of action because we don't - * want to detect another file incorrectly. - */ - g_free(username); - g_free(logfile); - return list; - } - - /* Perhaps we're using a new version of MSN with the weird numbered folders. - * I don't know how the numbers are calculated, so I'm going to attempt to - * find logs by pattern matching... - */ - - at_sign = g_strrstr(username, "@"); - if (at_sign) - *at_sign = '\0'; - - dir = g_dir_open(logdir, 0, NULL); - if (dir) { - const gchar *name; - - while ((name = g_dir_read_name(dir))) { - const char *c = name; - - if (!gaim_str_has_prefix(c, username)) - continue; - - c += strlen(username); - while (*c) { - if (!g_ascii_isdigit(*c)) - break; - - c++; - } - - path = g_build_filename(logdir, name, NULL); - /* The !c makes sure we got to the end of the while loop above. */ - if (!*c && g_file_test(path, G_FILE_TEST_IS_DIR)) { - char *history_path = g_build_filename( - path, "History", NULL); - if (g_file_test(history_path, G_FILE_TEST_IS_DIR)) { - gaim_account_set_string(account, - "log_reader_msn_log_folder", name); - g_free(path); - path = history_path; - found = TRUE; - break; - } - g_free(path); - g_free(history_path); - } - else - g_free(path); - } - g_dir_close(dir); - } - g_free(username); - - if (!found) { - g_free(logfile); - return list; - } - - /* If we've reached this point, we've found a History folder. */ - - username = g_strdup(gaim_normalize(account, sn)); - at_sign = g_strrstr(username, "@"); - if (at_sign) - *at_sign = '\0'; - - found = FALSE; - dir = g_dir_open(path, 0, NULL); - if (dir) { - const gchar *name; - - while ((name = g_dir_read_name(dir))) { - const char *c = name; - - if (!gaim_str_has_prefix(c, username)) - continue; - - c += strlen(username); - while (*c) { - if (!g_ascii_isdigit(*c)) - break; - - c++; - } - - path = g_build_filename(path, name, NULL); - if (!strcmp(c, ".xml") && - g_file_test(path, G_FILE_TEST_EXISTS)) { - found = TRUE; - g_free(logfile); - logfile = g_strdup(name); - break; - } - else - g_free(path); - } - g_dir_close(dir); - } - g_free(username); - - if (!found) { - g_free(logfile); - return list; - } - } else { - g_free(username); - g_free(logfile); - logfile = NULL; /* No sense saving the obvious bu...@do.... */ - } - - gaim_debug(GAIM_DEBUG_INFO, "MSN log read", - "Reading %s\n", path); - if (!g_file_get_contents(path, &contents, &length, &error)) { - g_free(path); - gaim_debug(GAIM_DEBUG_ERROR, "MSN log read", - "Error reading log\n"); - if (error) - g_error_free(error); - return list; - } - g_free(path); - - /* Reading the file was successful... - * Save its name if it involves the crazy numbers. The idea here is that you could - * then tweak the blist.xml file by hand if need be. This would be the case if two - * buddies have the same username at different domains. One set of logs would get - * detected for both buddies. - */ - if (buddy && logfile) { - gaim_blist_node_set_string(&buddy->node, "log_reader_msn_log_filename", logfile); - g_free(logfile); - } - - root = xmlnode_from_str(contents, length); - g_free(contents); - if (!root) - return list; - - for (message = xmlnode_get_child(root, "Message"); message; - message = xmlnode_get_next_twin(message)) { - const char *session_id; - - session_id = xmlnode_get_attrib(message, "SessionID"); - if (!session_id) { - gaim_debug(GAIM_DEBUG_ERROR, "MSN log parse", - "Error parsing message: %s\n", "SessionID missing"); - continue; - } - - if (strcmp(session_id, old_session_id)) { - /* - * The session ID differs from the last message. - * Thus, this is the start of a new conversation. - */ - GaimLog *log; - - data = g_new0(struct msn_logger_data, 1); - data->root = root; - data->message = message; - data->session_id = session_id; - data->text = NULL; - data->last_log = FALSE; - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = gaim_log_new(GAIM_LOG_IM, sn, account, NULL, msn_logger_parse_timestamp(message), NULL); - log->logger = msn_logger; - log->logger_data = data; - - list = g_list_append(list, log); - } - old_session_id = session_id; - } - - if (data) - data->last_log = TRUE; - - return list; -} - -static char * msn_logger_read (GaimLog *log, GaimLogReadFlags *flags) -{ - struct msn_logger_data *data; - GString *text = NULL; - xmlnode *message; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - if (data->text) { - /* The GTK code which displays the logs g_free()s whatever is - * returned from this function. Thus, we can't reuse the str - * part of the GString. The only solution is to free it and - * start over. - */ - g_string_free(data->text, FALSE); - } - - text = g_string_new(""); - - if (!data->root || !data->message || !data->session_id) { - /* Something isn't allocated correctly. */ - gaim_debug(GAIM_DEBUG_ERROR, "MSN log parse", - "Error parsing message: %s\n", "Internal variables inconsistent"); - data->text = text; - - return text->str; - } - - for (message = data->message; message; - message = xmlnode_get_next_twin(message)) { - - const char *new_session_id; - xmlnode *text_node; - const char *from_name = NULL; - const char *to_name = NULL; - xmlnode *from; - xmlnode *to; - enum name_guesses name_guessed = NAME_GUESS_UNKNOWN; - const char *their_name; - time_t time_unix; - struct tm *tm_new; - char *timestamp; - char *tmp; - const char *style; - - new_session_id = xmlnode_get_attrib(message, "SessionID"); - - /* If this triggers, something is wrong with the XML. */ - if (!new_session_id) { - gaim_debug(GAIM_DEBUG_ERROR, "MSN log parse", - "Error parsing message: %s\n", "New SessionID missing"); - break; - } - - if (strcmp(new_session_id, data->session_id)) { - /* The session ID differs from the first message. - * Thus, this is the start of a new conversation. - */ - break; - } - - text_node = xmlnode_get_child(message, "Text"); - if (!text_node) - continue; - - from = xmlnode_get_child(message, "From"); - if (from) { - xmlnode *user = xmlnode_get_child(from, "User"); - - if (user) { - from_name = xmlnode_get_attrib(user, "FriendlyName"); - - /* This saves a check later. */ - if (!*from_name) - from_name = NULL; - } - } - - to = xmlnode_get_child(message, "To"); - if (to) { - xmlnode *user = xmlnode_get_child(to, "User"); - if (user) { - to_name = xmlnode_get_attrib(user, "FriendlyName"); - - /* This saves a check later. */ - if (!*to_name) - to_name = NULL; - } - } - - their_name = from_name; - if (from_name && gaim_prefs_get_bool("/plugins/core/log_reader/use_name_heuristics")) { - const char *friendly_name = gaim_connection_get_display_name(log->account->gc); - - if (friendly_name != NULL) { - int friendly_name_length = strlen(friendly_name); - int alias_length = strlen(log->account->alias); - GaimBuddy *buddy = gaim_find_buddy(log->account, log->name); - gboolean from_name_matches; - gboolean to_name_matches; - - if (buddy && buddy->alias) - their_name = buddy->alias; - - /* Try to guess which user is me. - * The first step is to determine if either of the names matches either my - * friendly name or alias. For this test, "match" is defined as: - * ^(friendly_name|alias)([^a-zA-Z0-9].*)?$ - */ - from_name_matches = (gaim_str_has_prefix(from_name, friendly_name) && - !isalnum(*(from_name + friendly_name_length))) || - (gaim_str_has_prefix(from_name, log->account->alias) && - !isalnum(*(from_name + alias_length))); - - to_name_matches = to_name != NULL && ( - (gaim_str_has_prefix(to_name, friendly_name) && - !isalnum(*(to_name + friendly_name_length))) || - (gaim_str_has_prefix(to_name, log->account->alias) && - !isalnum(*(to_name + alias_length)))); - - if (from_name_matches) { - if (!to_name_matches) { - name_guessed = NAME_GUESS_ME; - } - } else if (to_name_matches) { - name_guessed = NAME_GUESS_THEM; - } else { - if (buddy && buddy->alias) { - char *alias = g_strdup(buddy->alias); - - /* "Truncate" the string at the first non-alphanumeric - * character. The idea is to relax the comparison. - */ - char *temp; - for (temp = alias; *temp ; temp++) { - if (!isalnum(*temp)) { - *temp = '\0'; - break; - } - } - alias_length = strlen(alias); - - /* Try to guess which user is them. - * The first step is to determine if either of the names - * matches their alias. For this test, "match" is - * defined as: ^alias([^a-zA-Z0-9].*)?$ - */ - from_name_matches = (gaim_str_has_prefix( - from_name, alias) && - !isalnum(*(from_name + - alias_length))); - - to_name_matches = to_name && (gaim_str_has_prefix( - to_name, alias) && - !isalnum(*(to_name + - alias_length))); - - g_free(alias); - - if (from_name_matches) { - if (!to_name_matches) { - name_guessed = NAME_GUESS_THEM; - } - } else if (to_name_matches) { - name_guessed = NAME_GUESS_ME; - } else if (buddy->server_alias) { - friendly_name_length = - strlen(buddy->server_alias); - - /* Try to guess which user is them. - * The first step is to determine if either of - * the names matches their friendly name. For - * this test, "match" is defined as: - * ^friendly_name([^a-zA-Z0-9].*)?$ - */ - from_name_matches = (gaim_str_has_prefix( - from_name, - buddy->server_alias) && - !isalnum(*(from_name + - friendly_name_length))); - - to_name_matches = to_name && ( - (gaim_str_has_prefix( - to_name, buddy->server_alias) && - !isalnum(*(to_name + - friendly_name_length)))); - - if (from_name_matches) { - if (!to_name_matches) { - name_guessed = NAME_GUESS_THEM; - } - } else if (to_name_matches) { - name_guessed = NAME_GUESS_ME; - } - } - } - } - } - } - - if (name_guessed != NAME_GUESS_UNKNOWN) { - text = g_string_append(text, "<span style=\"color: #"); - if (name_guessed == NAME_GUESS_ME) - text = g_string_append(text, "16569E"); - else - text = g_string_append(text, "A82F2F"); - text = g_string_append(text, ";\">"); - } - - time_unix = msn_logger_parse_timestamp(message); - tm_new = localtime(&time_unix); - - timestamp = g_strdup_printf("<font size=\"2\">(%02u:%02u:%02u)</font> ", - tm_new->tm_hour, tm_new->tm_min, tm_new->tm_sec); - text = g_string_append(text, timestamp); - g_free(timestamp); - - if (from_name) { - text = g_string_append(text, "<b>"); - - if (name_guessed == NAME_GUESS_ME) - text = g_string_append(text, log->account->alias); - else if (name_guessed == NAME_GUESS_THEM) - text = g_string_append(text, their_name); - else - text = g_string_append(text, from_name); - - text = g_string_append(text, ":</b> "); - } - - if (name_guessed != NAME_GUESS_UNKNOWN) - text = g_string_append(text, "</span>"); - - style = xmlnode_get_attrib(text_node, "Style"); - - tmp = xmlnode_get_data(text_node); - if (style && *style) { - text = g_string_append(text, "<span style=\""); - text = g_string_append(text, style); - text = g_string_append(text, "\">"); - text = g_string_append(text, tmp); - text = g_string_append(text, "</span>\n"); - } else { - text = g_string_append(text, tmp); - text = g_string_append(text, "\n"); - } - g_free(tmp); - } - - data->text = text; - - return text->str; -} - -static int msn_logger_size (GaimLog *log) -{ - char *text; - size_t size; - - g_return_val_if_fail(log != NULL, 0); - - if (gaim_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) - return 0; - - text = msn_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void msn_logger_finalize(GaimLog *log) -{ - struct msn_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - - if (data->last_log) - xmlnode_free(data->root); - - if (data->text) - g_string_free(data->text, FALSE); -} - - -/***************************************************************************** - * Trillian Logger * - *****************************************************************************/ - -/* The trillian logger doesn't write logs, only reads them. This is to include - * Trillian logs in the log viewer transparently. - */ - -static GaimLogLogger *trillian_logger; -static void trillian_logger_finalize(GaimLog *log); - -struct trillian_logger_data { - char *path; /* FIXME: Change this to use GaimStringref like log.c:old_logger_list */ - int offset; - int length; - char *their_nickname; -}; - -static GList *trillian_logger_list(GaimLogType type, const char *sn, GaimAccount *account) -{ - GList *list = NULL; - const char *logdir; - GaimPlugin *plugin; - GaimPluginProtocolInfo *prpl_info; - char *prpl_name; - const char *buddy_name; - char *filename; - char *path; - GError *error = NULL; - gchar *contents = NULL; - gsize length; - gchar *line; - gchar *c; - - g_return_val_if_fail(sn != NULL, list); - g_return_val_if_fail(account != NULL, list); - - logdir = gaim_prefs_get_string("/plugins/core/log_reader/trillian/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!*logdir) - return list; - - plugin = gaim_find_prpl(gaim_account_get_protocol_id(account)); - if (!plugin) - return NULL; - - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); - if (!prpl_info->list_icon) - return NULL; - - prpl_name = g_ascii_strup(prpl_info->list_icon(account, NULL), -1); - - buddy_name = gaim_normalize(account, sn); - - filename = g_strdup_printf("%s.log", buddy_name); - path = g_build_filename( - logdir, prpl_name, filename, NULL); - - gaim_debug(GAIM_DEBUG_INFO, "Trillian log list", - "Reading %s\n", path); - /* FIXME: There's really no need to read the entire file at once. - * See src/log.c:old_logger_list for a better approach. - */ - if (!g_file_get_contents(path, &contents, &length, &error)) { - if (error) { - g_error_free(error); - error = NULL; - } - g_free(path); - - path = g_build_filename( - logdir, prpl_name, "Query", filename, NULL); - gaim_debug(GAIM_DEBUG_INFO, "Trillian log list", - "Reading %s\n", path); - if (!g_file_get_contents(path, &contents, &length, &error)) { - if (error) - g_error_free(error); - } - } - g_free(filename); - - if (contents) { - struct trillian_logger_data *data = NULL; - int offset = 0; - int last_line_offset = 0; - - line = contents; - c = contents; - while (*c) { - offset++; - - if (*c != '\n') { - c++; - continue; - } - - *c = '\0'; - if (gaim_str_has_prefix(line, "Session Close ")) { - if (data && !data->length) { - if (!(data->length = last_line_offset - data->offset)) { - /* This log had no data, so we remove it. */ - GList *last = g_list_last(list); - - gaim_debug(GAIM_DEBUG_INFO, "Trillian log list", - "Empty log. Offset %i\n", data->offset); - - trillian_logger_finalize((GaimLog *)last->data); - list = g_list_delete_link(list, last); - } - } - } else if (line[0] && line[1] && line [3] && - gaim_str_has_prefix(&line[3], "sion Start ")) { - - char *their_nickname = line; - char *timestamp; - - if (data && !data->length) - data->length = last_line_offset - data->offset; - - while (*their_nickname && (*their_nickname != ':')) - their_nickname++; - their_nickname++; - - /* This code actually has nothing to do with - * the timestamp YET. I'm simply using this - * variable for now to NUL-terminate the - * their_nickname string. - */ - timestamp = their_nickname; - while (*timestamp && *timestamp != ')') - timestamp++; - - if (*timestamp == ')') { - char *month; - struct tm tm; - - *timestamp = '\0'; - if (line[0] && line[1] && line[2]) - timestamp += 3; - - /* Now we start dealing with the timestamp. */ - - /* Skip over the day name. */ - while (*timestamp && (*timestamp != ' ')) - timestamp++; - *timestamp = '\0'; - timestamp++; - - /* Parse out the month. */ - month = timestamp; - while (*timestamp && (*timestamp != ' ')) - timestamp++; - *timestamp = '\0'; - timestamp++; - - /* Parse the day, time, and year. */ - if (sscanf(timestamp, "%u %u:%u:%u %u", - &tm.tm_mday, &tm.tm_hour, - &tm.tm_min, &tm.tm_sec, - &tm.tm_year) != 5) { - - gaim_debug(GAIM_DEBUG_ERROR, - "Trillian log timestamp parse", - "Session Start parsing error\n"); - } else { - GaimLog *log; - - tm.tm_year -= 1900; - - /* Let the C library deal with - * daylight savings time. - */ - tm.tm_isdst = -1; - - /* Ugly hack, in case current locale - * is not English. This code is taken - * from log.c. - */ - if (strcmp(month, "Jan") == 0) { - tm.tm_mon= 0; - } else if (strcmp(month, "Feb") == 0) { - tm.tm_mon = 1; - } else if (strcmp(month, "Mar") == 0) { - tm.tm_mon = 2; - } else if (strcmp(month, "Apr") == 0) { - tm.tm_mon = 3; - } else if (strcmp(month, "May") == 0) { - tm.tm_mon = 4; - } else if (strcmp(month, "Jun") == 0) { - tm.tm_mon = 5; - } else if (strcmp(month, "Jul") == 0) { - tm.tm_mon = 6; - } else if (strcmp(month, "Aug") == 0) { - tm.tm_mon = 7; - } else if (strcmp(month, "Sep") == 0) { - tm.tm_mon = 8; - } else if (strcmp(month, "Oct") == 0) { - tm.tm_mon = 9; - } else if (strcmp(month, "Nov") == 0) { - tm.tm_mon = 10; - } else if (strcmp(month, "Dec") == 0) { - tm.tm_mon = 11; - } - - data = g_new0( - struct trillian_logger_data, 1); - data->path = g_strdup(path); - data->offset = offset; - data->length = 0; - data->their_nickname = - g_strdup(their_nickname); - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = gaim_log_new(GAIM_LOG_IM, - sn, account, NULL, mktime(&tm), NULL); - log->logger = trillian_logger; - log->logger_data = data; - - list = g_list_append(list, log); - } - } - } - c++; - line = c; - last_line_offset = offset; - } - - g_free(contents); - } - g_free(path); - - g_free(prpl_name); - - return list; -} - -static char * trillian_logger_read (GaimLog *log, GaimLogReadFlags *flags) -{ - struct trillian_logger_data *data; - char *read; - FILE *file; - GaimBuddy *buddy; - char *escaped; - GString *formatted; - char *c; - char *line; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - g_return_val_if_fail(data->path != NULL, g_strdup("")); - g_return_val_if_fail(data->length > 0, g_strdup("")); - g_return_val_if_fail(data->their_nickname != NULL, g_strdup("")); - - gaim_debug(GAIM_DEBUG_INFO, "Trillian log read", - "Reading %s\n", data->path); - - read = g_malloc(data->length + 2); - - file = g_fopen(data->path, "rb"); - fseek(file, data->offset, SEEK_SET); - fread(read, data->length, 1, file); - fclose(file); - - if (read[data->length-1] == '\n') { - read[data->length] = '\0'; - } else { - read[data->length] = '\n'; - read[data->length+1] = '\0'; - } - - /* Load miscellaneous data. */ - buddy = gaim_find_buddy(log->account, log->name); - - escaped = g_markup_escape_text(read, -1); - g_free(read); - read = escaped; - - /* Apply formatting... */ - formatted = g_string_new(""); - c = read; - line = read; - while (*c) - { - if (*c == '\n') - { - char *link_temp_line; - char *link; - char *timestamp; - char *footer = NULL; - *c = '\0'; - - /* Convert links. - * - * The format is (Link: URL)URL - * So, I want to find each occurance of "(Link: " and replace that chunk with: - * <a href=" - * Then, replace the next ")" with: - * "> - * Then, replace the next " " (or add this if the end-of-line is reached) with: - * </a> - */ - link_temp_line = NULL; - while ((link = g_strstr_len(line, strlen(line), "(Link: "))) { - GString *temp; - - if (!*link) - continue; - - *link = '\0'; - link++; - - temp = g_string_new(line); - g_string_append(temp, "<a href=\""); - - if (strlen(link) >= 6) { - link += (sizeof("(Link: ") - 1); - - while (*link && *link != ')') { - g_string_append_c(temp, *link); - link++; - } - if (link) { - link++; - - g_string_append(temp, "\">"); - while (*link && *link != ' ') { - g_string_append_c(temp, *link); - link++; - } - g_string_append(temp, "</a>"); - } - - g_string_append(temp, link); - - /* Free the last round's line. */ - if (link_temp_line) - g_free(line); - - line = temp->str; - g_string_free(temp, FALSE); - - /* Save this memory location so we can free it later. */ - link_temp_line = line; - } - } - - timestamp = ""; - if (*line == '[') { - timestamp = line; - while (*timestamp && *timestamp != ']') - timestamp++; - if (*timestamp == ']') { - *timestamp = '\0'; - line++; - /* TODO: Parse the timestamp and convert it to Gaim's format. */ - g_string_append_printf(formatted, - "<font size=\"2\">(%s)</font> ", line); - line = timestamp; - if (line[1] && line[2]) - line += 2; - } - - if (gaim_str_has_prefix(line, "*** ")) { - line += (sizeof("*** ") - 1); - g_string_append(formatted, "<b>"); - footer = "</b>"; - if (gaim_str_has_prefix(line, "NOTE: This user is offline.")) { - line = _("User is offline."); - } else if (gaim_str_has_prefix(line, - "NOTE: Your status is currently set to ")) { - - line += (sizeof("NOTE: ") - 1); - } else if (gaim_str_has_prefix(line, "Auto-response sent to ")) { - g_string_append(formatted, _("Auto-response sent:")); - while (*line && *line != ':') - line++; - if (*line) - line++; - g_string_append(formatted, "</b>"); - footer = NULL; - } else if (strstr(line, " signed off ")) { - if (buddy != NULL && buddy->alias) - g_string_append_printf(formatted, - _("%s has signed off."), buddy->alias); - else - g_string_append_printf(formatted, - _("%s has signed off."), log->name); - line = ""; - } else if (strstr(line, " signed on ")) { - if (buddy != NULL && buddy->alias) - g_string_append(formatted, buddy->alias); - else - g_string_append(formatted, log->name); - line = " logged in."; - } else if (gaim_str_has_prefix(line, - "One or more messages may have been undeliverable.")) { - - g_string_append(formatted, - "<span style=\"color: #ff0000;\">"); - g_string_append(formatted, - _("One or more messages may have been " - "undeliverable.")); - line = ""; - footer = "</span></b>"; - } else if (gaim_str_has_prefix(line, - "You have been disconnected.")) { - - g_string_append(formatted, - "<span style=\"color: #ff0000;\">"); - g_string_append(formatted, - _("You were disconnected from the server.")); - line = ""; - footer = "</span></b>"; - } else if (gaim_str_has_prefix(line, - "You are currently disconnected.")) { - - g_string_append(formatted, - "<span style=\"color: #ff0000;\">"); - line = _("You are currently disconnected. Messages " - "will not be received unless you are " - "logged in."); - footer = "</span></b>"; - } else if (gaim_str_has_prefix(line, - "Your previous message has not been sent.")) { - - g_string_append(formatted, - "<span style=\"color: #ff0000;\">"); - - if (gaim_str_has_prefix(line, - "Your previous message has not been sent. " - "Reason: Maximum length exceeded.")) { - - g_string_append(formatted, - _("Message could not be sent because " - "the maximum length was exceeded.")); - line = ""; - } else { - g_string_append(formatted, - _("Message could not be sent.")); - line += (sizeof( - "Your previous message " - "has not been sent. ") - 1); - } - - footer = "</span></b>"; - } - } else if (gaim_str_has_prefix(line, data->their_nickname)) { - if (buddy != NULL && buddy->alias) { - line += strlen(data->their_nickname) + 2; - g_string_append_printf(formatted, - "<span style=\"color: #A82F2F;\">" - "<b>%s</b></span>: ", buddy->alias); - } - } else { - char *line2 = line; - while (*line2 && *line2 != ':') - line2++; - if (*line2 == ':') { - line2++; - line = line2; - g_string_append_printf(formatted, - "<span style=\"color: #16569E;\">" - "<b>%s</b></span>:", log->account->alias); - } - } - } - - g_string_append(formatted, line); - - if (footer) - g_string_append(formatted, footer); - - g_string_append_c(formatted, '\n'); - - if (link_temp_line) - g_free(link_temp_line); - - c++; - line = c; - } else - c++; - } - - g_free(read); - read = formatted->str; - g_string_free(formatted, FALSE); - - return read; -} - -static int trillian_logger_size (GaimLog *log) -{ - struct trillian_logger_data *data; - char *text; - size_t size; - - g_return_val_if_fail(log != NULL, 0); - - data = log->logger_data; - - if (gaim_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) { - return data ? data->length : 0; - } - - text = trillian_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void trillian_logger_finalize(GaimLog *log) -{ - struct trillian_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - - g_free(data->path); - g_free(data->their_nickname); - -} - - -/***************************************************************************** - * Plugin Code * - *****************************************************************************/ - -static void -init_plugin(GaimPlugin *plugin) -{ - char *path; -#ifdef _WIN32 - char *folder; -#endif - - g_return_if_fail(plugin != NULL); - - gaim_prefs_add_none("/plugins/core/log_reader"); - - - /* Add general preferences. */ - - gaim_prefs_add_bool("/plugins/core/log_reader/fast_sizes", FALSE); - gaim_prefs_add_bool("/plugins/core/log_reader/use_name_heuristics", TRUE); - - - /* Add Adium log directory preference. */ - gaim_prefs_add_none("/plugins/core/log_reader/adium"); - - /* Calculate default Adium log directory. */ -#ifdef _WIN32 - path = ""; -#else - path = g_build_filename(gaim_home_dir(), "Library", "Application Support", - "Adium 2.0", "Users", "Default", "Logs", NULL); -#endif - - gaim_prefs_add_string("/plugins/core/log_reader/adium/log_directory", path); - -#ifndef _WIN32 - g_free(path); -#endif - - - /* Add Fire log directory preference. */ - gaim_prefs_add_none("/plugins/core/log_reader/fire"); - - /* Calculate default Fire log directory. */ -#ifdef _WIN32 - path = ""; -#else - path = g_build_filename(gaim_home_dir(), "Library", "Application Support", - "Fire", "Sessions", NULL); -#endif - - gaim_prefs_add_string("/plugins/core/log_reader/fire/log_directory", path); - -#ifndef _WIN32 - g_free(path); -#endif - - - /* Add Messenger Plus! log directory preference. */ - gaim_prefs_add_none("/plugins/core/log_reader/messenger_plus"); - - /* Calculate default Messenger Plus! log directory. */ -#ifdef _WIN32 - folder = wgaim_get_special_folder(CSIDL_PERSONAL); - if (folder) { -#endif - path = g_build_filename( -#ifdef _WIN32 - folder, -#else - GAIM_LOG_READER_WINDOWS_MOUNT_POINT, "Documents and Settings", - g_get_user_name(), "My Documents", -#endif - "My Chat Logs", NULL); -#ifdef _WIN32 - g_free(folder); - } else /* !folder */ - path = g_strdup(""); -#endif - - gaim_prefs_add_string("/plugins/core/log_reader/messenger_plus/log_directory", path); - g_free(path); - - - /* Add MSN Messenger log directory preference. */ - gaim_prefs_add_none("/plugins/core/log_reader/msn"); - - /* Calculate default MSN message history directory. */ -#ifdef _WIN32 - folder = wgaim_get_special_folder(CSIDL_PERSONAL); - if (folder) { -#endif - path = g_build_filename( -#ifdef _WIN32 - folder, -#else - GAIM_LOG_READER_WINDOWS_MOUNT_POINT, "Documents and Settings", - g_get_user_name(), "My Documents", -#endif - "My Received Files", NULL); -#ifdef _WIN32 - g_free(folder); - } else /* !folder */ - path = g_strdup(""); -#endif - - gaim_prefs_add_string("/plugins/core/log_reader/msn/log_directory", path); - g_free(path); - - - /* Add Trillian log directory preference. */ - gaim_prefs_add_none("/plugins/core/log_reader/trillian"); - -#ifdef _WIN32 - /* XXX: While a major hack, this is the most reliable way I could - * think of to determine the Trillian installation directory. - */ - HKEY hKey; - char buffer[1024] = ""; - DWORD size = (sizeof(buffer) - 1); - DWORD type; - gboolean found = FALSE; - - path = NULL; - /* TODO: Test this after removing the trailing "\\". */ - if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, "Trillian.SkinZip\\shell\\Add\\command\\", - 0, KEY_QUERY_VALUE, &hKey)) { - - if(ERROR_SUCCESS == RegQueryValueEx(hKey, "", NULL, &type, (LPBYTE)buffer, &size)) { - char *value = buffer; - char *temp; - - /* Ensure the data is null terminated. */ - value[size] = '\0'; - - /* Break apart buffer. */ - if (*value == '"') { - value++; - temp = value; - while (*temp && *temp != '"') - temp++; - } else { - temp = value; - while (*temp && *temp != ' ') - temp++; - } - *temp = '\0'; - - /* Set path. */ - if (gaim_str_has_suffix(value, "trillian.exe")) - { - value[strlen(value) - (sizeof("trillian.exe") - 1)] = '\0'; - path = g_build_filename(value, "users", "default", "talk.ini", NULL); - } - } - RegCloseKey(hKey); - } - - if (!path) { - char *folder = wgaim_get_special_folder(CSIDL_PROGRAM_FILES); - if (folder) { - path = g_build_filename(folder, "Trillian", - "users", "default", "talk.ini", NULL); - g_free(folder); - } - } - - if (path) { - /* Read talk.ini file to find the log directory. */ - GError *error = NULL; - -#if 0 && GLIB_CHECK_VERSION(2,6,0) /* FIXME: Not tested yet. */ - GKeyFile *key_file; - - gaim_debug(GAIM_DEBUG_INFO, "Trillian talk.ini read", - "Reading %s\n", path); - if (!g_key_file_load_from_file(key_file, path, G_KEY_FILE_NONE, GError &error)) { - gaim_debug(GAIM_DEBUG_ERROR, "Trillian talk.ini read", - "Error reading talk.ini\n"); - if (error) - g_error_free(error); - } else { - char *logdir = g_key_file_get_string(key_file, "Logging", "Directory", &error); - if (error) { - gaim_debug(GAIM_DEBUG_ERROR, "Trillian talk.ini read", - "Error reading Directory value from Logging section\n"); - g_error_free(error); - } - - if (logdir) { - g_strchomp(logdir); - gaim_prefs_add_string( - "/plugins/core/log_reader/trillian/log_directory", logdir); - found = TRUE; - } - - g_key_file_free(key_file); - } -#else /* !GLIB_CHECK_VERSION(2,6,0) */ - gsize length; - gchar *contents = NULL; - - gaim_debug(GAIM_DEBUG_INFO, "Trillian talk.ini read", - "Reading %s\n", path); - if (!g_file_get_contents(path, &contents, &length, &error)) { - gaim_debug(GAIM_DEBUG_ERROR, "Trillian talk.ini read", - "Error reading talk.ini\n"); - if (error) - g_error_free(error); - } else { - char *line = contents; - while (*contents) { - if (*contents == '\n') { - *contents = '\0'; - - /* XXX: This assumes the first Directory key is under [Logging]. */ - if (gaim_str_has_prefix(line, "Directory=")) { - line += (sizeof("Directory=") - 1); - g_strchomp(line); - gaim_prefs_add_string( - "/plugins/core/log_reader/trillian/log_directory", - line); - found = TRUE; - } - - contents++; - line = contents; - } else - contents++; - } - g_free(path); - g_free(contents); - } -#endif /* !GTK_CHECK_VERSION(2,6,0) */ - } /* path */ - - if (!found) { -#endif /* defined(_WIN32) */ - - /* Calculate default Trillian log directory. */ -#ifdef _WIN32 - folder = wgaim_get_special_folder(CSIDL_PROGRAM_FILES); - if (folder) { -#endif - path = g_build_filename( -#ifdef _WIN32 - folder, -#else - GAIM_LOG_READER_WINDOWS_MOUNT_POINT, "Program Files", -#endif - "Trillian", "users", "default", "logs", NULL); -#ifdef _WIN32 - g_free(folder); - } else /* !folder */ - path = g_strdup(""); -#endif - - gaim_prefs_add_string("/plugins/core/log_reader/trillian/log_directory", path); - g_free(path); - -#ifdef _WIN32 - } /* !found */ -#endif -} - -static gboolean -plugin_load(GaimPlugin *plugin) -{ - g_return_val_if_fail(plugin != NULL, FALSE); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - adium_logger = gaim_log_logger_new("adium", _("Adium"), 6, - NULL, - NULL, - adium_logger_finalize, - adium_logger_list, - adium_logger_read, - adium_logger_size); - gaim_log_logger_add(adium_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - fire_logger = gaim_log_logger_new("fire", _("Fire"), 6, - NULL, - NULL, - fire_logger_finalize, - fire_logger_list, - fire_logger_read, - fire_logger_size); - gaim_log_logger_add(fire_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - messenger_plus_logger = gaim_log_logger_new("messenger_plus", _("Messenger Plus!"), 6, - NULL, - NULL, - messenger_plus_logger_finalize, - messenger_plus_logger_list, - messenger_plus_logger_read, - messenger_plus_logger_size); - gaim_log_logger_add(messenger_plus_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - msn_logger = gaim_log_logger_new("msn", _("MSN Messenger"), 6, - NULL, - NULL, - msn_logger_finalize, - msn_logger_list, - msn_logger_read, - msn_logger_size); - gaim_log_logger_add(msn_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - trillian_logger = gaim_log_logger_new("trillian", _("Trillian"), 6, - NULL, - NULL, - trillian_logger_finalize, - trillian_logger_list, - trillian_logger_read, - trillian_logger_size); - gaim_log_logger_add(trillian_logger); - - return TRUE; -} - -static gboolean -plugin_unload(GaimPlugin *plugin) -{ - g_return_val_if_fail(plugin != NULL, FALSE); - - gaim_log_logger_remove(adium_logger); - gaim_log_logger_remove(fire_logger); - gaim_log_logger_remove(messenger_plus_logger); - gaim_log_logger_remove(msn_logger); - gaim_log_logger_remove(trillian_logger); - - return TRUE; -} - -static GaimPluginPrefFrame * -get_plugin_pref_frame(GaimPlugin *plugin) -{ - GaimPluginPrefFrame *frame; - GaimPluginPref *ppref; - - g_return_val_if_fail(plugin != NULL, FALSE); - - frame = gaim_plugin_pref_frame_new(); - - - /* Add general preferences. */ - - ppref = gaim_plugin_pref_new_with_label(_("General Log Reading Configuration")); - gaim_plugin_pref_frame_add(frame, ppref); - - ppref = gaim_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/fast_sizes", _("Fast size calculations")); - gaim_plugin_pref_frame_add(frame, ppref); - - ppref = gaim_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/use_name_heuristics", _("Use name heuristics")); - gaim_plugin_pref_frame_add(frame, ppref); - - - /* Add Log Directory preferences. */ - - ppref = gaim_plugin_pref_new_with_label(_("Log Directory")); - gaim_plugin_pref_frame_add(frame, ppref); - - ppref = gaim_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/adium/log_directory", _("Adium")); - gaim_plugin_pref_frame_add(frame, ppref); - - ppref = gaim_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/fire/log_directory", _("Fire")); - gaim_plugin_pref_frame_add(frame, ppref); - - ppref = gaim_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/messenger_plus/log_directory", _("Messenger Plus!")); - gaim_plugin_pref_frame_add(frame, ppref); - - ppref = gaim_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/msn/log_directory", _("MSN Messenger")); - gaim_plugin_pref_frame_add(frame, ppref); - - ppref = gaim_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/trillian/log_directory", _("Trillian")); - gaim_plugin_pref_frame_add(frame, ppref); - - return frame; -} - -static GaimPluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, /* page_num (reserved) */ - NULL /* frame (reserved) */ -}; - -static GaimPluginInfo info = -{ - GAIM_PLUGIN_MAGIC, - GAIM_MAJOR_VERSION, - GAIM_MINOR_VERSION, - GAIM_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - GAIM_PRIORITY_DEFAULT, /**< priority */ - "core-log_reader", /**< id */ - N_("Log Reader"), /**< name */ - VERSION, /**< version */ - - /** summary */ - N_("Includes other IM clients' logs in the " - "log viewer."), - - /** description */ - N_("When viewing logs, this plugin will include " - "logs from other IM clients. Currently, this " - "includes Adium, Fire, Messenger Plus!, " - "MSN Messenger, and Trillian."), - - "Richard Laager <rl...@us...>", /**< author */ - GAIM_WEBSITE, /**< homepage */ - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL /**< actions */ -}; - -GAIM_INIT_PLUGIN(log_reader, init_plugin, info) Property changes on: trunk/libgaim ___________________________________________________________________ Name: svn:ignore - Makefile.in .deps Makefile dbus-types.h libgaim.dll libgaim.dll.a + dbus-bindings.c dbus-types.c dbus-types.h .deps gaim-client-bindings.c gaim-client-bindings.h gaim-client-example libgaim.dll libgaim.dll.a .libs Makefile Makefile.in Property changes on: trunk/libgaim/plugins ___________________________________________________________________ Name: svn:ignore - Makefile.in Makefile .libs .deps *.dll + dbus-example-bindings.c .deps .libs Makefile Makefile.in *.dll Modified: trunk/libgaim/plugins/Makefile.am =================================================================== --- trunk/libgaim/plugins/Makefile.am 2006-08-20 19:37:33 UTC (rev 16916) +++ trunk/libgaim/plugins/Makefile.am 2006-08-20 20:14:12 UTC (rev 16917) @@ -27,6 +27,7 @@ plugindir = $(libdir)/gaim idle_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) +log_reader_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) psychic_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) statenotify_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) @@ -37,12 +38,14 @@ plugin_LTLIBRARIES = \ idle.la \ + log_reader.la \ psychic.la \ statenotify.la \ $(DBUS_LTLIB) idle_la_SOURCES = idle.c +log_reader_la_SOURCES = log_reader.c psychic_la_SOURCES = psychic.c statenotify_la_SOURCES = statenotify.c Modified: trunk/libgaim/plugins/Makefile.mingw =================================================================== --- trunk/libgaim/plugins/Makefile.mingw 2006-08-20 19:37:33 UTC (rev 16916) +++ trunk/libgaim/plugins/Makefile.mingw 2006-08-20 20:14:12 UTC (rev 16917) @@ -96,6 +96,7 @@ plugins: \ idle.dll \ + log_reader.dll \ psychic.dll \ statenotify.dll Copied: trunk/libgaim/plugins/log_reader.c (from rev 16915, trunk/gtk/plugins/log_reader.c) =================================================================== --- trunk/libgaim/plugins/log_reader.c (rev 0) +++ trunk/libgaim/plugins/log_reader.c 2006-08-20 20:14:12 UTC (rev 16917) @@ -0,0 +1,2019 @@ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> + +#ifndef GAIM_PLUGINS +# define GAIM_PLUGINS +#endif + +#include "internal.h" + +#include "debug.h" +#include "log.h" +#include "plugin.h" +#include "pluginpref.h" +#include "prefs.h" +#include "stringref.h" +#include "util.h" +#include "version.h" +#include "xmlnode.h" + +/* This must be the last Gaim header included. */ +#ifdef _WIN32 +#include "win32dep.h" +#endif + +/* Where is the Windows partition mounted? */ +#ifndef GAIM_LOG_READER_WINDOWS_MOUNT_POINT +#define GAIM_LOG_READER_WINDOWS_MOUNT_POINT "/mnt/windo... [truncated message content] |
From: <sa...@us...> - 2006-08-20 19:37:43
|
Revision: 16916 Author: sadrul Date: 2006-08-20 12:37:33 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16916&view=rev Log Message: ----------- Mark the messages from gnthistory as delayed, and don't print the timestamps for delayed messages (I think it makes sense). Modified Paths: -------------- trunk/console/gntconv.c trunk/console/plugins/gnthistory.c Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-20 18:55:37 UTC (rev 16915) +++ trunk/console/gntconv.c 2006-08-20 19:37:33 UTC (rev 16916) @@ -240,7 +240,9 @@ gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); - if (gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps")) + /* Unnecessary to print the timestamp for delayed message */ + if (!(flags & GAIM_MESSAGE_DELAYED) && + gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps")) gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), gaim_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM); if (who && *who && (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV))) Modified: trunk/console/plugins/gnthistory.c =================================================================== --- trunk/console/plugins/gnthistory.c 2006-08-20 18:55:37 UTC (rev 16915) +++ trunk/console/plugins/gnthistory.c 2006-08-20 19:37:33 UTC (rev 16916) @@ -50,6 +50,7 @@ guint flags; char *history; char *header; + GaimMessageFlags mflag; convtype = gaim_conversation_get_type(c); if (convtype == GAIM_CONV_TYPE_IM) @@ -112,18 +113,19 @@ if (logs == NULL) return; + mflag = GAIM_MESSAGE_NO_LOG | GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_DELAYED; history = gaim_log_read((GaimLog*)logs->data, &flags); header = g_strdup_printf(_("<b>Conversation with %s on %s:</b><br>"), alias, gaim_date_format_full(localtime(&((GaimLog *)logs->data)->time))); - gaim_conversation_write(c, "", header, GAIM_MESSAGE_NO_LOG, time(NULL)); + gaim_conversation_write(c, "", header, mflag, time(NULL)); g_free(header); g_strchomp(history); - gaim_conversation_write(c, "", history, GAIM_MESSAGE_NO_LOG, time(NULL)); + gaim_conversation_write(c, "", history, mflag, time(NULL)); g_free(history); - gaim_conversation_write(c, "", "\n---------------\n", GAIM_MESSAGE_NO_LOG, time(NULL)); + gaim_conversation_write(c, "", "<hr>", mflag, time(NULL)); g_list_foreach(logs, (GFunc)gaim_log_free, NULL); g_list_free(logs); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rl...@us...> - 2006-08-20 18:55:45
|
Revision: 16915 Author: rlaager Date: 2006-08-20 11:55:37 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16915&view=rev Log Message: ----------- I'm seeing diffs in mkinstalldirs now. Does that need to be in SVN? Removed Paths: ------------- trunk/mkinstalldirs Deleted: trunk/mkinstalldirs =================================================================== --- trunk/mkinstalldirs 2006-08-20 18:49:08 UTC (rev 16914) +++ trunk/mkinstalldirs 2006-08-20 18:55:37 UTC (rev 16915) @@ -1,150 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy - -scriptversion=2004-02-15.20 - -# Original author: Noah Friedman <fri...@pr...> -# Created: 1993-05-16 -# Public domain. -# -# This file is maintained in Automake, please report -# bugs to <bug...@gn...> or send patches to -# <aut...@gn...>. - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... - -Create each directory DIR (with mode MODE, if specified), including all -leading file name components. - -Report bugs to <bug...@gn...>." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" - exit 0 - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --version) - echo "$0 $scriptversion" - exit 0 - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and -# mkdir -p a/c at the same time, both will detect that a is missing, -# one will create a, then the other will try to create a and die with -# a "File exists" error. This is a problem when calling mkinstalldirs -# from a parallel make. We use --version in the probe to restrict -# ourselves to GNU mkdir, which is thread-safe. -case $dirmode in - '') - if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - test -d ./-p && rmdir ./-p - test -d ./--version && rmdir ./--version - fi - ;; - *) - if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && - test ! -d ./--version; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - else - # Clean up after NextStep and OpenStep mkdir. - for d in ./-m ./-p ./--version "./$dirmode"; - do - test -d $d && rmdir $d - done - fi - ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dat...@us...> - 2006-08-20 18:49:26
|
Revision: 16914 Author: datallah Date: 2006-08-20 11:49:08 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16914&view=rev Log Message: ----------- Protocols now compile on win32. Next, everything needs to be put all together. Modified Paths: -------------- trunk/libgaim/Makefile.mingw trunk/libgaim/protocols/gg/Makefile.mingw trunk/libgaim/protocols/irc/Makefile.mingw trunk/libgaim/protocols/jabber/Makefile.mingw trunk/libgaim/protocols/msn/Makefile.mingw trunk/libgaim/protocols/novell/Makefile.mingw trunk/libgaim/protocols/oscar/Makefile.mingw trunk/libgaim/protocols/sametime/Makefile.mingw trunk/libgaim/protocols/silc/Makefile.mingw trunk/libgaim/protocols/simple/Makefile.mingw trunk/libgaim/protocols/yahoo/Makefile.mingw Added Paths: ----------- trunk/libgaim/protocols/Makefile.mingw Modified: trunk/libgaim/Makefile.mingw =================================================================== --- trunk/libgaim/Makefile.mingw 2006-08-20 18:07:53 UTC (rev 16913) +++ trunk/libgaim/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -134,8 +134,10 @@ .PHONY: all clean include_path all: $(TARGET).dll + $(MAKE) -C protocols -f Makefile.mingw install: all + $(MAKE) -C protocols -f Makefile.mingw install cp $(GAIM_SRC)/$(TARGET).dll $(GAIM_INSTALL_DIR) # @@ -153,3 +155,4 @@ rm -rf *.o ./win32/*.o rm -rf $(TARGET).dll rm -rf $(TARGET).dll.a + $(MAKE) -C protocols -f Makefile.mingw clean Added: trunk/libgaim/protocols/Makefile.mingw =================================================================== --- trunk/libgaim/protocols/Makefile.mingw (rev 0) +++ trunk/libgaim/protocols/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -0,0 +1,80 @@ +# Makefile.mingw +# +# Author: her...@ya... +# Date 9/11/02 +# Description: Top Makefile for win32 (mingw) port of Gaim +# + +GAIM_TOP = ../.. +LIBGAIM_TOP = ../ +GAIM_PROTOS = . +GAIM_INSTALL_DIR = $(GAIM_TOP)/win32-install-dir + +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 + +VERSION := $(shell cat GAIM_TOP/VERSION) + +## +## 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: + $(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 + + +install: all + mkdir -p $(GAIM_INSTALL_DIR)/plugins + $(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 + +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 Property changes on: trunk/libgaim/protocols/Makefile.mingw ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/libgaim/protocols/gg/Makefile.mingw =================================================================== --- trunk/libgaim/protocols/gg/Makefile.mingw 2006-08-20 18:07:53 UTC (rev 16913) +++ trunk/libgaim/protocols/gg/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -8,9 +8,9 @@ # PATHS # -INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. +LIBGAIM_TOP := ../.. GG_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir @@ -41,7 +41,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -50,19 +50,15 @@ INCLUDE_PATHS += -I$(GG_ROOT) \ -I$(GG_ROOT)/lib \ -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/include/pango-1.0 \ - -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src \ + -L$(LIBGAIM_TOP) \ ## @@ -124,15 +120,15 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(LIBGAIM_TOP)/libgaim.dll.a: + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll +$(TARGET).dll: $(OBJECTS) $(LIBGAIM_TOP)/libgaim.dll.a + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## ## CLEAN RULES @@ -142,4 +138,3 @@ rm -rf *.o rm -rf $(GG_ROOT)/lib/*.o rm -rf $(TARGET).dll - rm -rf $(TARGET).lib Modified: trunk/libgaim/protocols/irc/Makefile.mingw =================================================================== --- trunk/libgaim/protocols/irc/Makefile.mingw 2006-08-20 18:07:53 UTC (rev 16913) +++ trunk/libgaim/protocols/irc/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -8,9 +8,9 @@ # PATHS # -INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. +LIBGAIM_TOP := ../.. IRC_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir @@ -26,7 +26,7 @@ DEFINES = -# Static or Plugin... +# Static or Plugin... ifeq ($(TYPE),STATIC) DEFINES += -DSTATIC DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR) @@ -41,7 +41,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -49,19 +49,15 @@ INCLUDE_PATHS += -I$(IRC_ROOT) \ -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/include/pango-1.0 \ - -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) ## @@ -82,10 +78,8 @@ ## LIBRARIES ## -LIBS = -lgtk-win32-2.0 \ +LIBS = \ -lglib-2.0 \ - -lgdk-win32-2.0 \ - -lgmodule-2.0 \ -lgobject-2.0 \ -lws2_32 \ -lintl \ @@ -117,15 +111,15 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(LIBGAIM_TOP)/libgaim.dll.a: + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll +$(TARGET).dll: $(OBJECTS) $(LIBGAIM_TOP)/libgaim.dll.a + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## ## CLEAN RULES @@ -134,4 +128,3 @@ clean: rm -rf *.o rm -rf $(TARGET).dll - rm -rf $(TARGET).lib Modified: trunk/libgaim/protocols/jabber/Makefile.mingw =================================================================== --- trunk/libgaim/protocols/jabber/Makefile.mingw 2006-08-20 18:07:53 UTC (rev 16913) +++ trunk/libgaim/protocols/jabber/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -8,10 +8,10 @@ # PATHS # -INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 LIBXML2_DIR:= ../../../../win32-dev/libxml2 GAIM_TOP := ../../.. +LIBGAIM_TOP := ../.. JABBER_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir @@ -27,7 +27,7 @@ DEFINES = -# Static or Plugin... +# Static or Plugin... ifeq ($(TYPE),STATIC) DEFINES += -DSTATIC DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR) @@ -42,7 +42,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -54,14 +54,14 @@ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(LIBXML2_DIR)/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(LIBXML2_DIR)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) ## @@ -124,15 +124,15 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(LIBGAIM_TOP)/libgaim.dll.a: + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll +$(TARGET).dll: $(OBJECTS) $(LIBGAIM_TOP)/libgaim.dll.a + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## ## CLEAN RULES @@ -142,4 +142,3 @@ rm -rf *.o rm -rf ./win32/*.o rm -rf $(TARGET).dll - rm -rf $(TARGET).lib Modified: trunk/libgaim/protocols/msn/Makefile.mingw =================================================================== --- trunk/libgaim/protocols/msn/Makefile.mingw 2006-08-20 18:07:53 UTC (rev 16913) +++ trunk/libgaim/protocols/msn/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -8,9 +8,9 @@ # PATHS # -INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. +LIBGAIM_TOP := ../.. MSN_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir @@ -41,7 +41,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -49,19 +49,15 @@ INCLUDE_PATHS += -I$(MSN_ROOT) \ -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/include/pango-1.0 \ - -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) ## @@ -106,15 +102,13 @@ ## LIBRARIES ## -LIBS = -lgtk-win32-2.0 \ +LIBS = \ -lglib-2.0 \ - -lgdk-win32-2.0 \ - -lgmodule-2.0 \ - -lgobject-2.0 \ - -lws2_32 \ -lintl \ + -lws2_32 \ -lgaim + ## ## RULES ## @@ -140,15 +134,15 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(LIBGAIM_TOP)/libgaim.dll.a: + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll +$(TARGET).dll: $(OBJECTS) $(LIBGAIM_TOP)/libgaim.dll.a + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## @@ -158,4 +152,3 @@ clean: rm -rf *.o rm -rf $(TARGET).dll - rm -rf $(TARGET).lib Modified: trunk/libgaim/protocols/novell/Makefile.mingw =================================================================== --- trunk/libgaim/protocols/novell/Makefile.mingw 2006-08-20 18:07:53 UTC (rev 16913) +++ trunk/libgaim/protocols/novell/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -8,9 +8,9 @@ # PATHS # -INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. +LIBGAIM_TOP := ../../. NOVELL_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir @@ -26,7 +26,7 @@ DEFINES = -# Static or Plugin... +# Static or Plugin... ifeq ($(TYPE),STATIC) DEFINES += -DSTATIC DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR) @@ -41,7 +41,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -49,26 +49,23 @@ INCLUDE_PATHS += -I$(NOVELL_ROOT) \ -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/include/pango-1.0 \ - -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) ## ## SOURCES, OBJECTS ## -C_SRC = nmfield.c \ +C_SRC = \ + nmfield.c \ nmconn.c \ nmconference.c \ nmcontact.c \ @@ -87,11 +84,8 @@ ## LIBRARIES ## -LIBS = -lgtk-win32-2.0 \ +LIBS = \ -lglib-2.0 \ - -lgdk-win32-2.0 \ - -lgmodule-2.0 \ - -lgobject-2.0 \ -lws2_32 \ -lintl \ -lgaim @@ -122,15 +116,15 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(LIBGAIM_TOP)/libgaim.dll.a: + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll +$(TARGET).dll: $(OBJECTS) $(LIBGAIM_TOP)/libgaim.dll.a + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## @@ -140,4 +134,3 @@ clean: rm -rf *.o rm -rf $(TARGET).dll - rm -rf $(TARGET).lib Modified: trunk/libgaim/protocols/oscar/Makefile.mingw =================================================================== --- trunk/libgaim/protocols/oscar/Makefile.mingw 2006-08-20 18:07:53 UTC (rev 16913) +++ trunk/libgaim/protocols/oscar/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -11,6 +11,7 @@ OSCAR_ROOT := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. +LIBGAIM_TOP := ../.. GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir ## @@ -40,7 +41,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -54,13 +55,13 @@ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) ## @@ -68,7 +69,7 @@ ## C_SRC = \ - bstream.c \ + bstream.c \ family_admin.c \ family_advert.c \ family_alert.c \ @@ -90,17 +91,17 @@ family_translate.c \ family_userlookup.c \ flap_connection.c \ - misc.c \ - msgcookie.c \ - odc.c \ - oft.c \ - oscar.c \ + misc.c \ + msgcookie.c \ + odc.c \ + oft.c \ + oscar.c \ oscar_data.c \ - peer.c \ + peer.c \ peer_proxy.c \ rxhandlers.c \ - snac.c \ - tlv.c \ + snac.c \ + tlv.c \ util.c @@ -111,11 +112,8 @@ ## LIBRARIES ## -LIBS = -lgtk-win32-2.0 \ +LIBS = \ -lglib-2.0 \ - -lgdk-win32-2.0 \ - -lgmodule-2.0 \ - -lgobject-2.0 \ -lintl \ -lws2_32 \ -lgaim @@ -146,15 +144,15 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(LIBGAIM_TOP)/libgaim.dll.a: + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll +$(TARGET).dll: $(OBJECTS) $(LIBGAIM_TOP)/libgaim.dll.a + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## ## CLEAN RULES @@ -163,4 +161,3 @@ clean: rm -rf *.o rm -rf $(TARGET).dll - rm -rf $(TARGET).lib Modified: trunk/libgaim/protocols/sametime/Makefile.mingw =================================================================== --- trunk/libgaim/protocols/sametime/Makefile.mingw 2006-08-20 18:07:53 UTC (rev 16913) +++ trunk/libgaim/protocols/sametime/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -12,6 +12,7 @@ GTK_TOP := ../../../../win32-dev/gtk_2_0 MEANWHILE_TOP:= ../../../../win32-dev/meanwhile-1.0.2 GAIM_TOP := ../../.. +LIBGAIM_TOP := ../.. GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir ## @@ -43,7 +44,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -54,13 +55,13 @@ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(MEANWHILE_TOP)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) ## @@ -109,15 +110,15 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(LIBGAIM_TOP)/libgaim.dll.a: + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll +$(TARGET).dll: $(OBJECTS) $(LIBGAIM_TOP)/libgaim.dll.a + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## ## CLEAN RULES @@ -126,4 +127,3 @@ clean: rm -rf *.o rm -rf $(TARGET).dll - rm -rf $(TARGET).lib Modified: trunk/libgaim/protocols/silc/Makefile.mingw =================================================================== --- trunk/libgaim/protocols/silc/Makefile.mingw 2006-08-20 18:07:53 UTC (rev 16913) +++ trunk/libgaim/protocols/silc/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -8,9 +8,9 @@ # PATHS # -INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. +LIBGAIM_TOP := ../.. SILC_TOP := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir SILC_TOOLKIT := ../../../../win32-dev/silc-toolkit-1.0.2 @@ -30,7 +30,7 @@ DEFINES = -# Static or Plugin... +# Static or Plugin... ifeq ($(TYPE),STATIC) DEFINES += -DSTATIC DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR) @@ -45,7 +45,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -55,14 +55,14 @@ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ -I$(GAIM_TOP) \ -I$(SILC_TOOLKIT)/include LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src \ + -L$(LIBGAIM_TOP) \ -L$(SILC_TOOLKIT)/lib @@ -122,14 +122,14 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(LIBGAIM_TOP)/libgaim.dll.a: + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib +$(TARGET).dll: $(OBJECTS) $(LIBGAIM_TOP)/libgaim.dll.a $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--image-base,0x64000000 -o $(TARGET).dll ## @@ -139,4 +139,3 @@ clean: rm -rf *.o rm -rf $(TARGET).dll - rm -rf $(TARGET).lib Modified: trunk/libgaim/protocols/simple/Makefile.mingw =================================================================== --- trunk/libgaim/protocols/simple/Makefile.mingw 2006-08-20 18:07:53 UTC (rev 16913) +++ trunk/libgaim/protocols/simple/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -8,9 +8,9 @@ # PATHS # -INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. +LIBGAIM_TOP := ../.. SIMPLE_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir @@ -26,7 +26,7 @@ DEFINES = -# Static or Plugin... +# Static or Plugin... ifeq ($(TYPE),STATIC) DEFINES += -DSTATIC DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR) @@ -41,7 +41,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -49,19 +49,15 @@ INCLUDE_PATHS += -I$(SIMPLE_ROOT) \ -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/include/pango-1.0 \ - -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) ## @@ -112,15 +108,15 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(LIBGAIM_TOP)/libgaim.dll.a: + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll +$(TARGET).dll: $(OBJECTS) $(LIBGAIM_TOP)/libgaim.dll.a + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## @@ -130,4 +126,3 @@ clean: rm -rf *.o rm -rf $(TARGET).dll - rm -rf $(TARGET).lib Modified: trunk/libgaim/protocols/yahoo/Makefile.mingw =================================================================== --- trunk/libgaim/protocols/yahoo/Makefile.mingw 2006-08-20 18:07:53 UTC (rev 16913) +++ trunk/libgaim/protocols/yahoo/Makefile.mingw 2006-08-20 18:49:08 UTC (rev 16914) @@ -8,9 +8,9 @@ # PATHS # -INCLUDE_DIR := . GTK_TOP := ../../../../win32-dev/gtk_2_0 GAIM_TOP := ../../.. +LIBGAIM_TOP := ../.. YAHOO_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir @@ -26,7 +26,7 @@ DEFINES = -# Static or Plugin... +# Static or Plugin... ifeq ($(TYPE),STATIC) DEFINES += -DSTATIC DLL_INSTALL_DIR = $(GAIM_INSTALL_DIR) @@ -41,7 +41,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -51,13 +51,13 @@ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) ## @@ -118,15 +118,15 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(LIBGAIM_TOP)/libgaim.dll.a: + $(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll +$(TARGET).dll: $(OBJECTS) $(LIBGAIM_TOP)/libgaim.dll.a + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## @@ -136,4 +136,3 @@ clean: rm -rf *.o rm -rf $(TARGET).dll - rm -rf $(TARGET).lib This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dat...@us...> - 2006-08-20 18:08:04
|
Revision: 16913 Author: datallah Date: 2006-08-20 11:07:53 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16913&view=rev Log Message: ----------- re-add as a svn copy to preserve history. Added Paths: ----------- trunk/gtk/win32/win_gaim.c Copied: trunk/gtk/win32/win_gaim.c (from rev 16857, trunk/src/win_gaim.c) =================================================================== --- trunk/gtk/win32/win_gaim.c (rev 0) +++ trunk/gtk/win32/win_gaim.c 2006-08-20 18:07:53 UTC (rev 16913) @@ -0,0 +1,544 @@ +/* + * win_gaim.c + * + * Date: June, 2002 + * Description: Entry point for win32 gaim, and various win32 dependant + * routines. + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* This is for ATTACH_PARENT_PROCESS */ +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x501 +#endif +#include <windows.h> +#include <fcntl.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +#define WIN32_PROXY_REGKEY "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" + +typedef int (CALLBACK* LPFNGAIMMAIN)(HINSTANCE, int, char**); +typedef void (CALLBACK* LPFNSETDLLDIRECTORY)(LPCTSTR); +typedef BOOL (CALLBACK* LPFNATTACHCONSOLE)(DWORD); + +/* + * PROTOTYPES + */ +static LPFNGAIMMAIN gaim_main = NULL; +static LPFNSETDLLDIRECTORY MySetDllDirectory = NULL; + + +static BOOL read_reg_string(HKEY key, char* sub_key, char* val_name, LPBYTE data, LPDWORD data_len) { + HKEY hkey; + BOOL ret = FALSE; + LONG retv; + + if (ERROR_SUCCESS == (retv = RegOpenKeyEx(key, sub_key, 0, + KEY_QUERY_VALUE, &hkey))) { + if (ERROR_SUCCESS == (retv = RegQueryValueEx(hkey, val_name, + NULL, NULL, data, data_len))) + ret = TRUE; + else { + TCHAR szBuf[80]; + + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, + NULL, retv, 0, + (LPTSTR) &szBuf, sizeof(szBuf), NULL); + + printf("Could not read reg key '%s' subkey '%s' value: '%s'\nError: (%ld) %s\n", + ((key == HKEY_LOCAL_MACHINE) ? "HKLM" : + (key == HKEY_CURRENT_USER) ? "HKCU" : + "???"), + sub_key, val_name, retv, szBuf); + } + RegCloseKey(hkey); + } + else { + TCHAR szBuf[80]; + + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, retv, 0, + (LPTSTR) &szBuf, sizeof(szBuf), NULL); + printf("Could not open reg subkey: %s\nError: (%ld) %s\n", + sub_key, retv, szBuf); + } + + return ret; +} + +static void dll_prep() { + char path[MAX_PATH + 1]; + HMODULE hmod; + HKEY hkey; +#ifdef PORTABLE + /* We assume that GTK+ is installed under \\path\to\Gaim\..\GTK + * First we find \\path\to + */ + if (GetModuleFileName(NULL, path, MAX_PATH) != 0) { + char *tmp = path; + char *prev = NULL; + char *prev2 = NULL; + + while ((tmp = strchr(tmp, '\\'))) { + prev2 = prev; + prev = tmp; + tmp++; + } + + if (prev2) { + prev2[0] = '\0'; + } + } else { + printf("Unable to determine current executable path. \n" + "This will prevent the settings dir from being set.\n" + "Assuming GTK+ is in the PATH.\n"); + } + + if (path) { + /* Set up the settings dir base to be \\path\to + * The actual settings dir will be \\path\to\.gaim */ + char settingsdir[strlen(path) + strlen("GAIMHOME=") + 1]; + char aspelldir[strlen(path) + strlen("GAIM_ASPELL_DIR=\\Aspell\\bin") + 1]; + + snprintf(settingsdir, sizeof(settingsdir), "GAIMHOME=%s", path); + printf("Setting settings dir: %s\n", settingsdir); + putenv(settingsdir); + + snprintf(aspelldir, sizeof(aspelldir), "GAIM_ASPELL_DIR=%s\\Aspell\\bin", path); + printf(aspelldir); + putenv(aspelldir); + + /* set the GTK+ path to be \\path\to\GTK\bin */ + strcat(path, "\\GTK\\bin"); + } else + return; +#else /* PORTABLE */ + char gtkpath[MAX_PATH + 1]; + DWORD plen; + + plen = sizeof(gtkpath); + hkey = HKEY_CURRENT_USER; + if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path", + (LPBYTE) >kpath, &plen)) { + hkey = HKEY_LOCAL_MACHINE; + if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path", + (LPBYTE) >kpath, &plen)) { + printf("GTK+ Path Registry Key not found. " + "Assuming GTK+ is in the PATH.\n"); + return; + } + } + + /* this value is replaced during a successful RegQueryValueEx() */ + plen = sizeof(path); + /* Determine GTK+ dll path .. */ + if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "DllPath", + (LPBYTE) &path, &plen)) { + strcpy(path, gtkpath); + strcat(path, "\\bin"); + } +#endif + printf("GTK+ path found: %s\n", path); + + if ((hmod = GetModuleHandle("kernel32.dll"))) { + MySetDllDirectory = (LPFNSETDLLDIRECTORY) GetProcAddress( + hmod, "SetDllDirectoryA"); + if (!MySetDllDirectory) + printf("SetDllDirectory not supported\n"); + } else + printf("Error getting kernel32.dll module handle\n"); + + /* For Windows XP SP1+ / Server 2003 we use SetDllDirectory to avoid dll hell */ + if (MySetDllDirectory) { + printf("Using SetDllDirectory\n"); + MySetDllDirectory(path); + } + + /* For the rest, we set the current directory and make sure + * SafeDllSearch is set to 0 where needed. */ + else { + OSVERSIONINFO osinfo; + + printf("Setting current directory to GTK+ dll directory\n"); + SetCurrentDirectory(path); + /* For Windows 2000 (SP3+) / WinXP (No SP): + * If SafeDllSearchMode is set to 1, Windows system directories are + * searched for dlls before the current directory. Therefore we set it + * to 0. + */ + osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&osinfo); + if ((osinfo.dwMajorVersion == 5 && + osinfo.dwMinorVersion == 0 && + strcmp(osinfo.szCSDVersion, "Service Pack 3") >= 0) || + (osinfo.dwMajorVersion == 5 && + osinfo.dwMinorVersion == 1 && + strcmp(osinfo.szCSDVersion, "") >= 0) + ) { + DWORD regval = 1; + DWORD reglen = sizeof(DWORD); + + printf("Using Win2k (SP3+) / WinXP (No SP)... Checking SafeDllSearch\n"); + read_reg_string(HKEY_LOCAL_MACHINE, + "System\\CurrentControlSet\\Control\\Session Manager", + "SafeDllSearchMode", + (LPBYTE) ®val, + ®len); + + if (regval != 0) { + printf("Trying to set SafeDllSearchMode to 0\n"); + regval = 0; + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, + "System\\CurrentControlSet\\Control\\Session Manager", + 0, KEY_SET_VALUE, &hkey + ) == ERROR_SUCCESS) { + if (RegSetValueEx(hkey, + "SafeDllSearchMode", 0, + REG_DWORD, (LPBYTE) ®val, + sizeof(DWORD) + ) != ERROR_SUCCESS) + printf("Error writing SafeDllSearchMode. Error: %u\n", + (UINT) GetLastError()); + RegCloseKey(hkey); + } else + printf("Error opening Session Manager key for writing. Error: %u\n", + (UINT) GetLastError()); + } else + printf("SafeDllSearchMode is set to 0\n"); + }/*end else*/ + } +} + +static char* wgaim_lcid_to_posix(LCID lcid) { + char *posix = NULL; + int lang_id = PRIMARYLANGID(lcid); + int sub_id = SUBLANGID(lcid); + + switch (lang_id) { + case LANG_ARABIC: break; + case LANG_BULGARIAN: posix = "bg"; break; + case LANG_CATALAN: posix = "ca"; break; + case LANG_CHINESE: + switch (sub_id) { + case SUBLANG_CHINESE_SIMPLIFIED: + posix = "zh_CN"; break; + case SUBLANG_CHINESE_TRADITIONAL: + posix = "zh_TW"; break; + default: + posix = "zh"; break; + } + break; + case LANG_CZECH: posix = "cs"; break; + case LANG_DANISH: posix = "da"; break; + case LANG_GERMAN: posix = "de"; break; + case LANG_GREEK: posix = "el"; break; + case LANG_ENGLISH: + switch (sub_id) { + case SUBLANG_ENGLISH_UK: + posix = "en_GB"; break; + case SUBLANG_ENGLISH_AUS: + posix = "en_AU"; break; + case SUBLANG_ENGLISH_CAN: + posix = "en_CA"; break; + default: + posix = "en"; break; + } + break; + case LANG_SPANISH: posix = "es"; break; + case LANG_FINNISH: posix = "fi"; break; + case LANG_FRENCH: posix = "fr"; break; + case LANG_HEBREW: posix = "he"; break; + case LANG_HUNGARIAN: posix = "hu"; break; + case LANG_ICELANDIC: break; + case LANG_ITALIAN: posix = "it"; break; + case LANG_JAPANESE: posix = "ja"; break; + case LANG_KOREAN: posix = "ko"; break; + case LANG_DUTCH: posix = "nl"; break; + case LANG_NORWEGIAN: + switch (sub_id) { + case SUBLANG_NORWEGIAN_BOKMAL: + posix = "nb"; break; + case SUBLANG_NORWEGIAN_NYNORSK: + posix = "nn"; break; + } + break; + case LANG_POLISH: posix = "pl"; break; + case LANG_PORTUGUESE: + switch (sub_id) { + case SUBLANG_PORTUGUESE_BRAZILIAN: + posix = "pt_BR"; break; + default: + posix = "pt"; break; + } + break; + case LANG_ROMANIAN: posix = "ro"; break; + case LANG_RUSSIAN: posix = "ru"; break; + /* LANG_CROATIAN == LANG_SERBIAN for some reason + * We'll need to do something here if we ever get a croatian translation */ + /* case LANG_CROATIAN: posix = "hr"; break;*/ + case LANG_SERBIAN: + switch (sub_id) { + case SUBLANG_SERBIAN_LATIN: + posix = "sr@Latn"; break; + case SUBLANG_SERBIAN_CYRILLIC: + posix = "sr"; break; + } + break; + case LANG_SLOVAK: posix = "sk"; break; + case LANG_ALBANIAN: posix = "sq"; break; + case LANG_SWEDISH: posix = "sv"; break; + case LANG_THAI: posix = "th"; break; + case LANG_TURKISH: posix = "tr"; break; + case LANG_URDU: break; + case LANG_INDONESIAN: break; + case LANG_UKRAINIAN: posix = "uk"; break; + case LANG_BELARUSIAN: break; + case LANG_SLOVENIAN: posix = "sl"; break; + case LANG_ESTONIAN: posix = "et"; break; + case LANG_LATVIAN: break; + case LANG_LITHUANIAN: posix = "lt"; break; + case LANG_FARSI: break; + case LANG_VIETNAMESE: posix = "vi"; break; + case LANG_ARMENIAN: break; + case LANG_AZERI: posix = "az"; break; + case LANG_BASQUE: break; + case LANG_MACEDONIAN: posix = "mk"; break; + case LANG_AFRIKAANS: break; + case LANG_GEORGIAN: posix = "ka"; break; + case LANG_FAEROESE: break; + case LANG_HINDI: posix = "hi"; break; + case LANG_MALAY: break; + case LANG_KAZAK: break; + case LANG_KYRGYZ: break; + case LANG_SWAHILI: break; + case LANG_UZBEK: break; + case LANG_TATAR: break; + case LANG_BENGALI: break; + case LANG_PUNJABI: posix = "pa"; break; + case LANG_GUJARATI: posix = "gu"; break; + case LANG_ORIYA: break; + case LANG_TAMIL: posix = "ta"; break; + case LANG_TELUGU: break; + case LANG_KANNADA: break; + case LANG_MALAYALAM: break; + case LANG_ASSAMESE: break; + case LANG_MARATHI: break; + case LANG_SANSKRIT: break; + case LANG_MONGOLIAN: break; + case LANG_GALICIAN: posix = "gl"; break; + case LANG_KONKANI: break; + case LANG_MANIPURI: break; + case LANG_SINDHI: break; + case LANG_SYRIAC: break; + case LANG_KASHMIRI: break; + case LANG_NEPALI: break; + case LANG_DIVEHI: break; + } + + /* Deal with exceptions */ + if (posix == NULL) { + switch (lcid) { + case 2125: posix = "my_MM"; break; /* Myanmar (Burmese) */ + case 1076: posix = "xh"; break; /* Xhosa */ + case 9999: posix = "ku"; break; /* Kurdish (from NSIS) */ + } + } + + return posix; +} + +/* Determine and set Gaim locale as follows (in order of priority): + - Check GAIMLANG env var + - Check NSIS Installer Language reg value + - Use default user locale +*/ +static const char *wgaim_get_locale() { + const char *locale = NULL; + LCID lcid; +#ifndef PORTABLE + char data[10]; + DWORD datalen = 10; +#endif + + /* Check if user set GAIMLANG env var */ + if ((locale = getenv("GAIMLANG"))) + return locale; + +#ifndef PORTABLE + if (read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\gaim", + "Installer Language", (LPBYTE) &data, &datalen)) { + if ((locale = wgaim_lcid_to_posix(atoi(data)))) + return locale; + } +#endif + + lcid = GetUserDefaultLCID(); + if ((locale = wgaim_lcid_to_posix(lcid))) + return locale; + + return "en"; +} + +static void wgaim_set_locale() { + const char *locale = NULL; + char envstr[25]; + + locale = wgaim_get_locale(); + + snprintf(envstr, 25, "LANG=%s", locale); + printf("Setting locale: %s\n", envstr); + putenv(envstr); +} + +static BOOL wgaim_set_running() { + HANDLE h; + + if ((h = CreateMutex(NULL, FALSE, "gaim_is_running"))) { + if (GetLastError() == ERROR_ALREADY_EXISTS) { + MessageBox(NULL, + "An instance of Gaim is already running", + NULL, MB_OK | MB_TOPMOST); + return FALSE; + } + } + return TRUE; +} + +static void wgaim_set_proxy() { + DWORD regval = 1; + DWORD reglen = sizeof(DWORD); + + /* If the proxy server environment variables are already set, + * we shouldn't override them */ + if (getenv("HTTP_PROXY") || getenv("http_proxy") || getenv("HTTPPROXY")) + return; + + if (read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY, + "ProxyEnable", + (LPBYTE) ®val, ®len) && (regval & 1)) { + char proxy_server[2048]; + char *c = NULL; + reglen = sizeof(proxy_server); + + if (!read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY, + "ProxyServer", (LPBYTE) &proxy_server, ®len)) + return; + + if ((reglen > strlen("http=")) + && (c = strstr(proxy_server, "http="))) { + char *d; + c += strlen("http="); + d = strchr(c, ';'); + if (d) { + *d = '\0'; + } + /* c now points the proxy server (and port) */ + } + + if (c) { + const char envstr_prefix[] = "HTTP_PROXY=http://"; + char envstr[sizeof(envstr_prefix) + strlen(c) + 1]; + snprintf(envstr, sizeof(envstr), "%s%s", + envstr_prefix, c); + printf("Setting HTTP Proxy: %s\n", envstr); + putenv(envstr); + } + } + +} + +#ifdef __GNUC__ +# ifndef _stdcall +# define _stdcall __attribute__((stdcall)) +# endif +#endif + +int _stdcall +WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance, + char *lpszCmdLine, int nCmdShow) { + char errbuf[512]; + char gaimdir[MAX_PATH]; + HMODULE hmod; + + /* If debug or help or version flag used, create console for output */ + if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h") || strstr(lpszCmdLine, "-v")) { + LPFNATTACHCONSOLE MyAttachConsole = NULL; + if ((hmod = GetModuleHandle("kernel32.dll"))) { + MyAttachConsole = + (LPFNATTACHCONSOLE) + GetProcAddress(hmod, "AttachConsole"); + } + if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS)) + || AllocConsole()) + freopen("CONOUT$", "w", stdout); + } + + /* Load exception handler if we have it */ + if (GetModuleFileName(NULL, gaimdir, MAX_PATH) != 0) { + char *tmp = gaimdir; + char *prev = NULL; + + while ((tmp = strchr(tmp, '\\'))) { + prev = tmp; + tmp++; + } + + if (prev) { + prev[0] = '\0'; + strcat(gaimdir, "\\exchndl.dll"); + if (LoadLibrary(gaimdir)) + printf("Loaded exchndl.dll\n"); + } + } else { + snprintf(errbuf, 512, + "Error getting module filename. Error: %u", + (UINT) GetLastError()); + MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); + } + +#ifndef PORTABLE + if (!getenv("GAIM_NO_DLL_CHECK")) +#endif + dll_prep(); + + wgaim_set_locale(); + /* If help or version flag used, do not check Mutex */ + if (!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v")) + if (!getenv("GAIM_MULTI_INST") && !wgaim_set_running()) + return 0; + + wgaim_set_proxy(); + + /* Now we are ready for Gaim .. */ + if ((hmod = LoadLibrary("gtkgaim.dll"))) { + gaim_main = (LPFNGAIMMAIN) GetProcAddress(hmod, "gaim_main"); + } + + if (!gaim_main) { + snprintf(errbuf, 512, "Error loading gaim.dll. Error: %u", + (UINT) GetLastError()); + MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); + return 0; + } + + return gaim_main (hInstance, __argc, __argv); +} Property changes on: trunk/gtk/win32/win_gaim.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ebl...@us...> - 2006-08-20 18:07:40
|
Revision: 16912 Author: eblanton Date: 2006-08-20 11:07:34 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16912&view=rev Log Message: ----------- libgnt doesn't use sockets, so yoink the configure stuff to prevent linking it Modified Paths: -------------- trunk/console/libgnt/configure.ac Modified: trunk/console/libgnt/configure.ac =================================================================== --- trunk/console/libgnt/configure.ac 2006-08-20 18:05:40 UTC (rev 16911) +++ trunk/console/libgnt/configure.ac 2006-08-20 18:07:34 UTC (rev 16912) @@ -37,43 +37,6 @@ AC_FUNC_STRFTIME AC_CHECK_FUNCS(strdup strstr atexit setlocale) -dnl Check for inet_aton -AC_CHECK_FUNC(inet_aton, , [AC_CHECK_LIB(resolv, inet_aton, , - [AC_ERROR(inet_aton not found)])]) -AC_CHECK_LIB(resolv, __res_query) -AC_CHECK_LIB(nsl, gethostent) -AC_CHECK_FUNC(socket, , - [AC_CHECK_LIB(socket, socket, , [AC_ERROR([socket not found])])]) -dnl If all goes well, by this point the previous two checks will have -dnl pulled in -lsocket and -lnsl if we need them. -AC_CHECK_FUNC(getaddrinfo, [AC_DEFINE([HAVE_GETADDRINFO], [1], - [Define to 1 if you have the getaddrinfo function.])], - [AC_CHECK_LIB(socket, getaddrinfo, - [AC_DEFINE([HAVE_GETADDRINFO]) LIBS="-lsocket -lsnl $LIBS"], , , -lnsl)]) - -dnl Check for socklen_t (in Unix98) -AC_MSG_CHECKING(for socklen_t) -AC_TRY_COMPILE([ - #include <sys/types.h> - #include <sys/socket.h> - socklen_t x; -], [], -[ - AC_MSG_RESULT(yes) -], [ - AC_TRY_COMPILE([ - #include <sys/types.h> - #include <sys/socket.h> - int accept(int, struct sockaddr *, size_t *); - ], [], [ - AC_MSG_RESULT(size_t) - AC_DEFINE(socklen_t, size_t, [socklen_t size]) - ], [ - AC_MSG_RESULT(int) - AC_DEFINE(socklen_t, int, [socklen_t size]) - ]) -]) - dnl to prevent the g_stat()/g_unlink() crash, dnl (09:50:07) Robot101: LSchiere2: it's easy. +LC_SYS_LARGEFILE somewhere in configure.ac AC_SYS_LARGEFILE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dat...@us...> - 2006-08-20 18:05:49
|
Revision: 16911 Author: datallah Date: 2006-08-20 11:05:40 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16911&view=rev Log Message: ----------- Deleting, then I will re-add as a svn copy to preserve history. Removed Paths: ------------- trunk/gtk/win32/win_gaim.c Deleted: trunk/gtk/win32/win_gaim.c =================================================================== --- trunk/gtk/win32/win_gaim.c 2006-08-20 17:49:58 UTC (rev 16910) +++ trunk/gtk/win32/win_gaim.c 2006-08-20 18:05:40 UTC (rev 16911) @@ -1,544 +0,0 @@ -/* - * win_gaim.c - * - * Date: June, 2002 - * Description: Entry point for win32 gaim, and various win32 dependant - * routines. - * - * Gaim is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -/* This is for ATTACH_PARENT_PROCESS */ -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x501 -#endif -#include <windows.h> -#include <fcntl.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -#define WIN32_PROXY_REGKEY "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" - -typedef int (CALLBACK* LPFNGAIMMAIN)(HINSTANCE, int, char**); -typedef void (CALLBACK* LPFNSETDLLDIRECTORY)(LPCTSTR); -typedef BOOL (CALLBACK* LPFNATTACHCONSOLE)(DWORD); - -/* - * PROTOTYPES - */ -static LPFNGAIMMAIN gaim_main = NULL; -static LPFNSETDLLDIRECTORY MySetDllDirectory = NULL; - - -static BOOL read_reg_string(HKEY key, char* sub_key, char* val_name, LPBYTE data, LPDWORD data_len) { - HKEY hkey; - BOOL ret = FALSE; - LONG retv; - - if (ERROR_SUCCESS == (retv = RegOpenKeyEx(key, sub_key, 0, - KEY_QUERY_VALUE, &hkey))) { - if (ERROR_SUCCESS == (retv = RegQueryValueEx(hkey, val_name, - NULL, NULL, data, data_len))) - ret = TRUE; - else { - TCHAR szBuf[80]; - - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, - NULL, retv, 0, - (LPTSTR) &szBuf, sizeof(szBuf), NULL); - - printf("Could not read reg key '%s' subkey '%s' value: '%s'\nError: (%ld) %s\n", - ((key == HKEY_LOCAL_MACHINE) ? "HKLM" : - (key == HKEY_CURRENT_USER) ? "HKCU" : - "???"), - sub_key, val_name, retv, szBuf); - } - RegCloseKey(hkey); - } - else { - TCHAR szBuf[80]; - - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, retv, 0, - (LPTSTR) &szBuf, sizeof(szBuf), NULL); - printf("Could not open reg subkey: %s\nError: (%ld) %s\n", - sub_key, retv, szBuf); - } - - return ret; -} - -static void dll_prep() { - char path[MAX_PATH + 1]; - HMODULE hmod; - HKEY hkey; -#ifdef PORTABLE - /* We assume that GTK+ is installed under \\path\to\Gaim\..\GTK - * First we find \\path\to - */ - if (GetModuleFileName(NULL, path, MAX_PATH) != 0) { - char *tmp = path; - char *prev = NULL; - char *prev2 = NULL; - - while ((tmp = strchr(tmp, '\\'))) { - prev2 = prev; - prev = tmp; - tmp++; - } - - if (prev2) { - prev2[0] = '\0'; - } - } else { - printf("Unable to determine current executable path. \n" - "This will prevent the settings dir from being set.\n" - "Assuming GTK+ is in the PATH.\n"); - } - - if (path) { - /* Set up the settings dir base to be \\path\to - * The actual settings dir will be \\path\to\.gaim */ - char settingsdir[strlen(path) + strlen("GAIMHOME=") + 1]; - char aspelldir[strlen(path) + strlen("GAIM_ASPELL_DIR=\\Aspell\\bin") + 1]; - - snprintf(settingsdir, sizeof(settingsdir), "GAIMHOME=%s", path); - printf("Setting settings dir: %s\n", settingsdir); - putenv(settingsdir); - - snprintf(aspelldir, sizeof(aspelldir), "GAIM_ASPELL_DIR=%s\\Aspell\\bin", path); - printf(aspelldir); - putenv(aspelldir); - - /* set the GTK+ path to be \\path\to\GTK\bin */ - strcat(path, "\\GTK\\bin"); - } else - return; -#else /* PORTABLE */ - char gtkpath[MAX_PATH + 1]; - DWORD plen; - - plen = sizeof(gtkpath); - hkey = HKEY_CURRENT_USER; - if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path", - (LPBYTE) >kpath, &plen)) { - hkey = HKEY_LOCAL_MACHINE; - if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path", - (LPBYTE) >kpath, &plen)) { - printf("GTK+ Path Registry Key not found. " - "Assuming GTK+ is in the PATH.\n"); - return; - } - } - - /* this value is replaced during a successful RegQueryValueEx() */ - plen = sizeof(path); - /* Determine GTK+ dll path .. */ - if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "DllPath", - (LPBYTE) &path, &plen)) { - strcpy(path, gtkpath); - strcat(path, "\\bin"); - } -#endif - printf("GTK+ path found: %s\n", path); - - if ((hmod = GetModuleHandle("kernel32.dll"))) { - MySetDllDirectory = (LPFNSETDLLDIRECTORY) GetProcAddress( - hmod, "SetDllDirectoryA"); - if (!MySetDllDirectory) - printf("SetDllDirectory not supported\n"); - } else - printf("Error getting kernel32.dll module handle\n"); - - /* For Windows XP SP1+ / Server 2003 we use SetDllDirectory to avoid dll hell */ - if (MySetDllDirectory) { - printf("Using SetDllDirectory\n"); - MySetDllDirectory(path); - } - - /* For the rest, we set the current directory and make sure - * SafeDllSearch is set to 0 where needed. */ - else { - OSVERSIONINFO osinfo; - - printf("Setting current directory to GTK+ dll directory\n"); - SetCurrentDirectory(path); - /* For Windows 2000 (SP3+) / WinXP (No SP): - * If SafeDllSearchMode is set to 1, Windows system directories are - * searched for dlls before the current directory. Therefore we set it - * to 0. - */ - osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&osinfo); - if ((osinfo.dwMajorVersion == 5 && - osinfo.dwMinorVersion == 0 && - strcmp(osinfo.szCSDVersion, "Service Pack 3") >= 0) || - (osinfo.dwMajorVersion == 5 && - osinfo.dwMinorVersion == 1 && - strcmp(osinfo.szCSDVersion, "") >= 0) - ) { - DWORD regval = 1; - DWORD reglen = sizeof(DWORD); - - printf("Using Win2k (SP3+) / WinXP (No SP)... Checking SafeDllSearch\n"); - read_reg_string(HKEY_LOCAL_MACHINE, - "System\\CurrentControlSet\\Control\\Session Manager", - "SafeDllSearchMode", - (LPBYTE) ®val, - ®len); - - if (regval != 0) { - printf("Trying to set SafeDllSearchMode to 0\n"); - regval = 0; - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, - "System\\CurrentControlSet\\Control\\Session Manager", - 0, KEY_SET_VALUE, &hkey - ) == ERROR_SUCCESS) { - if (RegSetValueEx(hkey, - "SafeDllSearchMode", 0, - REG_DWORD, (LPBYTE) ®val, - sizeof(DWORD) - ) != ERROR_SUCCESS) - printf("Error writing SafeDllSearchMode. Error: %u\n", - (UINT) GetLastError()); - RegCloseKey(hkey); - } else - printf("Error opening Session Manager key for writing. Error: %u\n", - (UINT) GetLastError()); - } else - printf("SafeDllSearchMode is set to 0\n"); - }/*end else*/ - } -} - -static char* wgaim_lcid_to_posix(LCID lcid) { - char *posix = NULL; - int lang_id = PRIMARYLANGID(lcid); - int sub_id = SUBLANGID(lcid); - - switch (lang_id) { - case LANG_ARABIC: break; - case LANG_BULGARIAN: posix = "bg"; break; - case LANG_CATALAN: posix = "ca"; break; - case LANG_CHINESE: - switch (sub_id) { - case SUBLANG_CHINESE_SIMPLIFIED: - posix = "zh_CN"; break; - case SUBLANG_CHINESE_TRADITIONAL: - posix = "zh_TW"; break; - default: - posix = "zh"; break; - } - break; - case LANG_CZECH: posix = "cs"; break; - case LANG_DANISH: posix = "da"; break; - case LANG_GERMAN: posix = "de"; break; - case LANG_GREEK: posix = "el"; break; - case LANG_ENGLISH: - switch (sub_id) { - case SUBLANG_ENGLISH_UK: - posix = "en_GB"; break; - case SUBLANG_ENGLISH_AUS: - posix = "en_AU"; break; - case SUBLANG_ENGLISH_CAN: - posix = "en_CA"; break; - default: - posix = "en"; break; - } - break; - case LANG_SPANISH: posix = "es"; break; - case LANG_FINNISH: posix = "fi"; break; - case LANG_FRENCH: posix = "fr"; break; - case LANG_HEBREW: posix = "he"; break; - case LANG_HUNGARIAN: posix = "hu"; break; - case LANG_ICELANDIC: break; - case LANG_ITALIAN: posix = "it"; break; - case LANG_JAPANESE: posix = "ja"; break; - case LANG_KOREAN: posix = "ko"; break; - case LANG_DUTCH: posix = "nl"; break; - case LANG_NORWEGIAN: - switch (sub_id) { - case SUBLANG_NORWEGIAN_BOKMAL: - posix = "nb"; break; - case SUBLANG_NORWEGIAN_NYNORSK: - posix = "nn"; break; - } - break; - case LANG_POLISH: posix = "pl"; break; - case LANG_PORTUGUESE: - switch (sub_id) { - case SUBLANG_PORTUGUESE_BRAZILIAN: - posix = "pt_BR"; break; - default: - posix = "pt"; break; - } - break; - case LANG_ROMANIAN: posix = "ro"; break; - case LANG_RUSSIAN: posix = "ru"; break; - /* LANG_CROATIAN == LANG_SERBIAN for some reason - * We'll need to do something here if we ever get a croatian translation */ - /* case LANG_CROATIAN: posix = "hr"; break;*/ - case LANG_SERBIAN: - switch (sub_id) { - case SUBLANG_SERBIAN_LATIN: - posix = "sr@Latn"; break; - case SUBLANG_SERBIAN_CYRILLIC: - posix = "sr"; break; - } - break; - case LANG_SLOVAK: posix = "sk"; break; - case LANG_ALBANIAN: posix = "sq"; break; - case LANG_SWEDISH: posix = "sv"; break; - case LANG_THAI: posix = "th"; break; - case LANG_TURKISH: posix = "tr"; break; - case LANG_URDU: break; - case LANG_INDONESIAN: break; - case LANG_UKRAINIAN: posix = "uk"; break; - case LANG_BELARUSIAN: break; - case LANG_SLOVENIAN: posix = "sl"; break; - case LANG_ESTONIAN: posix = "et"; break; - case LANG_LATVIAN: break; - case LANG_LITHUANIAN: posix = "lt"; break; - case LANG_FARSI: break; - case LANG_VIETNAMESE: posix = "vi"; break; - case LANG_ARMENIAN: break; - case LANG_AZERI: posix = "az"; break; - case LANG_BASQUE: break; - case LANG_MACEDONIAN: posix = "mk"; break; - case LANG_AFRIKAANS: break; - case LANG_GEORGIAN: posix = "ka"; break; - case LANG_FAEROESE: break; - case LANG_HINDI: posix = "hi"; break; - case LANG_MALAY: break; - case LANG_KAZAK: break; - case LANG_KYRGYZ: break; - case LANG_SWAHILI: break; - case LANG_UZBEK: break; - case LANG_TATAR: break; - case LANG_BENGALI: break; - case LANG_PUNJABI: posix = "pa"; break; - case LANG_GUJARATI: posix = "gu"; break; - case LANG_ORIYA: break; - case LANG_TAMIL: posix = "ta"; break; - case LANG_TELUGU: break; - case LANG_KANNADA: break; - case LANG_MALAYALAM: break; - case LANG_ASSAMESE: break; - case LANG_MARATHI: break; - case LANG_SANSKRIT: break; - case LANG_MONGOLIAN: break; - case LANG_GALICIAN: posix = "gl"; break; - case LANG_KONKANI: break; - case LANG_MANIPURI: break; - case LANG_SINDHI: break; - case LANG_SYRIAC: break; - case LANG_KASHMIRI: break; - case LANG_NEPALI: break; - case LANG_DIVEHI: break; - } - - /* Deal with exceptions */ - if (posix == NULL) { - switch (lcid) { - case 2125: posix = "my_MM"; break; /* Myanmar (Burmese) */ - case 1076: posix = "xh"; break; /* Xhosa */ - case 9999: posix = "ku"; break; /* Kurdish (from NSIS) */ - } - } - - return posix; -} - -/* Determine and set Gaim locale as follows (in order of priority): - - Check GAIMLANG env var - - Check NSIS Installer Language reg value - - Use default user locale -*/ -static const char *wgaim_get_locale() { - const char *locale = NULL; - LCID lcid; -#ifndef PORTABLE - char data[10]; - DWORD datalen = 10; -#endif - - /* Check if user set GAIMLANG env var */ - if ((locale = getenv("GAIMLANG"))) - return locale; - -#ifndef PORTABLE - if (read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\gaim", - "Installer Language", (LPBYTE) &data, &datalen)) { - if ((locale = wgaim_lcid_to_posix(atoi(data)))) - return locale; - } -#endif - - lcid = GetUserDefaultLCID(); - if ((locale = wgaim_lcid_to_posix(lcid))) - return locale; - - return "en"; -} - -static void wgaim_set_locale() { - const char *locale = NULL; - char envstr[25]; - - locale = wgaim_get_locale(); - - snprintf(envstr, 25, "LANG=%s", locale); - printf("Setting locale: %s\n", envstr); - putenv(envstr); -} - -static BOOL wgaim_set_running() { - HANDLE h; - - if ((h = CreateMutex(NULL, FALSE, "gaim_is_running"))) { - if (GetLastError() == ERROR_ALREADY_EXISTS) { - MessageBox(NULL, - "An instance of Gaim is already running", - NULL, MB_OK | MB_TOPMOST); - return FALSE; - } - } - return TRUE; -} - -static void wgaim_set_proxy() { - DWORD regval = 1; - DWORD reglen = sizeof(DWORD); - - /* If the proxy server environment variables are already set, - * we shouldn't override them */ - if (getenv("HTTP_PROXY") || getenv("http_proxy") || getenv("HTTPPROXY")) - return; - - if (read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY, - "ProxyEnable", - (LPBYTE) ®val, ®len) && (regval & 1)) { - char proxy_server[2048]; - char *c = NULL; - reglen = sizeof(proxy_server); - - if (!read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY, - "ProxyServer", (LPBYTE) &proxy_server, ®len)) - return; - - if ((reglen > strlen("http=")) - && (c = strstr(proxy_server, "http="))) { - char *d; - c += strlen("http="); - d = strchr(c, ';'); - if (d) { - *d = '\0'; - } - /* c now points the proxy server (and port) */ - } - - if (c) { - const char envstr_prefix[] = "HTTP_PROXY=http://"; - char envstr[sizeof(envstr_prefix) + strlen(c) + 1]; - snprintf(envstr, sizeof(envstr), "%s%s", - envstr_prefix, c); - printf("Setting HTTP Proxy: %s\n", envstr); - putenv(envstr); - } - } - -} - -#ifdef __GNUC__ -# ifndef _stdcall -# define _stdcall __attribute__((stdcall)) -# endif -#endif - -int _stdcall -WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance, - char *lpszCmdLine, int nCmdShow) { - char errbuf[512]; - char gaimdir[MAX_PATH]; - HMODULE hmod; - - /* If debug or help or version flag used, create console for output */ - if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h") || strstr(lpszCmdLine, "-v")) { - LPFNATTACHCONSOLE MyAttachConsole = NULL; - if ((hmod = GetModuleHandle("kernel32.dll"))) { - MyAttachConsole = - (LPFNATTACHCONSOLE) - GetProcAddress(hmod, "AttachConsole"); - } - if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS)) - || AllocConsole()) - freopen("CONOUT$", "w", stdout); - } - - /* Load exception handler if we have it */ - if (GetModuleFileName(NULL, gaimdir, MAX_PATH) != 0) { - char *tmp = gaimdir; - char *prev = NULL; - - while ((tmp = strchr(tmp, '\\'))) { - prev = tmp; - tmp++; - } - - if (prev) { - prev[0] = '\0'; - strcat(gaimdir, "\\exchndl.dll"); - if (LoadLibrary(gaimdir)) - printf("Loaded exchndl.dll\n"); - } - } else { - snprintf(errbuf, 512, - "Error getting module filename. Error: %u", - (UINT) GetLastError()); - MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); - } - -#ifndef PORTABLE - if (!getenv("GAIM_NO_DLL_CHECK")) -#endif - dll_prep(); - - wgaim_set_locale(); - /* If help or version flag used, do not check Mutex */ - if (!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v")) - if (!getenv("GAIM_MULTI_INST") && !wgaim_set_running()) - return 0; - - wgaim_set_proxy(); - - /* Now we are ready for Gaim .. */ - if ((hmod = LoadLibrary("gtkgaim.dll"))) { - gaim_main = (LPFNGAIMMAIN) GetProcAddress(hmod, "gaim_main"); - } - - if (!gaim_main) { - snprintf(errbuf, 512, "Error loading gaim.dll. Error: %u", - (UINT) GetLastError()); - MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); - return 0; - } - - return gaim_main (hInstance, __argc, __argv); -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nos...@us...> - 2006-08-20 17:50:13
|
Revision: 16910 Author: nosnilmot Date: 2006-08-20 10:49:58 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16910&view=rev Log Message: ----------- Fix autogen.sh to run glib-gettextize Fix CFLAGS when gstreamer is not installed Make things work with gtk < 2.6, in part by borrowing some code from gdk Don't link gntgaim with gstreamer, xss or sm Modified Paths: -------------- trunk/autogen.sh trunk/configure.ac trunk/console/Makefile.am trunk/console/libgnt/Makefile.am trunk/console/libgnt/configure.ac trunk/gtk/Makefile.am trunk/gtk/gtkconv.c trunk/gtk/gtkgaim.h trunk/gtk/gtkutils.c trunk/gtk/gtkutils.h trunk/libgaim/Makefile.am trunk/libgaim/xmlnode.c Modified: trunk/autogen.sh =================================================================== --- trunk/autogen.sh 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/autogen.sh 2006-08-20 17:49:58 UTC (rev 16910) @@ -1,5 +1,12 @@ #!/bin/sh +(glib-gettextize --version) < /dev/null > /dev/null 2>&1 || { + echo; + echo "You must have glib-gettextize installed to compile Gaim"; + echo; + exit; +} + (intltoolize --version) < /dev/null > /dev/null 2>&1 || { echo; echo "You must have intltool installed to compile Gaim"; @@ -46,6 +53,7 @@ done libtoolize -c -f --automake +glib-gettextize --force --copy intltoolize --force --copy aclocal $ACLOCAL_FLAGS || exit; autoheader || exit; Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/configure.ac 2006-08-20 17:49:58 UTC (rev 16910) @@ -635,29 +635,21 @@ fi AC_SUBST(CFLAGS) -PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.0 gobject-2.0 gmodule-2.0 gthread-2.0], +PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.0 gobject-2.0 gmodule-2.0 gthread-2.0],, [ - AC_SUBST(GLIB_CFLAGS) - AC_SUBST(GLIB_LIBS) - echo "GLib 2.0 check OK!" - ], - [ AC_MSG_ERROR([ *** GLib 2.0 is required to build Gaim; please make sure you have the GLib *** development headers installed. The latest version of GLib is *** always available at http://www.gtk.org/.]) ]) +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) AC_PATH_PROG(gaimpath, gaim) -if test "$enable_gtk" = yes ; then - PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.0.0], +if test "x$enable_gtk" = "xyes" ; then + PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.0.0],, [ - AC_SUBST(GTK_CFLAGS) - AC_SUBST(GTK_LIBS) - echo "GTK+ 2.0 check OK!" - ], - [ AC_MSG_ERROR([ *** GTK+ 2.0 is required to build Gaim. please make sure you have the GTK+ *** development headers installed. The latest version of GTK+ is @@ -666,6 +658,8 @@ *** If you wish to build just gntgaim or libgaim, *** configure with --disable-gtkgaim]) ]) +AC_SUBST(GTK_CFLAGS) +AC_SUBST(GTK_LIBS) fi AC_PATH_XTRA Modified: trunk/console/Makefile.am =================================================================== --- trunk/console/Makefile.am 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/console/Makefile.am 2006-08-20 17:49:58 UTC (rev 16910) @@ -35,18 +35,16 @@ gntgaiminclude_HEADERS = \ $(gntgaim_headers) -gntgaim_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) $(MS_LIBS) +gntgaim_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) gntgaim_LDFLAGS = -export-dynamic gntgaim_LDADD = \ @LIBOBJS@ \ $(DBUS_LIBS) \ - $(GSTREAMER_LIBS) \ $(STATIC_LINK_LIBS) \ - $(XSS_LIBS) \ - $(SM_LIBS) \ $(INTLLIBS) \ $(GLIB_LIBS) \ $(LIBXML_LIBS) \ + $(GNT_LIBS) \ -L./libgnt/ -lgnt \ -L$(top_srcdir)/libgaim -lgaim @@ -59,7 +57,6 @@ -DSYSCONFDIR=\"$(sysconfdir)\" \ -I$(top_srcdir)/libgaim/ \ -I ./libgnt/ \ - $(GSTREAMER_CFLAGS) \ $(DEBUG_CFLAGS) \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ Modified: trunk/console/libgnt/Makefile.am =================================================================== --- trunk/console/libgnt/Makefile.am 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/console/libgnt/Makefile.am 2006-08-20 17:49:58 UTC (rev 16910) @@ -43,7 +43,7 @@ libgnt_lainclude_HEADERS = \ $(libgnt_la_headers) -libgnt_la_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) $(MS_LIBS) +libgnt_la_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) libgnt_la_LDFLAGS = -export-dynamic libgnt_la_LIBADD = \ $(GLIB_LIBS) \ Modified: trunk/console/libgnt/configure.ac =================================================================== --- trunk/console/libgnt/configure.ac 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/console/libgnt/configure.ac 2006-08-20 17:49:58 UTC (rev 16910) @@ -216,17 +216,15 @@ fi AC_SUBST(CFLAGS) -PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.0 gobject-2.0 gmodule-2.0], +PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.0.0 gobject-2.0 gmodule-2.0],, [ - AC_SUBST(GLIB_CFLAGS) - AC_SUBST(GLIB_LIBS) - ], - [ AC_MSG_ERROR([ *** GLib 2.0 is required to build Gaim; please make sure you have the GLib *** development headers installed. The latest version of GLib is *** always available at http://www.gtk.org/.]) ]) +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) AC_MSG_CHECKING(for me pot o' gold) Modified: trunk/gtk/Makefile.am =================================================================== --- trunk/gtk/Makefile.am 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/gtk/Makefile.am 2006-08-20 17:49:58 UTC (rev 16910) @@ -149,7 +149,7 @@ $(gaim_headers) -gaim_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) $(MS_LIBS) +gaim_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) gaim_LDFLAGS = -export-dynamic gaim_LDADD = \ @LIBOBJS@ \ @@ -172,6 +172,7 @@ -DLOCALEDIR=\"$(datadir)/locale\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -I$(top_srcdir)/libgaim/ \ + $(GLIB_CFLAGS) \ $(GSTREAMER_CFLAGS) \ $(DEBUG_CFLAGS) \ $(GTK_CFLAGS) \ Modified: trunk/gtk/gtkconv.c =================================================================== --- trunk/gtk/gtkconv.c 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/gtk/gtkconv.c 2006-08-20 17:49:58 UTC (rev 16910) @@ -4984,9 +4984,11 @@ gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); - + +#if GTK_CHECK_VERSION(2,6,0) gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID); +#endif l = cbuddies; while (l != NULL) { Modified: trunk/gtk/gtkgaim.h =================================================================== --- trunk/gtk/gtkgaim.h 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/gtk/gtkgaim.h 2006-08-20 17:49:58 UTC (rev 16910) @@ -66,7 +66,7 @@ # include "gtkcellviewmenuitem.h" # if !GTK_CHECK_VERSION(2,4,0) # include "gtkcelllayout.h" -# include "gtkcombobox.h" +# include "gaimcombobox.h" # endif /* Gtk 2.4 */ #endif /* Gtk 2.6 */ Modified: trunk/gtk/gtkutils.c =================================================================== --- trunk/gtk/gtkutils.c 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/gtk/gtkutils.c 2006-08-20 17:49:58 UTC (rev 16910) @@ -2228,7 +2228,7 @@ gtk_widget_destroy(dialog->icon_filesel); if (dialog->callback) - dialog->callback(NULL, data); + dialog->callback(NULL, dialog->data); g_free(dialog); } @@ -2262,7 +2262,7 @@ #else /* FILECHOOSER */ static void -icon_filesel_choose_cb(GtkWidget *w, AccountPrefsDialog *dialog) +icon_filesel_choose_cb(GtkWidget *w, struct _icon_chooser *dialog) { char *filename, *current_folder; @@ -2647,3 +2647,140 @@ return NULL; #endif } + +#if !GTK_CHECK_VERSION(2,6,0) +static void +_gdk_file_scale_size_prepared_cb (GdkPixbufLoader *loader, + int width, + int height, + gpointer data) +{ + struct { + gint width; + gint height; + gboolean preserve_aspect_ratio; + } *info = data; + + g_return_if_fail (width > 0 && height > 0); + + if (info->preserve_aspect_ratio && + (info->width > 0 || info->height > 0)) { + if (info->width < 0) + { + width = width * (double)info->height/(double)height; + height = info->height; + } + else if (info->height < 0) + { + height = height * (double)info->width/(double)width; + width = info->width; + } + else if ((double)height * (double)info->width > + (double)width * (double)info->height) { + width = 0.5 + (double)width * (double)info->height / (double)height; + height = info->height; + } else { + height = 0.5 + (double)height * (double)info->width / (double)width; + width = info->width; + } + } else { + if (info->width > 0) + width = info->width; + if (info->height > 0) + height = info->height; + } + + gdk_pixbuf_loader_set_size (loader, width, height); +} + +GdkPixbuf * +gdk_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, + gboolean preserve_aspect_ratio, + GError **error) +{ + GdkPixbufLoader *loader; + GdkPixbuf *pixbuf; + guchar buffer [4096]; + int length; + FILE *f; + struct { + gint width; + gint height; + gboolean preserve_aspect_ratio; + } info; + GdkPixbufAnimation *animation; + GdkPixbufAnimationIter *iter; + gboolean has_frame; + + g_return_val_if_fail (filename != NULL, NULL); + g_return_val_if_fail (width > 0 || width == -1, NULL); + g_return_val_if_fail (height > 0 || height == -1, NULL); + + f = g_fopen (filename, "rb"); + if (!f) { + gint save_errno = errno; + gchar *display_name = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL); + g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (save_errno), + _("Failed to open file '%s': %s"), + display_name ? display_name : "(unknown)", + g_strerror (save_errno)); + g_free (display_name); + return NULL; + } + + loader = gdk_pixbuf_loader_new (); + + info.width = width; + info.height = height; + info.preserve_aspect_ratio = preserve_aspect_ratio; + + g_signal_connect (loader, "size-prepared", G_CALLBACK (_gdk_file_scale_size_prepared_cb), &info); + + has_frame = FALSE; + while (!has_frame && !feof (f) && !ferror (f)) { + length = fread (buffer, 1, sizeof (buffer), f); + if (length > 0) + if (!gdk_pixbuf_loader_write (loader, buffer, length, error)) { + gdk_pixbuf_loader_close (loader, NULL); + fclose (f); + g_object_unref (loader); + return NULL; + } + + animation = gdk_pixbuf_loader_get_animation (loader); + if (animation) { + iter = gdk_pixbuf_animation_get_iter (animation, 0); + if (!gdk_pixbuf_animation_iter_on_currently_loading_frame (iter)) { + has_frame = TRUE; + } + g_object_unref (iter); + } + } + + fclose (f); + + if (!gdk_pixbuf_loader_close (loader, error) && !has_frame) { + g_object_unref (loader); + return NULL; + } + + pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); + + if (!pixbuf) { + gchar *display_name = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL); + g_object_unref (loader); + g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, + _("Failed to load image '%s': reason not known, probably a corrupt image file"), + display_name ? display_name : "(unknown)"); + g_free (display_name); + return NULL; + } + + g_object_ref (pixbuf); + + g_object_unref (loader); + + return pixbuf; +} +#endif + Modified: trunk/gtk/gtkutils.h =================================================================== --- trunk/gtk/gtkutils.h 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/gtk/gtkutils.h 2006-08-20 17:49:58 UTC (rev 16910) @@ -479,4 +479,15 @@ */ char* gaim_gtk_convert_buddy_icon(GaimPlugin *plugin, const char *path); +#if !GTK_CHECK_VERSION(2,6,0) +/** + * Creates a new pixbuf by loading an image from a file. The image will + * be scaled to fit in the requested size, optionally preserving the image's + * aspect ratio. + */ +GdkPixbuf *gdk_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, + gboolean preserve_aspect_ratio, + GError **error); +#endif + #endif /* _GAIM_GTKUTILS_H_ */ Modified: trunk/libgaim/Makefile.am =================================================================== --- trunk/libgaim/Makefile.am 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/libgaim/Makefile.am 2006-08-20 17:49:58 UTC (rev 16910) @@ -250,7 +250,7 @@ $(gaim_coreheaders) \ $(dbus_headers) -libgaim_la_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) $(MS_LIBS) +libgaim_la_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) libgaim_la_LDFLAGS = -export-dynamic libgaim_la_LIBADD = \ @LIBOBJS@ \ @@ -267,7 +267,6 @@ -DLIBDIR=\"$(libdir)/gaim/\" \ -DLOCALEDIR=\"$(datadir)/locale\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \ - -I$(top_srcdir)/plugins \ $(GLIB_CFLAGS) \ $(DEBUG_CFLAGS) \ $(DBUS_CFLAGS) \ Modified: trunk/libgaim/xmlnode.c =================================================================== --- trunk/libgaim/xmlnode.c 2006-08-20 17:40:31 UTC (rev 16909) +++ trunk/libgaim/xmlnode.c 2006-08-20 17:49:58 UTC (rev 16910) @@ -403,12 +403,15 @@ xmlnode_set_namespace(node, namespace); for(i=0; i < nb_attributes * 5; i+=5) { +#ifdef HAVE_LIBXML + char *txt; +#endif int attrib_len = attributes[i+4] - attributes[i+3]; char *attrib = g_malloc(attrib_len + 1); memcpy(attrib, attributes[i+3], attrib_len); attrib[attrib_len] = '\0'; #ifdef HAVE_LIBXML - char *txt = attrib; + txt = attrib; attrib = gaim_unescape_html(txt); g_free(txt); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rl...@us...> - 2006-08-20 17:40:38
|
Revision: 16909 Author: rlaager Date: 2006-08-20 10:40:31 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16909&view=rev Log Message: ----------- Update the home page with a link to 2.0.0beta3.1 Modified Paths: -------------- web/htdocs/news.txt Modified: web/htdocs/news.txt =================================================================== --- web/htdocs/news.txt 2006-08-20 17:34:21 UTC (rev 16908) +++ web/htdocs/news.txt 2006-08-20 17:40:31 UTC (rev 16909) @@ -1,6 +1,8 @@ MSN Crashing August 16th, 2006 - 6:58PM PDT -Yesterday, Gaim started crashing for a bunch of people (most notably Windows users) when trying to connect a MSN account. This is due to a bug in Gaim which has been fixed in subversion (<a href="faq.php#q14">don't use subversion</a>), and we're working on releasing a fix. We'll keep you updated. In the meantime, feel free to <a href='https://sourceforge.net/forum/message.php?msg_id=3867971'>commiserate</a> with your fellow MSN-using Wingaim users. :) +Yesterday, Gaim started crashing for a bunch of people (most notably Windows users) when trying to connect a MSN account. +<b>* Update - August 20th, 2006 - 12:32 CDT *</b> +Gaim 2.0.0beta3.1 has been released which fixes this and other bugs in beta3. You can download it from its <a href="http://sourceforge.net/project/showfiles.php?group_id=235&package_id=253&release_id=440695">SourceForge file release page</a>. # Summer of Code Update July 6th, 2006 - 11:58PM PDT This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ebl...@us...> - 2006-08-20 17:34:26
|
Revision: 16908 Author: eblanton Date: 2006-08-20 10:34:21 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16908&view=rev Log Message: ----------- gnt plugins should probably be in SUBDIRS Modified Paths: -------------- trunk/console/Makefile.am Modified: trunk/console/Makefile.am =================================================================== --- trunk/console/Makefile.am 2006-08-20 17:10:15 UTC (rev 16907) +++ trunk/console/Makefile.am 2006-08-20 17:34:21 UTC (rev 16908) @@ -1,6 +1,6 @@ if ENABLE_GNT -SUBDIRS = libgnt +SUBDIRS = libgnt plugins bin_PROGRAMS = gntgaim This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nos...@us...> - 2006-08-20 17:10:21
|
Revision: 16907 Author: nosnilmot Date: 2006-08-20 10:10:15 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16907&view=rev Log Message: ----------- Fix a warning: gntrequest.c:250: warning: ISO C90 forbids mixed declarations and code Amazing what a stray semicolon can do Modified Paths: -------------- trunk/console/gntrequest.c Modified: trunk/console/gntrequest.c =================================================================== --- trunk/console/gntrequest.c 2006-08-20 17:00:38 UTC (rev 16906) +++ trunk/console/gntrequest.c 2006-08-20 17:10:15 UTC (rev 16907) @@ -246,7 +246,7 @@ } else if (type == GAIM_REQUEST_FIELD_CHOICE) { - GntWidget *combo = field->ui_data;; + GntWidget *combo = field->ui_data; int id; id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); gaim_request_field_choice_set_value(field, id); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nos...@us...> - 2006-08-20 17:00:46
|
Revision: 16906 Author: nosnilmot Date: 2006-08-20 10:00:38 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16906&view=rev Log Message: ----------- Make the gstreamer-devel BuildReq optional and restore some names in the %changelog Modified Paths: -------------- trunk/gaim.spec.in Modified: trunk/gaim.spec.in =================================================================== --- trunk/gaim.spec.in 2006-08-20 16:49:37 UTC (rev 16905) +++ trunk/gaim.spec.in 2006-08-20 17:00:38 UTC (rev 16906) @@ -27,7 +27,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-root # Generic build requirements -BuildRequires: libtool, pkgconfig, intltool, gettext, gstreamer-devel +BuildRequires: libtool, pkgconfig, intltool, gettext +%{!?_without_gstreamer:BuildRequires: gstreamer-devel} %{?_with_avahi:BuildRequires: avahi-compat-howl avahi-compat-howl-devel} %{?_with_howl:BuildRequires: howl-devel} %{?_with_silc:BuildRequires: /usr/include/silc/silcclient.h} @@ -179,7 +180,8 @@ %{!?_with_tcl:--disable-tcl} \ %{!?_with_dbus:--disable-dbus} \ %{?_without_gtkspell:--disable-gtkspell} \ - %{?_with_sasl:--enable-cyrus-sasl} + %{?_with_sasl:--enable-cyrus-sasl} \ + %{?_without_gstreamer:--disable-gstreamer} make %{?_smp_mflags} @@ -323,21 +325,25 @@ %endif %changelog -* Tue Aug 15 2006 <the...@us...> +* Sun Aug 20 2006 Stu Tomlinson <st...@no...> +- Make the gstreamer-devel dependency overridable with '--without-gstreamer' + to allow building on older distributions without suitable gstreamer + +* Tue Aug 15 2006 Mark Doliner <the...@us...> - Add a BuildRequire for gstreamer-devel - Remove the BuildRequires for audiofile-devel and libao-devel -* Mon May 8 2006 <the...@us...> +* Mon May 8 2006 Mark Doliner <the...@us...> - Add --with avahi option to compile the gaim-bonjour package against Avahi's Howl compatibility layer -* Wed Mar 29 2006 <st...@no...> +* Wed Mar 29 2006 Stu Tomlinson <st...@no...> - Source RPM uses tar.bz2 now to save space - Update BuildRequires for new intltool dependencies - Add a --with perlmakehack option to allow builds to succeed on RH9 - Add a --with gadugadu to build (separate) gaim-gadugadu package -* Sat Dec 17 2005 <st...@no...> +* Sat Dec 17 2005 Stu Tomlinson <st...@no...> - Add support for beta versions so the subsequent releases are seen as newer by RPM - Split of sametime support to gaim-meanwhile @@ -345,19 +351,19 @@ - Default build to include cyrus-sasl support in Jabber - Add --with dbus to build with DBUS support -* Sun Dec 04 2005 <si...@pr...> +* Sun Dec 04 2005 Christopher O'Brien <si...@pr...> - Added obsoletes gaim-meanwhile -* Sun Oct 30 2005 <st...@no...> +* Sun Oct 30 2005 Stu Tomlinson <st...@no...> - Add separate gaim-bonjour package if built with --with-howl - Add separate gaim-mono package if built with --with-mono - Exclude some unwanted perl files -* Sat Aug 20 2005 <st...@no...> +* Sat Aug 20 2005 Stu Tomlinson <st...@no...> - Include libgaimperl.so - Include gaim.m4 in gaim-devel -* Thu Apr 28 2005 <st...@no...> +* Thu Apr 28 2005 Stu Tomlinson <st...@no...> - Use perl_vendorlib & perl_archlib for better 64bit compat (Jeff Mahoney) - Clean up Requires, most should be auto-detected - Restore gtkspell-devel build requirement (and add --without gtkspell option) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dat...@us...> - 2006-08-20 16:50:19
|
Revision: 16905 Author: datallah Date: 2006-08-20 09:49:37 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16905&view=rev Log Message: ----------- First step of getting wingaim working again. libgaim and gtk are compiling. The protocols aren't compiling yet. There are a number of things that are compiling, but should be cleaned up. Modified Paths: -------------- trunk/gtk/gtkmain.c trunk/gtk/gtknotify.c trunk/gtk/gtkprefs.c trunk/gtk/plugins/docklet/Makefile.mingw trunk/gtk/plugins/docklet/docklet-win32.c trunk/gtk/plugins/ticker/Makefile.mingw trunk/gtk/plugins/win32/transparency/Makefile.mingw trunk/gtk/plugins/win32/winprefs/Makefile.mingw trunk/gtk/plugins/win32/winprefs/winprefs.c trunk/gtk/win32/IdleTracker/Makefile.mingw trunk/gtk/win32/gaimrc.rc trunk/libgaim/core.c trunk/libgaim/plugins/perl/Makefile.mingw trunk/libgaim/plugins/ssl/Makefile.mingw trunk/libgaim/plugins/tcl/Makefile.mingw Added Paths: ----------- trunk/gtk/Makefile.mingw trunk/gtk/plugins/Makefile.mingw trunk/gtk/plugins/win32/ trunk/gtk/win32/gtkwin32dep.c trunk/gtk/win32/gtkwin32dep.h trunk/gtk/win32/win_gaim.c trunk/libgaim/Makefile.mingw trunk/libgaim/plugins/Makefile.mingw trunk/libgaim/win32/ trunk/libgaim/win32/global.mak trunk/libgaim/win32/libc_interface.c trunk/libgaim/win32/libc_interface.h trunk/libgaim/win32/libc_internal.h trunk/libgaim/win32/wgaimerror.h trunk/libgaim/win32/win32dep.c trunk/libgaim/win32/win32dep.h Removed Paths: ------------- trunk/gtk/win32/global.mak trunk/gtk/win32/libc_interface.c trunk/gtk/win32/libc_interface.h trunk/gtk/win32/libc_internal.h trunk/gtk/win32/wgaimerror.h trunk/gtk/win32/win32dep.c trunk/gtk/win32/win32dep.h Property Changed: ---------------- trunk/gtk/ trunk/gtk/plugins/ trunk/gtk/plugins/win32/transparency/ trunk/gtk/plugins/win32/winprefs/ trunk/gtk/win32/IdleTracker/ trunk/libgaim/ trunk/libgaim/plugins/ Property changes on: trunk/gtk ___________________________________________________________________ Name: svn:ignore - Makefile.in .deps Makefile + Makefile.in .deps Makefile *.dll gtkgaim.dll.a *.exe Added: trunk/gtk/Makefile.mingw =================================================================== --- trunk/gtk/Makefile.mingw (rev 0) +++ trunk/gtk/Makefile.mingw 2006-08-20 16:49:37 UTC (rev 16905) @@ -0,0 +1,229 @@ +# +# Makefile.mingw +# +# Description: Makefile for win32 (mingw) version of Gaim +# + +# +# PATHS +# + +GTK_TOP := ../../win32-dev/gtk_2_0 +GAIM_TOP := .. +GTKGAIM_TOP := . +LIBGAIM_TOP := ../libgaim +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 + +## +## VARIABLE DEFINITIONS +## + +EXE_TARGET = gaim + +GTKGAIM_TARGET = gtkgaim + +# Compiler and Linker Options + +CFLAGS = + +DEFINES = + +ifeq ($(MAKECMDGOALS), $(EXE_TARGET)-portable.exe) +DEFINES := $(DEFINES) -DPORTABLE +endif + +WINAPP := -mwindows +# The Debug version of gaim is a console app, always having a console +CONSOLEAPP := -mconsole + +LDFLAGS := $(WINAPP) + +WINDRES := windres + +## +## INCLUDE MAKEFILES +## + +include $(LIBGAIM_TOP)/win32/global.mak + +## +## INCLUDE PATHS +## + +LIBGAIM_INCLUDE_PATHS = \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ + -I$(GAIM_TOP) \ + -I$(GTK_TOP)/include \ + -I$(GTK_TOP)/include/glib-2.0 \ + -I$(GTK_TOP)/lib/glib-2.0/include + +# -I$(LIBXML2_DIR)/include + +INCLUDE_PATHS = \ + $(LIBGAIM_INCLUDE_PATHS) \ + -I$(IDLETRACK_TOP) \ + -I$(GTKGAIM_TOP) \ + -I$(GTKGAIM_TOP)/win32 \ + -I$(GTK_TOP)/include/gtk-2.0 \ + -I$(GTK_TOP)/include/pango-1.0 \ + -I$(GTK_TOP)/include/atk-1.0 \ + -I$(GTK_TOP)/lib/gtk-2.0/include \ + -I$(GTKSPELL_TOP) \ + -I$(ASPELL_TOP)/include + + + +LIB_PATHS = -L$(GTK_TOP)/lib \ + -L$(LIBGAIM_TOP) \ + -L$(GTKGAIM_TOP) \ + -L$(IDLETRACK_TOP) \ + -L$(ASPELL_TOP)/lib + +# -L$(LIBXML2_DIR)/lib + +## +## SOURCES, OBJECTS +## + +GTKGAIM_C_SRC = \ + gaimstock.c \ + gtkaccount.c \ + gtkblist.c \ + gtkconn.c \ + gtkconv.c \ + gtkcellrendererprogress.c \ + gtkdebug.c \ + gtkdialogs.c \ + gtkdnd-hints.c \ + gtkeventloop.c \ + gtkexpander.c \ + gtkft.c \ + gtkidle.c \ + gtkimhtml.c \ + gtkimhtmltoolbar.c \ + gtklog.c \ + gtkmain.c \ + gtkmenutray.c \ + gtknotify.c \ + gtkplugin.c \ + gtkpluginpref.c \ + gtkpounce.c \ + gtkprefs.c \ + gtkprivacy.c \ + gtkrequest.c \ + gtkroomlist.c \ + gtksavedstatuses.c \ + gtksound.c \ + gtksourceiter.c \ + gtkstatusbox.c \ + gtkthemes.c \ + gtkutils.c \ + gtkwhiteboard.c \ + win32/gtkwin32dep.c \ + win32/untar.c \ + win32/wspell.c + +RC_SRC = win32/gaimrc.rc + +EXE_C_SRC = win32/win_gaim.c + +GTKGAIM_OBJECTS = $(GTKGAIM_C_SRC:%.c=%.o) + +EXE_OBJECTS = $(EXE_C_SRC:%.c=%.o) $(RC_SRC:%.rc=%.o) + +## +## LIBRARIES +## + +LIBGAIM_LIBS = \ + -lgaim \ + -lglib-2.0 \ + -lgthread-2.0 \ + -lgobject-2.0 \ + -lgmodule-2.0 \ + -lintl \ + -lws2_32 \ + -lwinmm \ + -lz \ + -liberty \ + -lidletrack + +# -lxml2 + +GTKGAIM_LIBS = \ + $(LIBGAIM_LIBS) \ + -lgtk-win32-2.0 \ + -latk-1.0 \ + -lpango-1.0 \ + -lgdk-win32-2.0 \ + -lgdk_pixbuf-2.0 + +EXE_LIBS = + +## +## RULES +## + +# How to make a C file +%.o: %.c + $(CC) $(CFLAGS) $(INCLUDE_PATHS) $(DEFINES) -c $< -o $@ + +# How to make an RC file +%.o: %.rc + $(WINDRES) -i $< -o $@ + +## +## TARGET DEFINITIONS +## + +.PHONY: all clean libgaim_include_path gtkgaim_include_path + +all: $(EXE_TARGET).exe $(GTKGAIM_TARGET).dll + +install: all + cp $(GTKGAIM_TOP)/$(EXE_TARGET).exe $(GTKGAIM_TOP)/$(GTKGAIM_TARGET).dll $(GAIM_INSTALL_DIR) + +$(LIBGAIM_TOP)/libgaim.dll.a: + S(MAKE) -C $(LIBGAIM_TOP) -f Makefile.mingw libgaim.dll.a + +$(IDLETRACK_TOP)/idletrack.dll: + $(MAKE) -C $(IDLETRACK_TOP) -f Makefile.mingw + +# +# 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 + +# +# BUILD EXE +# + +$(EXE_TARGET).exe: $(GTKGAIM_TARGET).dll $(EXE_OBJECTS) + $(CC) $(LDFLAGS) $(EXE_OBJECTS) $(LIB_PATHS) $(EXE_LIBS) -o $(EXE_TARGET).exe + +$(EXE_TARGET)-portable.exe: clean_exe $(EXE_OBJECTS) + $(CC) $(LDFLAGS) $(EXE_OBJECTS) $(LIB_PATHS) $(EXE_LIBS) -o $(EXE_TARGET)-portable.exe + rm win_gaim.o + +## +## CLEAN RULES +## + +clean: + $(MAKE) -C $(IDLETRACK_TOP) -f Makefile.mingw clean + rm -rf *.o ./win32/*.o + rm -rf $(GTKGAIM_TARGET).dll + rm -rf $(GTKGAIM_TARGET).dll.a + rm -rf $(EXE_TARGET).exe + +clean_exe: + rm -rf win_gaim.o Property changes on: trunk/gtk/Makefile.mingw ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/gtk/gtkmain.c =================================================================== --- trunk/gtk/gtkmain.c 2006-08-20 16:45:57 UTC (rev 16904) +++ trunk/gtk/gtkmain.c 2006-08-20 16:49:37 UTC (rev 16905) @@ -78,7 +78,7 @@ #endif #ifdef _WIN32 -# include "wspell.h" +# include "gtkwin32dep.h" #endif @@ -635,9 +635,6 @@ gaim_debug_set_enabled(debug_enabled); -#ifdef _WIN32 - wgaim_init(hint); -#endif search_path = g_build_filename(gaim_user_dir(), "gtkrc-2.0", NULL); gtk_rc_add_default_file(search_path); @@ -668,11 +665,7 @@ } #ifdef _WIN32 - /** TODO: Move this to a wgaim_gtk_init() if we need such a thing */ - wgaim_gtkspell_init(); - gaim_debug_info("wgaim", "GTK+ :%u.%u.%u\n", - gtk_major_version, gtk_minor_version, gtk_micro_version); - + gtkwgaim_init(hint); #endif gaim_core_set_ui_ops(gaim_gtk_core_get_ui_ops()); @@ -784,7 +777,7 @@ #endif #ifdef _WIN32 - wgaim_cleanup(); + gtkwgaim_cleanup(); #endif return 0; Modified: trunk/gtk/gtknotify.c =================================================================== --- trunk/gtk/gtknotify.c 2006-08-20 16:45:57 UTC (rev 16904) +++ trunk/gtk/gtknotify.c 2006-08-20 16:49:37 UTC (rev 16905) @@ -38,6 +38,10 @@ #include "gtknotify.h" #include "gtkutils.h" +#ifdef _WIN32 +# include "gtkwin32dep.h" +#endif + typedef struct { GaimConnection *gc; @@ -116,7 +120,7 @@ if (id == GTK_RESPONSE_YES) { GtkTreeSelection *selection; - + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); if (gtk_tree_selection_get_selected(selection, NULL, &iter)) @@ -762,7 +766,7 @@ gaim_notify_searchresults_column_get_title(results, i-1), renderer, "text", i, NULL); } - + /* Setup the button area */ button_area = gtk_hbutton_box_new(); gtk_box_pack_start(GTK_BOX(vbox), button_area, FALSE, FALSE, 0); @@ -1072,7 +1076,7 @@ g_free(command); #else /* !_WIN32 */ - wgaim_notify_uri(uri); + gtkwgaim_notify_uri(uri); #endif /* !_WIN32 */ return NULL; Modified: trunk/gtk/gtkprefs.c =================================================================== --- trunk/gtk/gtkprefs.c 2006-08-20 16:45:57 UTC (rev 16904) +++ trunk/gtk/gtkprefs.c 2006-08-20 16:49:37 UTC (rev 16905) @@ -50,6 +50,10 @@ #include "gtkutils.h" #include "gaimstock.h" +#ifdef _WIN32 +# include "gtkwin32dep.h" +#endif + #define PROXYHOST 0 #define PROXYPORT 1 #define PROXYUSER 2 @@ -494,7 +498,7 @@ g_free(path_escaped); g_free(destdir_escaped); #else - if(!wgaim_gz_untar(path, destdir)) { + if(!gtkwgaim_gz_untar(path, destdir)) { g_free(destdir); return; } Property changes on: trunk/gtk/plugins ___________________________________________________________________ Name: svn:ignore - Makefile.in .deps Makefile + Makefile.in .deps Makefile *.dll Added: trunk/gtk/plugins/Makefile.mingw =================================================================== --- trunk/gtk/plugins/Makefile.mingw (rev 0) +++ trunk/gtk/plugins/Makefile.mingw 2006-08-20 16:49:37 UTC (rev 16905) @@ -0,0 +1,136 @@ +# +# Makefile.mingw +# +# Description: Makefile for win32 (mingw) version of Gaim Plugins +# + +# +# PATHS +# + +GAIM_PLUGINS := . +GAIM_TOP := ../.. +GTKGAIM_TOP := .. +LIBGAIM_TOP := $(GAIM_TOP)/libgaim +GTK_TOP := ../../../win32-dev/gtk_2_0 +#OSCAR_ROOT := ../src/protocols/oscar +GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir +TICKER := ./ticker +TRANSPARENCY := ./win32/transparency +WINPREFS := ./win32/winprefs +#PERL_PLUGIN_LOADER := ./perl +DOCKLET := ./docklet + +## +## VARIABLE DEFINITIONS +## + +# Compiler Options + +CFLAGS = + +DEFINES = + +.SUFFIXES: +.SUFFIXES: .c .dll + +## +## INCLUDE MAKEFILES +## + +include $(LIBGAIM_TOP)/win32/global.mak + +## +## INCLUDE PATHS +## + +INCLUDE_PATHS += \ + -I$(GTK_TOP)/include \ + -I$(GTK_TOP)/include/gtk-2.0 \ + -I$(GTK_TOP)/include/glib-2.0 \ + -I$(GTK_TOP)/include/pango-1.0 \ + -I$(GTK_TOP)/include/atk-1.0 \ + -I$(GTK_TOP)/lib/glib-2.0/include \ + -I$(GTK_TOP)/lib/gtk-2.0/include \ + -I$(GAIM_TOP) \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ + -I$(GTKGAIM_TOP) \ + -I$(GTKGAIM_TOP)/win32 + + +LIB_PATHS = -L$(GTK_TOP)/lib \ + -L$(LIBGAIM_TOP) \ + -L$(GTKGAIM_TOP) + + +## +## LIBRARIES +## + +LIBS = -lgtk-win32-2.0 \ + -lglib-2.0 \ + -lgdk-win32-2.0 \ + -lgobject-2.0 \ + -lgmodule-2.0 \ + -lgdk_pixbuf-2.0 \ + -lpango-1.0 \ + -lintl \ + -lws2_32 \ + -lgaim \ + -lgtkgaim + +## +## RULES +## + +## +## TARGET DEFINITIONS +## + +.PHONY: all clean + +all: plugins + $(MAKE) -C $(TICKER) -f Makefile.mingw + $(MAKE) -C $(WINPREFS) -f Makefile.mingw + $(MAKE) -C $(TRANSPARENCY) -f Makefile.mingw + $(MAKE) -C $(DOCKLET) -f Makefile.mingw + +install: + cp $(GAIM_PLUGINS)/*.dll $(GAIM_INSTALL_DIR)/plugins + $(MAKE) -C $(TICKER) -f Makefile.mingw install + $(MAKE) -C $(WINPREFS) -f Makefile.mingw install + $(MAKE) -C $(TRANSPARENCY) -f Makefile.mingw install + $(MAKE) -C $(DOCKLET) -f Makefile.mingw install + +# +# BUILD Plugin +# + +.c.dll: + $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@.o -c $< + $(CC) -shared $@.o $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $@ + +plugins: \ + extplacement.dll \ + gaimrc.dll \ + history.dll \ + iconaway.dll \ + notify.dll \ + relnot.dll \ + spellchk.dll \ + timestamp_format.dll \ + timestamp.dll + + +## +## CLEAN RULES +## + +clean: + rm -rf *.o + rm -rf *.dll + $(MAKE) -C $(TICKER) -f Makefile.mingw clean + $(MAKE) -C $(TRANSPARENCY) -f Makefile.mingw clean + $(MAKE) -C $(WINPREFS) -f Makefile.mingw clean + $(MAKE) -C $(DOCKLET) -f Makefile.mingw clean Property changes on: trunk/gtk/plugins/Makefile.mingw ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/gtk/plugins/docklet/Makefile.mingw =================================================================== --- trunk/gtk/plugins/docklet/Makefile.mingw 2006-08-20 16:45:57 UTC (rev 16904) +++ trunk/gtk/plugins/docklet/Makefile.mingw 2006-08-20 16:49:37 UTC (rev 16905) @@ -8,8 +8,10 @@ # PATHS # -GTK_TOP := ../../../win32-dev/gtk_2_0 -GAIM_TOP := ../.. +GTK_TOP := ../../../../win32-dev/gtk_2_0 +GAIM_TOP := ../../.. +LIBGAIM_TOP := $(GAIM_TOP)/libgaim +GTKGAIM_TOP := $(GAIM_TOP)/gtk GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir DLL_INSTALL_DIR := $(GAIM_INSTALL_DIR)/plugins @@ -29,7 +31,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -43,13 +45,16 @@ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ + -I$(GTKGAIM_TOP) \ + -I$(GTKGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) \ + -L$(GTKGAIM_TOP) ## @@ -71,11 +76,10 @@ LIBS = -lgtk-win32-2.0 \ -lglib-2.0 \ -lgdk-win32-2.0 \ - -lgmodule-2.0 \ -lgobject-2.0 \ - -lws2_32 \ -lintl \ - -lgaim + -lgaim \ + -lgtkgaim ## @@ -103,14 +107,15 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(GTKGAIM_TOP)/gtkgaim.dll.a: + $(MAKE) -C $(GTKGAIM_TOP) -f Makefile.mingw gtkgaim.dll.a + ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib +$(TARGET).dll: $(OBJECTS) $(GTKGAIM_TOP)/gtkgaim.dll.a $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## Modified: trunk/gtk/plugins/docklet/docklet-win32.c =================================================================== --- trunk/gtk/plugins/docklet/docklet-win32.c 2006-08-20 16:45:57 UTC (rev 16904) +++ trunk/gtk/plugins/docklet/docklet-win32.c 2006-08-20 16:49:37 UTC (rev 16905) @@ -36,6 +36,7 @@ #include "resource.h" #include "MinimizeToTray.h" +#include "gtkwin32dep.h" #include "docklet.h" /* @@ -115,7 +116,7 @@ wcex.lpfnWndProc = (WNDPROC)systray_mainmsg_handler; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; - wcex.hInstance = wgaim_hinstance(); + wcex.hInstance = gtkwgaim_hinstance(); wcex.hIcon = NULL; wcex.hCursor = NULL, wcex.hbrBackground = NULL; @@ -126,7 +127,7 @@ RegisterClassEx(&wcex); /* Create the window */ - return (CreateWindow(wname, "", 0, 0, 0, 0, 0, GetDesktopWindow(), NULL, wgaim_hinstance(), 0)); + return (CreateWindow(wname, "", 0, 0, 0, 0, 0, GetDesktopWindow(), NULL, gtkwgaim_hinstance(), 0)); } static void systray_init_icon(HWND hWnd, HICON icon) { @@ -212,19 +213,19 @@ * but will scale it back to 4-bits for display. * That is why we use custom 4-bit icons for pre XP Windowses */ if (osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion > 0) { - sysicon_disconn = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_OFFLINE_TRAY_ICON), IMAGE_ICON, 16, 16, 0); - sysicon_conn = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_TRAY_ICON), IMAGE_ICON, 16, 16, 0); - sysicon_away = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAY_TRAY_ICON), IMAGE_ICON, 16, 16, 0); - sysicon_pend = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_PEND_TRAY_ICON), IMAGE_ICON, 16, 16, 0); - sysicon_awypend = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAYPEND_TRAY_ICON), IMAGE_ICON, 16, 16, 0); + sysicon_disconn = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_OFFLINE_TRAY_ICON), IMAGE_ICON, 16, 16, 0); + sysicon_conn = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_TRAY_ICON), IMAGE_ICON, 16, 16, 0); + sysicon_away = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAY_TRAY_ICON), IMAGE_ICON, 16, 16, 0); + sysicon_pend = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_PEND_TRAY_ICON), IMAGE_ICON, 16, 16, 0); + sysicon_awypend = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAYPEND_TRAY_ICON), IMAGE_ICON, 16, 16, 0); } else { - sysicon_disconn = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_OFFLINE_TRAY_ICON_4BIT), IMAGE_ICON, 16, 16, 0); - sysicon_conn = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_TRAY_ICON_4BIT), IMAGE_ICON, 16, 16, 0); - sysicon_away = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAY_TRAY_ICON_4BIT), IMAGE_ICON, 16, 16, 0); - sysicon_pend = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_PEND_TRAY_ICON_4BIT), IMAGE_ICON, 16, 16, 0); - sysicon_awypend = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAYPEND_TRAY_ICON_4BIT), IMAGE_ICON, 16, 16, 0); + sysicon_disconn = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_OFFLINE_TRAY_ICON_4BIT), IMAGE_ICON, 16, 16, 0); + sysicon_conn = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_TRAY_ICON_4BIT), IMAGE_ICON, 16, 16, 0); + sysicon_away = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAY_TRAY_ICON_4BIT), IMAGE_ICON, 16, 16, 0); + sysicon_pend = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_PEND_TRAY_ICON_4BIT), IMAGE_ICON, 16, 16, 0); + sysicon_awypend = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAYPEND_TRAY_ICON_4BIT), IMAGE_ICON, 16, 16, 0); } - sysicon_blank = (HICON)LoadImage(wgaim_hinstance(), MAKEINTRESOURCE(GAIM_BLANK_TRAY_ICON), IMAGE_ICON, 16, 16, 0); + sysicon_blank = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_BLANK_TRAY_ICON), IMAGE_ICON, 16, 16, 0); /* Create icon in systray */ systray_init_icon(systray_hwnd, sysicon_disconn); Modified: trunk/gtk/plugins/ticker/Makefile.mingw =================================================================== --- trunk/gtk/plugins/ticker/Makefile.mingw 2006-08-20 16:45:57 UTC (rev 16904) +++ trunk/gtk/plugins/ticker/Makefile.mingw 2006-08-20 16:49:37 UTC (rev 16905) @@ -8,10 +8,10 @@ # PATHS # -INCLUDE_DIR := . - -GTK_TOP := ../../../win32-dev/gtk_2_0 -GAIM_TOP := ../.. +GTK_TOP := ../../../../win32-dev/gtk_2_0 +GAIM_TOP := ../../.. +GTKGAIM_TOP := $(GAIM_TOP)/gtk +LIBGAIM_TOP := $(GAIM_TOP)/libgaim TICKER_ROOT := . GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir DLL_INSTALL_DIR := $(GAIM_INSTALL_DIR)/plugins @@ -33,7 +33,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -47,13 +47,16 @@ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ + -I$(GTKGAIM_TOP) \ + -I$(GTKGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) \ + -L$(GTKGAIM_TOP) ## @@ -76,9 +79,9 @@ -lgdk-win32-2.0 \ -lgmodule-2.0 \ -lgobject-2.0 \ - -lws2_32 \ -lintl \ - -lgaim + -lgaim \ + -lgtkgaim ## ## RULES @@ -105,14 +108,14 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(GTKGAIM_TOP)/gtkgaim.dll.a: + $(MAKE) -C $(GTKGAIM_TOP) -f Makefile.mingw gtkgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib +$(TARGET).dll: $(OBJECTS) $(GTKGAIM_TOP)/gtkgaim.dll.a $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## Copied: trunk/gtk/plugins/win32 (from rev 16858, trunk/plugins/win32) Property changes on: trunk/gtk/plugins/win32/transparency ___________________________________________________________________ Name: svn:ignore - win2ktrans.dll win2ktrans.def + win2ktrans.dll Modified: trunk/gtk/plugins/win32/transparency/Makefile.mingw =================================================================== --- trunk/plugins/win32/transparency/Makefile.mingw 2006-08-19 01:29:53 UTC (rev 16858) +++ trunk/gtk/plugins/win32/transparency/Makefile.mingw 2006-08-20 16:49:37 UTC (rev 16905) @@ -8,8 +8,10 @@ # PATHS # -GTK_TOP := ../../../../win32-dev/gtk_2_0 -GAIM_TOP := ../../.. +GTK_TOP := ../../../../../win32-dev/gtk_2_0 +GAIM_TOP := ../../../.. +LIBGAIM_TOP := ../../../../libgaim +GTKGAIM_TOP := ../../../../gtk GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir DLL_INSTALL_DIR := $(GAIM_INSTALL_DIR)/plugins @@ -23,13 +25,14 @@ CFLAGS = -DEFINES = +# This plugin requires W2K+ API +DEFINES = -D_WIN32_WINNT=0x0500 ## ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -43,13 +46,16 @@ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ + -I$(GTKGAIM_TOP) \ + -I$(GTKGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) \ + -L$(GTKGAIM_TOP) ## @@ -71,8 +77,8 @@ -lgdk-win32-2.0 \ -lgmodule-2.0 \ -lgobject-2.0 \ - -lws2_32 \ -lintl \ + -lgtkgaim \ -lgaim @@ -93,7 +99,7 @@ all: $(TARGET).dll -install: +install: all cp $(TARGET).dll $(DLL_INSTALL_DIR) @@ -101,14 +107,14 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(GTKGAIM_TOP)/gtkgaim.dll.a: + $(MAKE) -C $(GTKGAIM_TOP) -f Makefile.mingw gtkgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib +$(TARGET).dll: $(OBJECTS) $(GTKGAIM_TOP)/gtkgaim.dll.a $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## Property changes on: trunk/gtk/plugins/win32/winprefs ___________________________________________________________________ Name: svn:ignore - winprefs.dll winprefs.def + winprefs.dll Modified: trunk/gtk/plugins/win32/winprefs/Makefile.mingw =================================================================== --- trunk/plugins/win32/winprefs/Makefile.mingw 2006-08-19 01:29:53 UTC (rev 16858) +++ trunk/gtk/plugins/win32/winprefs/Makefile.mingw 2006-08-20 16:49:37 UTC (rev 16905) @@ -8,8 +8,10 @@ # PATHS # -GTK_TOP := ../../../../win32-dev/gtk_2_0 -GAIM_TOP := ../../.. +GTK_TOP := ../../../../../win32-dev/gtk_2_0 +GAIM_TOP := ../../../.. +LIBGAIM_TOP := $(GAIM_TOP)/libgaim +GTKGAIM_TOP := $(GAIM_TOP)/gtk GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir DLL_INSTALL_DIR := $(GAIM_INSTALL_DIR)/plugins @@ -29,7 +31,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -43,13 +45,16 @@ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(GAIM_TOP)/src \ - -I$(GAIM_TOP)/src/win32 \ + -I$(LIBGAIM_TOP) \ + -I$(LIBGAIM_TOP)/win32 \ + -I$(GTKGAIM_TOP) \ + -I$(GTKGAIM_TOP)/win32 \ -I$(GAIM_TOP) LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(GAIM_TOP)/src + -L$(LIBGAIM_TOP) \ + -L$(GTKGAIM_TOP) ## @@ -74,7 +79,8 @@ -lgobject-2.0 \ -lws2_32 \ -lintl \ - -lgaim + -lgaim \ + -lgtkgaim ## @@ -102,14 +108,14 @@ ## BUILD Dependencies ## -$(GAIM_TOP)/src/gaim.lib: - $(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib +$(GTKGAIM_TOP)/gtkgaim.dll.a: + $(MAKE) -C $(GTKGAIM_TOP) -f Makefile.mingw gtkgaim.dll.a ## ## BUILD DLL ## -$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib +$(TARGET).dll: $(OBJECTS) $(GTKGAIM_TOP)/gtkgaim.dll.a $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll ## Modified: trunk/gtk/plugins/win32/winprefs/winprefs.c =================================================================== --- trunk/plugins/win32/winprefs/winprefs.c 2006-08-19 01:29:53 UTC (rev 16858) +++ trunk/gtk/plugins/win32/winprefs/winprefs.c 2006-08-20 16:49:37 UTC (rev 16905) @@ -25,6 +25,8 @@ #include "internal.h" +#include "gtkwin32dep.h" + #include "core.h" #include "debug.h" #include "prefs.h" @@ -237,7 +239,7 @@ char buffer[1024]; DWORD size; - if((size = GetModuleFileName(wgaim_hinstance(), + if((size = GetModuleFileName(gtkwgaim_hinstance(), (LPBYTE) buffer , sizeof(buffer))) == 0) { gaim_debug_error(WINPREFS_PLUGIN_ID, "GetModuleFileName Error. Could not set Gaim autostart.\n"); RegCloseKey(hKey); @@ -558,3 +560,4 @@ } GAIM_INIT_PLUGIN(winprefs, init_plugin, info) + Property changes on: trunk/gtk/win32/IdleTracker ___________________________________________________________________ Name: svn:ignore - idletrack.def idletrack.lib idletrack.dll + idletrack.dll idletrack.dll.a Modified: trunk/gtk/win32/IdleTracker/Makefile.mingw =================================================================== --- trunk/gtk/win32/IdleTracker/Makefile.mingw 2006-08-20 16:45:57 UTC (rev 16904) +++ trunk/gtk/win32/IdleTracker/Makefile.mingw 2006-08-20 16:49:37 UTC (rev 16905) @@ -9,6 +9,7 @@ # GAIM_TOP := ../../.. +LIBGAIM_TOP := $(GAIM_TOP)/libgaim GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir ## @@ -27,7 +28,7 @@ ## INCLUDE MAKEFILES ## -include $(GAIM_TOP)/src/win32/global.mak +include $(LIBGAIM_TOP)/win32/global.mak ## ## INCLUDE PATHS @@ -77,7 +78,7 @@ ## $(TARGET).dll: $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).dll.a -o $(TARGET).dll ## ## CLEAN RULES @@ -86,5 +87,4 @@ clean: rm -rf *.o rm -rf $(TARGET).dll - rm -rf $(TARGET).lib - rm -rf $(TARGET).def + rm -rf $(TARGET).dll.a Modified: trunk/gtk/win32/gaimrc.rc =================================================================== --- trunk/gtk/win32/gaimrc.rc 2006-08-20 16:45:57 UTC (rev 16904) +++ trunk/gtk/win32/gaimrc.rc 2006-08-20 16:49:37 UTC (rev 16905) @@ -1,14 +1,16 @@ #include "resource.h" -GAIM_ICON ICON "../pixmaps/gaim.ico" -GAIM_TRAY_ICON ICON "../pixmaps/gaim_16.ico" -GAIM_OFFLINE_TRAY_ICON ICON "../pixmaps/gaim_offline_16.ico" -GAIM_AWAY_TRAY_ICON ICON "../pixmaps/gaim_away_16.ico" -GAIM_PEND_TRAY_ICON ICON "../pixmaps/gaim_msgunread_16.ico" -GAIM_AWAYPEND_TRAY_ICON ICON "../pixmaps/gaim_msgpend_16.ico" -GAIM_BLANK_TRAY_ICON ICON "../pixmaps/gaim_blank_4bit_16.ico" -GAIM_TRAY_ICON_4BIT ICON "../pixmaps/gaim_4bit_16.ico" -GAIM_OFFLINE_TRAY_ICON_4BIT ICON "../pixmaps/gaim_offline_4bit_16.ico" -GAIM_AWAY_TRAY_ICON_4BIT ICON "../pixmaps/gaim_away_4bit_16.ico" -GAIM_PEND_TRAY_ICON_4BIT ICON "../pixmaps/gaim_msgunread_4bit_16.ico" -GAIM_AWAYPEND_TRAY_ICON_4BIT ICON "../pixmaps/gaim_msgpend_4bit_16.ico" +#define PIXMAPDIR "pixmaps/" + +GAIM_ICON ICON PIXMAPDIR "gaim.ico" +GAIM_TRAY_ICON ICON PIXMAPDIR "gaim_16.ico" +GAIM_OFFLINE_TRAY_ICON ICON PIXMAPDIR "gaim_offline_16.ico" +GAIM_AWAY_TRAY_ICON ICON PIXMAPDIR "gaim_away_16.ico" +GAIM_PEND_TRAY_ICON ICON PIXMAPDIR "gaim_msgunread_16.ico" +GAIM_AWAYPEND_TRAY_ICON ICON PIXMAPDIR "gaim_msgpend_16.ico" +GAIM_BLANK_TRAY_ICON ICON PIXMAPDIR "gaim_blank_4bit_16.ico" +GAIM_TRAY_ICON_4BIT ICON PIXMAPDIR "gaim_4bit_16.ico" +GAIM_OFFLINE_TRAY_ICON_4BIT ICON PIXMAPDIR "gaim_offline_4bit_16.ico" +GAIM_AWAY_TRAY_ICON_4BIT ICON PIXMAPDIR "gaim_away_4bit_16.ico" +GAIM_PEND_TRAY_ICON_4BIT ICON PIXMAPDIR "gaim_msgunread_4bit_16.ico" +GAIM_AWAYPEND_TRAY_ICON_4BIT ICON PIXMAPDIR "gaim_msgpend_4bit_16.ico" Deleted: trunk/gtk/win32/global.mak =================================================================== --- trunk/gtk/win32/global.mak 2006-08-20 16:45:57 UTC (rev 16904) +++ trunk/gtk/win32/global.mak 2006-08-20 16:49:37 UTC (rev 16905) @@ -1,25 +0,0 @@ -# -# global.mak -# -# This file should be included by all Makefile.mingw files for project -# wide definitions. -# - -CC = gcc.exe - -# Use -g flag when building debug version of Gaim (including plugins). -# Use -fnative-struct instead of -mms-bitfields when using mingw 1.1 -# (gcc 2.95) -CFLAGS += -O2 -Wall -pipe -mno-cygwin -mms-bitfields - -# If not specified, dlls are built with the default base address of 0x10000000. -# When loaded into a process address space a dll will be rebased if its base -# address colides with the base address of an existing dll. To avoid rebasing -# we do the following. Rebasing can slow down the load time of dlls and it -# also renders debug info useless. -DLL_LD_FLAGS += -Wl,--enable-auto-image-base - -VERSION := $(shell cat $(GAIM_TOP)/VERSION) - -DEFINES += -DVERSION=\"$(VERSION)\" \ - -DHAVE_CONFIG_H Added: trunk/gtk/win32/gtkwin32dep.c =================================================================== --- trunk/gtk/win32/gtkwin32dep.c (rev 0) +++ trunk/gtk/win32/gtkwin32dep.c 2006-08-20 16:49:37 UTC (rev 16905) @@ -0,0 +1,202 @@ +/* + * gaim + * + * File: gtkwin32dep.c + * Date: June, 2002 + * Description: Windows dependant code for Gaim + * + * Copyright (C) 2002-2003, Herman Bloggs <her...@ya...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#define _WIN32_IE 0x500 +#include <windows.h> +#include <io.h> +#include <stdlib.h> +#include <stdio.h> +#include <winuser.h> + +#include <glib.h> +#include <glib/gstdio.h> +#include <gtk/gtk.h> + +#include "gaim.h" +#include "debug.h" +#include "notify.h" + +#include "resource.h" +#include "idletrack.h" +#include "zlib.h" +#include "untar.h" + +#include <libintl.h> + +#include "gtkwin32dep.h" + +#include "wspell.h" + +/* + * GLOBALS + */ +HINSTANCE gaimexe_hInstance = 0; +HINSTANCE gtkgaimdll_hInstance = 0; + +/* + * PUBLIC CODE + */ + +HINSTANCE gtkwgaim_hinstance(void) { + return gaimexe_hInstance; +} + +int gtkwgaim_gz_decompress(const char* in, const char* out) { + gzFile fin; + FILE *fout; + char buf[1024]; + int ret; + + 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); + gzclose(fin); + return 0; + } + } + else { + gaim_debug(GAIM_DEBUG_ERROR, "wgaim_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); + gzclose(fin); + fclose(fout); + return 0; + } + } + fclose(fout); + gzclose(fin); + + if(ret < 0) { + gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "gzread failed while reading: %s\n", in); + return 0; + } + + return 1; +} + +int gtkwgaim_gz_untar(const char* filename, const char* destdir) { + char tmpfile[_MAX_PATH]; + char template[]="wgaimXXXXXX"; + + sprintf(tmpfile, "%s%s%s", g_get_tmp_dir(), G_DIR_SEPARATOR_S, _mktemp(template)); + if(gtkwgaim_gz_decompress(filename, tmpfile)) { + int ret; + if(untar(tmpfile, destdir, UNTAR_FORCE | UNTAR_QUIET)) + ret = 1; + else { + gaim_debug(GAIM_DEBUG_ERROR, "wgaim_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); + return 0; + } +} + +void gtkwgaim_notify_uri(const char *uri) { + + /* We'll allow whatever URI schemes are supported by the + * default http browser. + */ + + if (G_WIN32_HAVE_WIDECHAR_API()) { + SHELLEXECUTEINFOW wsinfo; + wchar_t *w_uri; + + w_uri = g_utf8_to_utf16(uri, -1, NULL, NULL, NULL); + + memset(&wsinfo, 0, sizeof(wsinfo)); + wsinfo.cbSize = sizeof(wsinfo); + wsinfo.fMask = SEE_MASK_CLASSNAME; + wsinfo.lpVerb = L"open"; + wsinfo.lpFile = w_uri; + 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", + uri, (int) wsinfo.hInstApp); + + g_free(w_uri); + } else { + SHELLEXECUTEINFOA sinfo; + gchar *locale_uri; + + locale_uri = g_locale_from_utf8(uri, -1, NULL, NULL, NULL); + + memset(&sinfo, 0, sizeof(sinfo)); + sinfo.cbSize = sizeof(sinfo); + sinfo.fMask = SEE_MASK_CLASSNAME; + sinfo.lpVerb = "open"; + sinfo.lpFile = locale_uri; + sinfo.nShow = SW_SHOWNORMAL; + sinfo.lpClass = "http"; + + if(!ShellExecuteExA(&sinfo)) + gaim_debug_error("wgaim", "Error opening URI: %s error: %d\n", + uri, (int) sinfo.hInstApp); + + g_free(locale_uri); + } +} + +void gtkwgaim_init(HINSTANCE hint) { + gaim_debug_info("gtkwgaim", "gtkwgaim_init start\n"); + + gaimexe_hInstance = hint; + + /* IdleTracker Initialization */ + if(!wgaim_set_idlehooks()) + gaim_debug(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"); +} + +/* Windows Cleanup */ + +void gtkwgaim_cleanup(void) { + gaim_debug(GAIM_DEBUG_INFO, "gtkwgaim", "gtkwgaim_cleanup\n"); + + /* Idle tracker cleanup */ + wgaim_remove_idlehooks(); + +} + +/* DLL initializer */ +BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { + gtkgaimdll_hInstance = hinstDLL; + return TRUE; +} Property changes on: trunk/gtk/win32/gtkwin32dep.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/gtk/win32/gtkwin32dep.h =================================================================== --- trunk/gtk/win32/gtkwin32dep.h (rev 0) +++ trunk/gtk/win32/gtkwin32dep.h 2006-08-20 16:49:37 UTC (rev 16905) @@ -0,0 +1,40 @@ +/* + * gaim + * + * File: win32dep.h + * + * Copyright (C) 2002-2003, Herman Bloggs <her...@ya...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#ifndef _GTKWIN32DEP_H_ +#define _GTKWIN32DEP_H_ + +HINSTANCE gtkwgaim_hinstance(void); + +/* Utility */ +int gtkwgaim_gz_decompress(const char* in, const char* out); +int gtkwgaim_gz_untar(const char* filename, const char* destdir); + +/* Misc */ +void gtkwgaim_notify_uri(const char *uri); + +/* init / cleanup */ +void gtkwgaim_init(HINSTANCE); +void gtkwgaim_cleanup(void); + +#endif /* _WIN32DEP_H_ */ + Property changes on: trunk/gtk/win32/gtkwin32dep.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Deleted: trunk/gtk/win32/libc_interface.c =================================================================== --- trunk/gtk/win32/libc_interface.c 2006-08-20 16:45:57 UTC (rev 16904) +++ trunk/gtk/win32/libc_interface.c 2006-08-20 16:49:37 UTC (rev 16905) @@ -1,990 +0,0 @@ -/* - * gaim - * - * Copyright (C) 2002-2003, Herman Bloggs <her...@ya...> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include <winsock2.h> -#include <ws2tcpip.h> -#include <io.h> -#include <stdlib.h> -#include <stdio.h> -#include <errno.h> -#include <sys/timeb.h> -#include <sys/stat.h> -#include <time.h> -#include <glib.h> -#include "debug.h" -#include "libc_internal.h" -#if GLIB_CHECK_VERSION(2,6,0) -# include <glib/gstdio.h> -#else -#define g_remove remove -#define g_rename rename -#define g_stat stat -#endif - -static char errbuf[1024]; - -/* helpers */ -static int wgaim_is_socket( int fd ) { - int optval; - unsigned int optlen = sizeof(int); - - if( (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void*)&optval, &optlen)) == SOCKET_ERROR ) { - int error = WSAGetLastError(); - if( error == WSAENOTSOCK ) - return FALSE; - else { - gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_is_socket: getsockopt returned error: %d\n", error); - return FALSE; - } - } - return TRUE; -} - -/* socket.h */ -int wgaim_socket (int namespace, int style, int protocol) { - int ret; - - ret = socket( namespace, style, protocol ); - - if( ret == INVALID_SOCKET ) { - errno = WSAGetLastError(); - return -1; - } - return ret; -} - -int wgaim_connect(int socket, struct sockaddr *addr, u_long length) { - int ret; - - ret = connect( socket, addr, length ); - - if( ret == SOCKET_ERROR ) { - errno = WSAGetLastError(); - if( errno == WSAEWOULDBLOCK ) - errno = WSAEINPROGRESS; - return -1; - } - return 0; -} - -int wgaim_getsockopt(int socket, int level, int optname, void *optval, socklen_t *optlenptr) { - if(getsockopt(socket, level, optname, optval, optlenptr) == SOCKET_ERROR ) { - errno = WSAGetLastError(); - return -1; - } - return 0; -} - -int wgaim_setsockopt(int socket, int level, int optname, const void *optval, socklen_t optlen) { - if(setsockopt(socket, level, optname, optval, optlen) == SOCKET_ERROR ) { - errno = WSAGetLastError(); - return -1; - } - return 0; -} - -int wgaim_getsockname(int socket, struct sockaddr *addr, socklen_t *lenptr) { - if(getsockname(socket, addr, lenptr) == SOCKET_ERROR) { - errno = WSAGetLastError(); - return -1; - } - return 0; -} - -int wgaim_bind(int socket, struct sockaddr *addr, socklen_t length) { - if(bind(socket, addr, length) == SOCKET_ERROR) { - errno = WSAGetLastError(); - return -1; - } - return 0; -} - -int wgaim_listen(int socket, unsigned int n) { - if(listen(socket, n) == SOCKET_ERROR) { - errno = WSAGetLastError(); - return -1; - } - return 0; -} - -int wgaim_sendto(int socket, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) { - int ret; - if ((ret = sendto(socket, buf, len, flags, to, tolen) - ) == SOCKET_ERROR) { - errno = WSAGetLastError(); - return -1; - } - return ret; -} - -/* fcntl.h */ -/* This is not a full implementation of fcntl. Update as needed.. */ -int wgaim_fcntl(int socket, int command, int val) { - switch( command ) { - case F_SETFL: - { - int ret=0; - - switch( val ) { - case O_NONBLOCK: - { - u_long imode=1; - ret = ioctlsocket(socket, FIONBIO, &imode); - break; - } - case 0: - { - u_long imode=0; - ret = ioctlsocket(socket, FIONBIO, &imode); - break; - } - default: - errno = EINVAL; - return -1; - }/*end switch*/ - if( ret == SOCKET_ERROR ) { - errno = WSAGetLastError(); - return -1; - } - return 0; - } - default: - gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_fcntl: Unsupported command\n"); - return -1; - }/*end switch*/ -} - -/* sys/ioctl.h */ -int wgaim_ioctl(int fd, int command, void* val) { - switch( command ) { - case FIONBIO: - { - if (ioctlsocket(fd, FIONBIO, (unsigned long *)val) == SOCKET_ERROR) { - errno = WSAGetLastError(); - return -1; - } - return 0; - } - case SIOCGIFCONF: - { - INTERFACE_INFO InterfaceList[20]; - unsigned long nBytesReturned; - if (WSAIoctl(fd, SIO_GET_INTERFACE_LIST, - 0, 0, &InterfaceList, - sizeof(InterfaceList), &nBytesReturned, - 0, 0) == SOCKET_ERROR) { - errno = WSAGetLastError(); - return -1; - } else { - int i; - struct ifconf *ifc = val; - char *tmp = ifc->ifc_buf; - int nNumInterfaces = - nBytesReturned / sizeof(INTERFACE_INFO); - for (i = 0; i < nNumInterfaces; i++) { - INTERFACE_INFO ii = InterfaceList[i]; - struct ifreq *ifr = (struct ifreq *) tmp; - struct sockaddr_in *sa = (struct sockaddr_in *) &ifr->ifr_addr; - - sa->sin_family = ii.iiAddress.AddressIn.sin_family; - sa->sin_port = ii.iiAddress.AddressIn.sin_port; - sa->sin_addr.s_addr = ii.iiAddress.AddressIn.sin_addr.s_addr; - tmp += sizeof(struct ifreq); - - /* Make sure that we can fit in the original buffer */ - if (tmp >= (ifc->ifc_buf + ifc->ifc_len + sizeof(struct ifreq))) { - break; - } - } - /* Replace the length with the actually used length */ - ifc->ifc_len = ifc->ifc_len - (ifc->ifc_buf - tmp); - return 0; - } - } - default: - errno = EINVAL; - return -1; - }/*end switch*/ -} - -/* arpa/inet.h */ -int wgaim_inet_aton(const char *name, struct in_addr *addr) { - if((addr->s_addr = inet_addr(name)) == INADDR_NONE) - return 0; - else - return 1; -} - -/* netdb.h */ -struct hostent* wgaim_gethostbyname(const char *name) { - struct hostent *hp; - - if((hp = gethostbyname(name)) == NULL) { - errno = WSAGetLastError(); - return NULL; - } - return hp; -} - -/* string.h */ -char* wgaim_strerror( int errornum ) { - if( errornum > WSABASEERR ) { - sprintf( errbuf, "Windows socket error #%d", errornum ); - return errbuf; - } - else - return strerror( errornum ); -} - -/* unistd.h */ - -/* - * We need to figure out whether fd is a file or socket handle. - */ -int wgaim_read(int fd, void *buf, unsigned int size) { - int ret; - - if(wgaim_is_socket(fd)) { - if((ret = recv(fd, buf, size, 0)) == SOCKET_ERROR) { - errno = WSAGetLastError(); - if(errno == WSAEWOULDBLOCK) - errno = EAGAIN; - return -1; - } -#if 0 - else if( ret == 0 ) { - /* connection has been gracefully closed */ - errno = WSAENOTCONN; - return -1; - } -#endif - else { - /* success reading socket */ - return ret; - } - } else { - /* fd is not a socket handle.. pass it off to read */ - return read(fd, buf, size); - } -} - -int wgaim_send(int fd, const void *buf, unsigned int size, int flags) { - int ret; - - ret = send(fd, buf, size, flags); - - if (ret == SOCKET_ERROR) { - errno = WSAGetLastError(); - if(errno == WSAEWOULDBLOCK) - errno = EAGAIN; - return -1; - } - return ret; -} - -int wgaim_write(int fd, const void *buf, unsigned int size) { - - if(wgaim_is_socket(fd)) - return wgaim_send(fd, buf, size, 0); - else - return write(fd, buf, size); -} - -int wgaim_recv(int fd, void *buf, size_t len, int flags) { - int ret; - - if((ret = recv(fd, buf, len, flags)) == SOCKET_ERROR) { - errno = WSAGetLastError(); - if(errno == WSAEWOULDBLOCK) - errno = EAGAIN; - return -1; - } else { - return ret; - } -} - -int wgaim_close(int fd) { - int ret; - - if( wgaim_is_socket(fd) ) { - if( (ret = closesocket(fd)) == SOCKET_ERROR ) { - errno = WSAGetLastError(); - return -1; - } - else - return 0; - } - else - return close(fd); -} - -int wgaim_gethostname(char *name, size_t size) { - if(gethostname(name, size) == SOCKET_ERROR) { - errno = WSAGetLastError(); - return -1; - } - return 0; -} - -/* sys/time.h */ - -int wgaim_gettimeofday(struct timeval *p, struct timezone *z) { - int res = 0; - struct _timeb timebuffer; - - if (z != 0) { - _tzset(); - z->tz_minuteswest = _timezone/60; - z->tz_dsttime = _daylight; - } - - if (p != 0) { - _ftime(&timebuffer); - p->tv_sec = timebuffer.time; /* seconds since 1-1-1970 */ - p->tv_usec = timebuffer.millitm*1000; /* microseconds */ - } - - return res; -} - -/* stdio.h */ - -int wgaim_rename (const char *oldname, const char *newname) { - struct stat oldstat, newstat; - - if(g_stat(oldname, &oldstat) == 0) { - /* newname exists */ - if(g_stat(newname, &newstat) == 0) { - /* oldname is a dir */ - if(_S_ISDIR(oldstat.st_mode)) { - if(!_S_ISDIR(newstat.st_mode)) { - return g_rename(oldname, newname); - } - /* newname is a dir */ - else { - /* This is not quite right.. If newname is empty and - is not a sub dir of oldname, newname should be - deleted and oldname should be renamed. - */ - gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_rename does not behave here as it should\n"); - return g_rename(oldname, newname); - } - } - /* oldname is not a dir */ - else { - /* newname is a dir */ - if(_S_ISDIR(newstat.st_mode)) { - errno = EISDIR; - return -1; - } - /* newname is not a dir */ - else { - g_remove(newname); - return g_rename(oldname, newname); - } - } - } - /* newname doesn't exist */ - else - return g_rename(oldname, newname); - } - else { - /* oldname doesn't exist */ - errno = ENOENT; - return -1; - } - -} - -/* time.h */ - -struct tm * wgaim_localtime_r (const time_t *time, struct tm *resultp) { - struct tm* tmptm; - - if(!time) - return NULL; - tmptm = localtime(time); - if(resultp && tmptm) - return memcpy(resultp, tmptm, sizeof(struct tm)); - else - return NULL; -} - -/* - * Used by gaim_utf8_strftime() by way of gaim_internal_strftime() - * in src/util.c - * - * Code derived from PostgreSQL src/timezone/pgtz.c: - * http://developer.postgresql.org/cvsweb.cgi/pgsql/src/timezone/pgtz.c - */ - -/* -PostgreSQL Database Management System -(formerly known as Postgres, then as Postgres95) - -Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group - -Portions Copyright (c) 1994, The Regents of the University of California - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose, without fee, and without a written agreement -is hereby granted, provided that the above copyright notice and this -paragraph and the following two paragraphs appear in all copies. - -IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR -DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING -LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS -DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO -PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -*/ -static struct -{ - char *wstd; /* Windows name of standard timezone */ - char *wdst; /* Windows name of daylight timezone */ - char *ustd; /* Unix name of standard timezone */ - char *udst; /* Unix name of daylight timezone */ -} win32_tzmap[] = -{ - { - "", "", - "", "", - }, - /* - * This list was built from the contents of the registry at - * "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones" - * on Windows XP Professional SP1 - */ - { - "Afghanistan Standard Time", "Afghanistan Daylight Time", - "AFT", "AFT" - }, - { - "Alaskan Standard Time", "Alaskan Daylight Time", - "AKST", "AKDT" - }, - { - "Arab Standard Time", "Arab Daylight Time", - "AST", "AST" - }, - { - "Arabian Standard Time", "Arabian Daylight Time", - "GST", "GST" - }, - { - "Arabic Standard Time", "Arabic Daylight Time", - "AST", "ADT" - }, - { - "Atlantic Standard Time", "Atlantic Daylight Time", - "AST", "ADT" - }, - { - "AUS Central Standard Time", "AUS Central Daylight Time", - "CST", "CST" - }, - { - "AUS Eastern Standard Time", "AUS Eastern Daylight Time", - "EST", "EST" - }, - { - "Azores Standard Time", "Azores Daylight Time", - "AZOT", "AZOST" - }, - { - "Canada Central Standard Time", "Canada Central Daylight Time", - "CST", "MDT" - }, - { - "Cape Verde Standard Time", "Cape Verde Daylight Time", - "CVT", "CVST" - }, - { - "Caucasus Standard Time", "Caucasus Daylight Time", - "AZT", "AZST" - }, - { - "Cen. Australia Standard Time", "Cen. Australia Daylight Time", - "CST", "CST" - }, - { - "Central America Standard Time", "Central America Daylight Time", - "CST", "CDT" - }, - { - "Central Asia Standard Time", "Central Asia Daylight Time", - "BDT", "BDT" - }, - { - "Central Europe Standard Time", "Central Europe Daylight Time", - "CET", "CEST" - }, - { - "Central European Standard Time", "Central European Daylight Time", - "CET", "CEST" - }, - { - "Central Pacific Standard Time", "Central Pacific Daylight Time", - "NCT", "NCST" - }, - { - "Central Standard Time", "Central Daylight Time", - "CST", "CDT" - }, - { - "China Standard Time", "China Daylight Time", - "HKT", "HKST" - }, - { - "Dateline Standard Time", "Dateline Daylight Time", - "GMT+12", "GMT+12" - }, - { - "E. Africa Standard Time", "E. Africa Daylight Time", - "EAT", "EAT" - }, - { - "E. Australia Standard Time", "E. Australia Daylight Time", - "EST", "EST" - }, - { - "E. Europe Standard Time", "E. Europe Daylight Time", - "EET", "EEST" - }, - { - "E. South America Standard Time", "E. South America Daylight Time", - "BRT", "BRST" - }, - { - "Eastern Standard Time", "Eastern Daylight Time", - "EST", "EDT" - }, - { - "Egypt Standard Time", "Egypt Daylight Time", - "EET", "EEST" - }, - { - "Ekaterinburg Standard Time", "Ekaterinburg Daylight Time", - "YEKT", "YEKST" - }, - { - "Fiji Standard Time", "Fiji Daylight Time", - "FJT", "FJST" - }, - { - "FLE Standard Time", "FLE Daylight Time", - "EET", "EEST" - }, - { - "GMT Standard Time", "GMT Daylight Time", - "GMT", "IST" - }, - { - "Greenland Standard Time", "Greenland Daylight Time", - "WGT", "WGST" - }, - { - "Greenwich Standard Time", "Greenwich Daylight Time", - "WET", "WEST" - }, - { - "GTB Standard Time", "GTB Daylight Time", - "EET", "EEST" - }, - { - "Hawaiian Standard Time", "Hawaiian Daylight Time", - "HST", "HPT" - }, - { - "India Standard Time", "India Daylight Time", - "IST", "IST" - }, - { - "Iran Standard Time", "Iran Daylight Time", - "IRST", "IRDT" - }, - { - "Jerusalem Standard Time", "Jerusalem Daylight Time", - "IST", "IDT" - }, - { - "Korea Standard Time", "Korea Daylight Time", - "KST", "KDT" - }, - { - "Mexico Standard Time", "Mexico Daylight Time", - "CST", "CDT" - }, - { - "Mexico Standard Time", "Mexico Daylight Time", - "BOT", "BOST" - }, - { - "Mid-Atlantic Standard Time", "Mid-Atlantic Daylight Time", - "GST", "GST" - }, - { - "Mountain Standard Time", "Mountain Daylight Time", - "MST", "MDT" - }, - { - "Myanmar Standard Time", "Myanmar Daylight Time", - "MMT", "MMT" - }, - { - "N. Central Asia Standard Time", "N. Central Asia Daylight Time", - "ALMT", "ALMST" - }, - { - "Nepal Standard Time", "Nepal Daylight Time", - "NPT", "NPT" - }, - { - "New Zealand Standard Time", "New Zealand Daylight Time", - "NZST", "NZDT" - }, - { - "Newfoundland Standard Time", "Newfoundland Daylight Time", - "NST", "NDT" - }, - { - "North Asia East Standard Time", "North Asia East Daylight Time", - "IRKT", "IRKST" - }, - { - "North Asia Standard Time", "North Asia Daylight Time", - "KRAT", "KRAST" - }, - { - "Pacific SA Standard Time", "Pacific SA Daylight Time", - "CLT", "CLST" - }, - { - "Pacific Standard Time", "Pacific Daylight Time", - "PST", "PDT" - }, - { - "Romance Standard Time", "Romance Daylight Time", - "CET", "CEST" - }, - { - "Russian Standard Time", "Russian Daylight Time", - "MSK", "MSD" - }, - { - "SA Eastern Standard Time", "SA Eastern Daylight Time", - "ART", "ARST" - }, - { - "SA Pacific Standard Time", "SA Pacific Daylight Time", - "COT", "COST" - }, - { - "SA Western Standard Time", "SA Western Daylight Time", - "VET", "VET" - }, - { - "Samoa Standard Time", "Samoa Daylight Time", - "SST", "NDT" - }, - { - "SE Asia Standard Time", "SE Asia Daylight Time", - "ICT", "ICT" - }, - { - "Malay Peninsula Standard Time", "Malay Peninsula Daylight Time", - "MYT", "MALST" - }, - { - "South Africa Standard Time", "South Africa Daylight Time", - "CAT", "CAT" - }, - { - "Sri Lanka Standard Time", "Sri Lanka Daylight Time", - "LKT", "IST" - }, - { - "Taipei Standard Time", "Taipei Daylight Time", - "CST", "CDT" - }, - { - "Tasmania Standard Time", "Tasmania Daylight Time", - "EST", "EST" - }, - { - "Tokyo Standard Time", "Tokyo Daylight Time", - "JST", "JDT" - }, - { - "Tonga Standard Time", "Tonga Daylight Time", - "TOT", "TOST" - }, - { - "US Eastern Standard Time", "US Eastern Daylight Time", - "EST", "EDT" - }, - { - "US Mountain Standard Time", "US Mountain Daylight Time", - "MST", "MDT" - }, - { - "Vladivostok Standard Time", "Vladivostok Daylight Time", - "VLAT", "VLAST" - }, - { - "W. Australia Standard Time", "W. Australia Daylight Time", - "WST", "WST" - }, - - /* Not mapped in PostgreSQL. - * - * I mapped this based on the following information... -- rlaager - * $ cd /usr/share/zoneinfo/Africa - * $ for i in * ; do echo `TZ=Africa/$i date +"%z %Z"` $i ; done | grep +0100 - * +0100 CET Algiers - * +0100 WAT Bangui - * +0100 WAT Brazzaville - * +0100 CET Ceuta - * +0100 WAT Douala - * +0100 WAT Kinshasa - * +0100 WAT Lagos - * +0100 WAT Libreville - * +0100 WAT Luanda - * +0100 WAT Malabo - * +0100 WAT Ndjamena - * +0100 WAT Niamey - * +0100 WAT Porto-Novo - * +0100 CET Tunis - **/ - { - "W. Central Africa Standard Time", "W. Central Africa Daylight Time", - "WAT", "WAT" - }, - - { - "W. Europe Standard Time", "W. Europe Daylight Time", - "CET", "CEST" - }, - { - "West Asia Standard Time", "West Asia Daylight Time", - "PKT", "PKST" - }, - { - "West Pacific Standard Time", "West Pacific Daylight Time", - "ChST", "ChST" - }, - { - "Yakutsk Standard Time", "Yakutsk Daylight Time", - "YAKT", "YAKST" - }, - { - NULL, NULL, - NULL, NULL - } -}; - -const char * -wgaim_get_timezone_abbreviation(const struct tm *tm) -{ - int i; - char tzname[128]; - char localtzname[256]; - HKEY rootKey; - int idx; - - if (!tm) - { - gaim_debug_warning("wgaim", "could not determine current date/time: localtime failed\n"); - return ""; - } - - if (strftime(tzname, sizeof(tzname) - 1, "%Z", tm) == 0) - { - gaim_debug_error("wgaim", "timezone name is too long for the buffer\n"); - return ""; - } - - for (i = 0; win32_tzmap[i].wstd != NULL; i++) - { - if (strcmp(tzname, win32_tzmap[i].wstd) == 0) - { -#if 0 - gaim_debug_info("wgaim", "TZ \"%s\" matches Windows timezone \"%s\"\n", - win32_tzmap[i].ustd, tzname); -#endif - /* Cache the Result */ - if (i > 0) { - if (win32_tzmap[0].wstd[0] != '\0') - g_free(win32_tzmap[0].wstd); - win32_tzmap[0].wstd = g_strdup(tzname); - win32_tzmap[0].ustd = win32_tzmap[i].ustd; - } - - return win32_tzmap[i].ustd; - } - if (strcmp(tzname, win32_tzmap[i].wdst) == 0) - { -#if 0 - gaim_debug_info("wgaim", "TZ \"%s\" matches Windows timezone \"%s\"\n", - win32_tzmap[i].udst, tzname); -#endif - /* Cache the Result */ - if (i > 0) { - if (win32_tzmap[0].wdst[0] != '\0') - g_free(win32_tzmap[0].wdst); - win32_tzmap[0].wdst = g_strdup(tzname); - win32_tzmap[0].udst = win32_tzmap[i].udst; - } - - return win32_tzmap[i].udst; - } - } - - /* - * Localized Windows versions return localized names for the timezone. - * Scan the registry to find the English name, and then try matching - * against our table again. - */ - memset(localtzname, 0, sizeof(localtzname)); - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", - 0, - KEY_READ, - &rootKey) != ERROR_SUCCESS) - { - gaim_debug_warning("wgaim", "could not open registry key to identify Windows timezone: %i\n", (int) GetLastError()); - return ""; - } - - for (idx = 0;; idx++) - { - char keyname[256]; - char zonename[256]; - DWORD namesize; - FILETIME lastwrite; - HKEY key; - LONG r; - - memset(keyname, 0, sizeof(keyname)); - namesize = sizeof(keyname); - if ((r = RegEnumKeyEx(rootKey, - idx, - keyname, - &namesize, - NULL, - NULL, - NULL, - &lastwrite)) != ERROR_SUCCESS) - { - if (r == ERROR_NO_MORE_ITEMS) - break; - gaim_debug_warning("wgaim", "could not enumerate registry subkeys to identify Windows timezone: %i\n", (int) r); - break; - } - - if ((r = RegOpenKeyEx(rootKey, keyname, 0, KEY_READ, &key)) != ERROR_SUCCESS) - { - gaim_debug_warning("wgaim", "could not open registry subkey to identify Windows timezone: %i\n", (int) r); - break; - } - - memset(zonename, 0, sizeof(zonename)); - namesize = sizeof(zonename); - if ((r = RegQueryValueEx(key, "Std", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS) - { - gaim_debug_warning("wgaim", "could not query value for 'std' to identify Windows timezone: %i\n", (int) r); - RegCloseKey(key); - break; - } - if (strcmp(tzname, zonename) == 0) - { - /* Matched zone */ - strcpy(localtzname, keyname); - RegCloseKey(key); - break; - } - memset(zonename, 0, sizeof(zonename)); - namesize = sizeof(zonename); - if ((r = RegQueryValueEx(key, "Dlt", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS) - { - gaim_debug_warning("wgaim", "could not query value for 'dlt' to identify Windows timezone: %i\n", (int) r); - RegCloseKey(key); - break; - } - if (strcmp(tzname, zonename) == 0) - { - /* Matched DST zone */ - strcpy(localtzname, keyname); - RegCloseKey(key); - break; - } - - RegCloseKey(key); - } - - RegCloseKey(rootKey); - - if (localtzname[0]) - { - /* Found a localized name, so scan for that one too */ - for (i = 0; win32_tzmap[i].wstd != NULL; i++) - { - if (strcmp(localtzname, win32_tzmap[i].wstd) == 0) - { -#if 0 - gaim_debug_info("wgaim", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n", - win32_tzmap[i].ustd, tzname, localtznam... [truncated message content] |
From: <sa...@us...> - 2006-08-20 16:46:07
|
Revision: 16904 Author: sadrul Date: 2006-08-20 09:45:57 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16904&view=rev Log Message: ----------- Add a plugin gnthistory. The plugin is a core plugin, but does not look good in gtkgaim. Modified Paths: -------------- trunk/console/plugins/Makefile.am trunk/console/plugins/gntgf.c Added Paths: ----------- trunk/console/plugins/gnthistory.c Modified: trunk/console/plugins/Makefile.am =================================================================== --- trunk/console/plugins/Makefile.am 2006-08-20 16:38:10 UTC (rev 16903) +++ trunk/console/plugins/Makefile.am 2006-08-20 16:45:57 UTC (rev 16904) @@ -1,27 +1,29 @@ gntgf_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) +gnthistory_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) if PLUGINS plugin_LTLIBRARIES = \ - gntgf.la + gntgf.la \ + gnthistory.la plugindir = $(libdir)/gaim gntgf_la_SOURCES = gntgf.c +gnthistory_la_SOURCES = gnthistory.c endif # PLUGINS EXTRA_DIST = -GNT_CFLAGS = `pkg-config --cflags gnt` -I.. - AM_CPPFLAGS = \ -DDATADIR=\"$(datadir)\" \ -DVERSION=\"$(VERSION)\" \ - -I$(top_builddir)/src \ - -I$(top_srcdir)/src \ + -I$(top_builddir)/libgaim \ + -I$(top_srcdir)/libgaim \ + -I$(top_srcdir)/console \ + -I$(top_srcdir)/console/libgnt \ $(DEBUG_CFLAGS) \ - $(GNT_CFLAGS) \ $(GLIB_CFLAGS) \ $(PLUGIN_CFLAGS) Modified: trunk/console/plugins/gntgf.c =================================================================== --- trunk/console/plugins/gntgf.c 2006-08-20 16:38:10 UTC (rev 16903) +++ trunk/console/plugins/gntgf.c 2006-08-20 16:45:57 UTC (rev 16904) @@ -18,8 +18,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define GAIM_PLUGINS +#include "internal.h" + #define PLUGIN_STATIC_NAME "GntGf" #define PREFS_PREFIX "/plugins/gnt/gntgf" @@ -47,8 +48,6 @@ #include <gntplugin.h> -#define _(X) X - typedef struct { GntWidget *window; @@ -202,10 +201,10 @@ char *display; } prefs[] = { - {PREFS_EVENT_SIGNONF, _("Buddy signs on/off")}, - {PREFS_EVENT_IM_MSG, _("You receive an IM")}, - {PREFS_EVENT_CHAT_MSG, _("Someone speaks in a chat")}, - {PREFS_EVENT_CHAT_NICK, _("Someone says your name in a chat")}, + {PREFS_EVENT_SIGNONF, N_("Buddy signs on/off")}, + {PREFS_EVENT_IM_MSG, N_("You receive an IM")}, + {PREFS_EVENT_CHAT_MSG, N_("Someone speaks in a chat")}, + {PREFS_EVENT_CHAT_NICK, N_("Someone says your name in a chat")}, {NULL, NULL} }; Added: trunk/console/plugins/gnthistory.c =================================================================== --- trunk/console/plugins/gnthistory.c (rev 0) +++ trunk/console/plugins/gnthistory.c 2006-08-20 16:45:57 UTC (rev 16904) @@ -0,0 +1,202 @@ +/** + * @file gnthistory.c Show log from previous conversation + * + * Copyright (C) 2006 Sadrul Habib Chowdhury <sa...@us...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* Ripped from gtk/plugins/history.c */ + +#include "internal.h" +#include "gntgaim.h" + +#include "conversation.h" +#include "debug.h" +#include "log.h" +#include "notify.h" +#include "prefs.h" +#include "signals.h" +#include "util.h" +#include "version.h" + +#include "gntplugin.h" + +#include <gnttextview.h> + +#define HISTORY_PLUGIN_ID "gnt-history" + +#define HISTORY_SIZE (4 * 1024) + +static void historize(GaimConversation *c) +{ + GaimAccount *account = gaim_conversation_get_account(c); + const char *name = gaim_conversation_get_name(c); + GaimConversationType convtype; + GList *logs = NULL; + const char *alias = name; + guint flags; + char *history; + char *header; + + convtype = gaim_conversation_get_type(c); + if (convtype == GAIM_CONV_TYPE_IM) + { + GSList *buddies; + GSList *cur; + + /* If we're not logging, don't show anything. + * Otherwise, we might show a very old log. */ + if (!gaim_prefs_get_bool("/core/logging/log_ims")) + return; + + /* Find buddies for this conversation. */ + buddies = gaim_find_buddies(account, name); + + /* If we found at least one buddy, save the first buddy's alias. */ + if (buddies != NULL) + alias = gaim_buddy_get_contact_alias((GaimBuddy *)buddies->data); + + for (cur = buddies; cur != NULL; cur = cur->next) + { + GaimBlistNode *node = cur->data; + if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL))) + { + GaimBlistNode *node2; + + alias = gaim_buddy_get_contact_alias((GaimBuddy *)node); + + /* We've found a buddy that matches this conversation. It's part of a + * GaimContact with more than one GaimBuddy. Loop through the GaimBuddies + * in the contact and get all the logs. */ + for (node2 = node->parent->child ; node2 != NULL ; node2 = node2->next) + { + logs = g_list_concat( + gaim_log_get_logs(GAIM_LOG_IM, + gaim_buddy_get_name((GaimBuddy *)node2), + gaim_buddy_get_account((GaimBuddy *)node2)), + logs); + } + break; + } + } + g_slist_free(buddies); + + if (logs == NULL) + logs = gaim_log_get_logs(GAIM_LOG_IM, name, account); + else + logs = g_list_sort(logs, gaim_log_compare); + } + else if (convtype == GAIM_CONV_TYPE_CHAT) + { + /* If we're not logging, don't show anything. + * Otherwise, we might show a very old log. */ + if (!gaim_prefs_get_bool("/core/logging/log_chats")) + return; + + logs = gaim_log_get_logs(GAIM_LOG_CHAT, name, account); + } + + if (logs == NULL) + return; + + history = gaim_log_read((GaimLog*)logs->data, &flags); + + header = g_strdup_printf(_("<b>Conversation with %s on %s:</b><br>"), alias, + gaim_date_format_full(localtime(&((GaimLog *)logs->data)->time))); + gaim_conversation_write(c, "", header, GAIM_MESSAGE_NO_LOG, time(NULL)); + g_free(header); + + g_strchomp(history); + gaim_conversation_write(c, "", history, GAIM_MESSAGE_NO_LOG, time(NULL)); + g_free(history); + + gaim_conversation_write(c, "", "\n---------------\n", GAIM_MESSAGE_NO_LOG, time(NULL)); + + g_list_foreach(logs, (GFunc)gaim_log_free, NULL); + g_list_free(logs); +} + +static void +history_prefs_check(GaimPlugin *plugin) +{ + if (!gaim_prefs_get_bool("/core/logging/log_ims") && + !gaim_prefs_get_bool("/core/logging/log_chats")) + { + gaim_notify_warning(plugin, NULL, _("History Plugin Requires Logging"), + _("Logging can be enabled from Tools -> Preferences -> Logging.\n\n" + "Enabling logs for instant messages and/or chats will activate " + "history for the same conversation type(s).")); + } +} + +static void history_prefs_cb(const char *name, GaimPrefType type, + gconstpointer val, gpointer data) +{ + history_prefs_check((GaimPlugin *)data); +} + +static gboolean +plugin_load(GaimPlugin *plugin) +{ + gaim_signal_connect(gaim_conversations_get_handle(), + "conversation-created", + plugin, GAIM_CALLBACK(historize), NULL); + + gaim_prefs_connect_callback(plugin, "/core/logging/log_ims", + history_prefs_cb, plugin); + gaim_prefs_connect_callback(plugin, "/core/logging/log_chats", + history_prefs_cb, plugin); + + history_prefs_check(plugin); + + return TRUE; +} + +static GaimPluginInfo info = +{ + GAIM_PLUGIN_MAGIC, + GAIM_MAJOR_VERSION, + GAIM_MINOR_VERSION, + GAIM_PLUGIN_STANDARD, + NULL, + 0, + NULL, + GAIM_PRIORITY_DEFAULT, + HISTORY_PLUGIN_ID, + N_("GntHistory"), + VERSION, + N_("Shows recently logged conversations in new conversations."), + N_("When a new conversation is opened this plugin will insert " + "the last conversation into the current conversation."), + "Sean Egan <sea...@gm...>\n" + "Sadrul H Chowdhury <sa...@us...>", + GAIM_WEBSITE, + plugin_load, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +static void +init_plugin(GaimPlugin *plugin) +{ +} + +GAIM_INIT_PLUGIN(gnthistory, init_plugin, info) + Property changes on: trunk/console/plugins/gnthistory.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-20 16:38:15
|
Revision: 16903 Author: sadrul Date: 2006-08-20 09:38:10 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16903&view=rev Log Message: ----------- Revert the last commit, because it was retarded. Make the appropriate changes. Make sure logging happens if enabled. Modified Paths: -------------- trunk/console/gntconv.c trunk/console/libgnt/gnttextview.c Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-20 16:25:36 UTC (rev 16902) +++ trunk/console/gntconv.c 2006-08-20 16:38:10 UTC (rev 16903) @@ -236,6 +236,10 @@ g_return_if_fail(ggconv != NULL); + pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); + + gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); + if (gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps")) gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), gaim_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM); @@ -254,14 +258,11 @@ if (flags & GAIM_MESSAGE_NICK) fl |= GNT_TEXT_FLAG_UNDERLINE; - pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); - /* XXX: Remove this workaround when textview can parse messages. */ newline = gaim_strdup_withhtml(message); strip = gaim_markup_strip_html(newline); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), strip, fl); - gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); if (pos <= 1) gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); @@ -276,7 +277,7 @@ gg_write_chat(GaimConversation *conv, const char *who, const char *message, GaimMessageFlags flags, time_t mtime) { - gg_write_common(conv, who, message, flags, mtime); + gaim_conversation_write(conv, who, message, flags, mtime); } static void @@ -301,7 +302,7 @@ who = gaim_buddy_get_contact_alias(buddy); } - gg_write_common(conv, who, message, flags, mtime); + gaim_conversation_write(conv, who, message, flags, mtime); } static void Modified: trunk/console/libgnt/gnttextview.c =================================================================== --- trunk/console/libgnt/gnttextview.c 2006-08-20 16:25:36 UTC (rev 16902) +++ trunk/console/libgnt/gnttextview.c 2006-08-20 16:38:10 UTC (rev 16903) @@ -35,7 +35,7 @@ GList *iter; GntTextLine *line = lines->data; - wmove(widget->window, widget->priv.height - i, 0); + wmove(widget->window, widget->priv.height - 1 - i, 0); for (iter = line->segments; iter; iter = iter->next) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-20 16:25:42
|
Revision: 16902 Author: sadrul Date: 2006-08-20 09:25:36 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16902&view=rev Log Message: ----------- No blank line at the end. Modified Paths: -------------- trunk/console/libgnt/gnttextview.c Modified: trunk/console/libgnt/gnttextview.c =================================================================== --- trunk/console/libgnt/gnttextview.c 2006-08-20 16:20:45 UTC (rev 16901) +++ trunk/console/libgnt/gnttextview.c 2006-08-20 16:25:36 UTC (rev 16902) @@ -35,7 +35,7 @@ GList *iter; GntTextLine *line = lines->data; - wmove(widget->window, widget->priv.height - 1 - i, 0); + wmove(widget->window, widget->priv.height - i, 0); for (iter = line->segments; iter; iter = iter->next) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ebl...@us...> - 2006-08-20 16:20:55
|
Revision: 16901 Author: eblanton Date: 2006-08-20 09:20:45 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16901&view=rev Log Message: ----------- Alt+n window switching for libgnt Modified Paths: -------------- trunk/console/libgnt/gntmain.c Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-08-20 14:56:53 UTC (rev 16900) +++ trunk/console/libgnt/gntmain.c 2006-08-20 16:20:45 UTC (rev 16901) @@ -12,6 +12,7 @@ #include <locale.h> #include <unistd.h> #include <string.h> +#include <ctype.h> /** * Notes: Interesting functions to look at: @@ -240,6 +241,27 @@ } static void +switch_window_n(int n) +{ + GntWidget *w = NULL; + GList *l; + + if (focus_list) + w = focus_list->data; + + if ((l = g_list_nth(g_list_first(focus_list), n)) != NULL) + { + focus_list = l; + bring_on_top(focus_list->data); + } + + if (w && (!focus_list || w != focus_list->data)) + { + gnt_widget_set_focus(w, FALSE); + } +} + +static void window_list_activate(GntTree *tree, gpointer null) { GntWidget *widget = gnt_tree_get_selection_data(GNT_TREE(tree)); @@ -531,6 +553,15 @@ update_screen(NULL); draw_taskbar(); } + else if (strlen(buffer) == 2 && isdigit(*(buffer + 1))) + { + int n = *(buffer + 1) - '0'; + + if (n == 0) + n = 10; + + switch_window_n(n - 1); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fac...@us...> - 2006-08-20 14:57:12
|
Revision: 16900 Author: faceprint Date: 2006-08-20 07:56:53 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16900&view=rev Log Message: ----------- i think this should fix the blank version notices Modified Paths: -------------- trunk/gtk/plugins/relnot.c Modified: trunk/gtk/plugins/relnot.c =================================================================== --- trunk/gtk/plugins/relnot.c 2006-08-20 14:02:43 UTC (rev 16899) +++ trunk/gtk/plugins/relnot.c 2006-08-20 14:56:53 UTC (rev 16900) @@ -54,6 +54,12 @@ while(changelog[i] && changelog[i] != '\n') i++; + /* this basically means the version thing wasn't in the format we were + * looking for so sourceforge is probably having web server issues, and + * we should try again later */ + if(i == 0) + return; + cur_ver = g_strndup(changelog, i); changelog += i; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ebl...@us...> - 2006-08-20 14:02:49
|
Revision: 16899 Author: eblanton Date: 2006-08-20 07:02:43 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16899&view=rev Log Message: ----------- I miscalculated the default 80x24 height of the blist by the window list. Modified Paths: -------------- trunk/console/gntblist.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-20 07:13:35 UTC (rev 16898) +++ trunk/console/gntblist.c 2006-08-20 14:02:43 UTC (rev 16899) @@ -1092,7 +1092,7 @@ gaim_prefs_add_none(PREF_ROOT); gaim_prefs_add_none(PREF_ROOT "/size"); gaim_prefs_add_int(PREF_ROOT "/size/width", 20); - gaim_prefs_add_int(PREF_ROOT "/size/height", 18); + gaim_prefs_add_int(PREF_ROOT "/size/height", 17); gaim_prefs_add_none(PREF_ROOT "/position"); gaim_prefs_add_int(PREF_ROOT "/position/x", 0); gaim_prefs_add_int(PREF_ROOT "/position/y", 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-20 07:13:43
|
Revision: 16898 Author: sadrul Date: 2006-08-20 00:13:35 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16898&view=rev Log Message: ----------- libgaim and gaim should not link against ncursesw. libgaim should not link against gstreamer. Modified Paths: -------------- trunk/configure.ac trunk/console/libgnt/Makefile.am trunk/libgaim/Makefile.am Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2006-08-20 07:11:09 UTC (rev 16897) +++ trunk/configure.ac 2006-08-20 07:13:35 UTC (rev 16898) @@ -808,12 +808,14 @@ dnl ####################################################################### dnl # GNT Gaim dnl ####################################################################### +GNT_LIBS= if test "x$enable_gnt" = "xyes"; then - AC_CHECK_LIB(ncursesw, initscr, , [enable_gnt=no]) - AC_CHECK_LIB(panelw, update_panels, , [enable_gnt=no]) + AC_CHECK_LIB(ncursesw, initscr, [GNT_LIBS="-lncursesw"], [enable_gnt=no]) + AC_CHECK_LIB(panelw, update_panels, [GNT_LIBS="$GNT_LIBS -lpanelw"], [enable_gnt=no]) else enable_gnt=no fi +AC_SUBST(GNT_LIBS) AM_CONDITIONAL(ENABLE_GNT, test "x$enable_gnt" = "xyes") dnl ####################################################################### Modified: trunk/console/libgnt/Makefile.am =================================================================== --- trunk/console/libgnt/Makefile.am 2006-08-20 07:11:09 UTC (rev 16897) +++ trunk/console/libgnt/Makefile.am 2006-08-20 07:13:35 UTC (rev 16898) @@ -48,7 +48,7 @@ libgnt_la_LIBADD = \ $(GLIB_LIBS) \ $(STATIC_LINK_LIBS) \ - -lncursesw -lpanelw + $(GNT_LIBS) AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ Modified: trunk/libgaim/Makefile.am =================================================================== --- trunk/libgaim/Makefile.am 2006-08-20 07:11:09 UTC (rev 16897) +++ trunk/libgaim/Makefile.am 2006-08-20 07:13:35 UTC (rev 16898) @@ -256,9 +256,7 @@ @LIBOBJS@ \ $(DBUS_LIBS) \ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GOBJECT_LIBS) \ - $(GSTREAMER_LIBS) \ + $(LIBXML_LIBS) \ $(STATIC_LINK_LIBS) \ $(INTLLIBS) \ -lm @@ -270,7 +268,7 @@ -DLOCALEDIR=\"$(datadir)/locale\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -I$(top_srcdir)/plugins \ - $(GSTREAMER_CFLAGS) \ + $(GLIB_CFLAGS) \ $(DEBUG_CFLAGS) \ $(DBUS_CFLAGS) \ $(LIBXML_CFLAGS) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-20 07:11:15
|
Revision: 16897 Author: sadrul Date: 2006-08-20 00:11:09 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16897&view=rev Log Message: ----------- A couple more keybindings. Modified Paths: -------------- trunk/console/libgnt/gntentry.c trunk/console/libgnt/gntkeys.h trunk/console/libgnt/gntmain.c trunk/console/libgnt/gnttree.c Modified: trunk/console/libgnt/gntentry.c =================================================================== --- trunk/console/libgnt/gntentry.c 2006-08-20 02:24:15 UTC (rev 16896) +++ trunk/console/libgnt/gntentry.c 2006-08-20 07:11:09 UTC (rev 16897) @@ -255,6 +255,16 @@ move_forward(entry); return TRUE; } + else if (strcmp(text + 1, GNT_KEY_HOME) == 0) + { + move_start(entry); + return TRUE; + } + else if (strcmp(text + 1, GNT_KEY_END) == 0) + { + move_end(entry); + return TRUE; + } else if (strcmp(text + 1, GNT_KEY_CTRL_DOWN) == 0 && entry->histlength) { if (entry->history->prev) @@ -371,7 +381,14 @@ entry->end += len; while (str < next) - *(entry->cursor++) = *str++; + { + if (*str == '\r' || *str == '\n') + *entry->cursor = ' '; + else + *entry->cursor = *str; + entry->cursor++; + str++; + } while (g_utf8_pointer_to_offset(entry->scroll, entry->cursor) >= widget->priv.width) entry->scroll = g_utf8_find_next_char(entry->scroll, NULL); Modified: trunk/console/libgnt/gntkeys.h =================================================================== --- trunk/console/libgnt/gntkeys.h 2006-08-20 02:24:15 UTC (rev 16896) +++ trunk/console/libgnt/gntkeys.h 2006-08-20 07:11:09 UTC (rev 16897) @@ -16,6 +16,8 @@ #define GNT_KEY_PGUP "[5~" #define GNT_KEY_PGDOWN "[6~" +#define GNT_KEY_HOME "[7~" +#define GNT_KEY_END "[8~" #define GNT_KEY_ENTER "\r" Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-08-20 02:24:15 UTC (rev 16896) +++ trunk/console/libgnt/gntmain.c 2006-08-20 07:11:09 UTC (rev 16897) @@ -681,7 +681,9 @@ locale = setlocale(LC_ALL, ""); - g_io_channel_unref(channel); +#if 0 + g_io_channel_unref(channel); /* Apparently this causes crash for some people */ +#endif if (locale && (strstr(locale, "UTF") || strstr(locale, "utf"))) ascii_only = FALSE; Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-08-20 02:24:15 UTC (rev 16896) +++ trunk/console/libgnt/gnttree.c 2006-08-20 07:11:09 UTC (rev 16897) @@ -490,6 +490,41 @@ else redraw_tree(tree); } + else if (strcmp(text+1, GNT_KEY_PGDOWN) == 0) + { + row = get_next(tree->bottom); + if (row) + { + int dist = get_distance(tree->top, tree->current); + tree->top = tree->bottom; + tree->current = get_next_n_opt(tree->top, dist, NULL); + redraw_tree(tree); + } + else if (tree->current != tree->bottom) + { + tree->current = tree->bottom; + redraw_tree(tree); + } + } + else if (strcmp(text+1, GNT_KEY_PGUP) == 0) + { + if (tree->top != tree->root) + { + int dist = get_distance(tree->top, tree->current); + row = get_prev_n(tree->top, widget->priv.height - 1 - + tree->show_title * 2 - 2 * (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER) == 0)); + if (row == NULL) + row = tree->root; + tree->top = row; + tree->current = get_next_n_opt(tree->top, dist, NULL); + redraw_tree(tree); + } + else if (tree->current != tree->top) + { + tree->current = tree->top; + redraw_tree(tree); + } + } } else if (iscntrl(text[0])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ebl...@us...> - 2006-08-20 02:24:19
|
Revision: 16896 Author: eblanton Date: 2006-08-19 19:24:15 -0700 (Sat, 19 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16896&view=rev Log Message: ----------- Bind ^n and ^p for gnttree navigation Modified Paths: -------------- trunk/console/libgnt/gnttree.c Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-08-20 02:13:05 UTC (rev 16895) +++ trunk/console/libgnt/gnttree.c 2006-08-20 02:24:15 UTC (rev 16896) @@ -2,6 +2,7 @@ #include "gntmarshal.h" #include <string.h> +#include <ctype.h> enum { @@ -468,10 +469,10 @@ GntTree *tree = GNT_TREE(widget); GntTreeRow *old = tree->current; GntTreeRow *row; + int dist; if (text[0] == 27) { - int dist; if (strcmp(text+1, GNT_KEY_DOWN) == 0 && (row = get_next(tree->current)) != NULL) { tree->current = row; @@ -490,9 +491,29 @@ redraw_tree(tree); } } - else if (text[0] == '\r') + else if (iscntrl(text[0])) { - gnt_widget_activate(widget); + if (strcmp(text, GNT_KEY_CTRL_N) == 0 && (row = get_next(tree->current)) != NULL) + { + tree->current = row; + if ((dist = get_distance(tree->current, tree->bottom)) < 0) + gnt_tree_scroll(tree, -dist); + else + redraw_tree(tree); + } + else if (strcmp(text, GNT_KEY_CTRL_P) == 0 && (row = get_prev(tree->current)) != NULL) + { + tree->current = row; + + if ((dist = get_distance(tree->current, tree->top)) > 0) + gnt_tree_scroll(tree, -dist); + else + redraw_tree(tree); + } + else if (text[0] == '\r') + { + gnt_widget_activate(widget); + } } else if (text[0] == ' ' && text[1] == 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |