Mercurial > pidgin.yaz
changeset 970:9eb07b383df4
[gaim-migrate @ 980]
Bleat.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Wed, 11 Oct 2000 00:31:15 +0000 |
parents | eb5a82d64ce5 |
children | 26354cf6a362 |
files | src/gaim.h src/plugins.c src/prefs.c src/server.c src/toc.c src/util.c |
diffstat | 6 files changed, 48 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gaim.h Tue Oct 10 20:23:45 2000 +0000 +++ b/src/gaim.h Wed Oct 11 00:31:15 2000 +0000 @@ -790,6 +790,7 @@ /* Functions in prefs.c */ extern void debug_print( char * chars ); +extern void debug_printf( char * fmt, ... ); extern void set_general_option(GtkWidget *, int *); extern void set_option(GtkWidget *, int *); extern void show_prefs();
--- a/src/plugins.c Tue Oct 10 20:23:45 2000 +0000 +++ b/src/plugins.c Wed Oct 11 00:31:15 2000 +0000 @@ -152,9 +152,7 @@ while (c) { plug = (struct gaim_plugin *)c->data; if (!strcmp(filename, plug->filename)) { - sprintf(debug_buff, _("Already loaded %s, " - "not reloading.\n"), filename); - debug_print(debug_buff); + debug_printf( _("Already loaded %s, not reloading.\n"), filename); return; } c = g_list_next(c); @@ -166,8 +164,7 @@ else plug->filename = g_strdup(filename); - sprintf(debug_buff, "Loading %s\n", filename); - debug_print(debug_buff); + debug_printf("Loading %s\n", filename); /* do NOT `OR' with RTLD_GLOBAL, otherwise plugins may conflict * (it's really just a way to work around other people's bad * programming, by not using RTLD_GLOBAL :P ) */ @@ -190,8 +187,7 @@ } retval = (*gaim_plugin_init)(plug->handle); - sprintf(debug_buff, "loaded plugin returned %d\n", retval); - debug_print(debug_buff); + debug_printf("loaded plugin returned %d\n", retval); if (retval < 0) { GList *c = callbacks; struct gaim_callback *g;
--- a/src/prefs.c Tue Oct 10 20:23:45 2000 +0000 +++ b/src/prefs.c Wed Oct 11 00:31:15 2000 +0000 @@ -31,6 +31,7 @@ #include <unistd.h> #include <stdio.h> #include <stdlib.h> +#include <stdarg.h> #include <gtk/gtk.h> #include "gaim.h" #include "proxy.h" @@ -1805,6 +1806,21 @@ #endif } +void debug_printf(char *fmt, ...) +{ + va_list ap; + gchar *s; + + if (general_options & OPT_GEN_DEBUG && dw) { + va_start(ap, fmt); + s = g_strdup_vprintf(fmt, ap); + va_end(ap); + + gtk_text_insert(GTK_TEXT(dw->entry), NULL, NULL, NULL, s, -1); + g_free(s); + } +} + static gint handle_delete(GtkWidget *w, GdkEvent *event, void *dummy) { save_prefs();
--- a/src/server.c Tue Oct 10 20:23:45 2000 +0000 +++ b/src/server.c Wed Oct 11 00:31:15 2000 +0000 @@ -142,8 +142,7 @@ struct conversation *cnv = find_conversation(name); if (cnv && cnv->is_direct) { if (cnv->gc->protocol == PROTO_OSCAR) { - sprintf(debug_buff, "Sending DirectIM to %s\n", name); - debug_print(debug_buff); + debug_printf("Sending DirectIM to %s\n", name); aim_send_im_direct(cnv->gc->oscar_sess, cnv->conn, message); } else { /* Direct IM TOC FIXME */
--- a/src/toc.c Tue Oct 10 20:23:45 2000 +0000 +++ b/src/toc.c Wed Oct 11 00:31:15 2000 +0000 @@ -39,7 +39,7 @@ #include "gaim.h" #include "gnome_applet_mgr.h" -#define REVISION "gaim:$Revision: 976 $" +#define REVISION "gaim:$Revision: 980 $" static unsigned int peer_ver=0; @@ -169,7 +169,7 @@ if (gc->keepalive < 0) update_keepalive(gc, gc->options & OPT_USR_KEEPALV); - serv_finish_login(gc); + serv_finish_login(gc); gaim_setup(gc); return 0; } @@ -232,19 +232,16 @@ struct sflap_hdr hdr; char obuf[MSG_LEN]; - /* One _last_ 2048 check here! This shouldn't ever - * get hit though, hopefully. If it gets hit on an IM - * It'll lose the last " and the message won't go through, - * but this'll stop a segfault. */ - if (strlen(buf) > (MSG_LEN - sizeof(hdr))) { - buf[MSG_LEN - sizeof(hdr) - 3] = '"'; - buf[MSG_LEN - sizeof(hdr) - 2] = '\0'; - } + /* One _last_ 2048 check here! This shouldn't ever + * get hit though, hopefully. If it gets hit on an IM + * It'll lose the last " and the message won't go through, + * but this'll stop a segfault. */ + if (strlen(buf) > (MSG_LEN - sizeof(hdr))) { + buf[MSG_LEN - sizeof(hdr) - 3] = '"'; + buf[MSG_LEN - sizeof(hdr) - 2] = '\0'; + } - sprintf(debug_buff,"%s [Len %d]\n", buf, strlen(buf)); - debug_print(debug_buff); - - + debug_printf("%s [Len %d]\n", buf, strlen(buf)); if (olen < 0) len = escape_message(buf);
--- a/src/util.c Tue Oct 10 20:23:45 2000 +0000 +++ b/src/util.c Wed Oct 11 00:31:15 2000 +0000 @@ -51,34 +51,28 @@ gint badchar(char c) { - if (c == ' ') - return 1; - if (c == ',') - return 1; - if (c == ')') - return 1; - if (c == '(') - return 1; - if (c == 0) - return 1; - if (c == '\n') - return 1; - if (c == '<') + switch(c) { + case ' ': + case ',': + case '(': + case ')': + case '\0': + case '\n ': + case '<': + case '>': return 1; - if (c == '>') - return 1; - return 0; - - + default: + return 0; + } } -char *sec_to_text(int sec) +gchar *sec_to_text(gint sec) { int hrs, min; char minutes[64]; char hours[64]; - char sep[16]; + char *sep; char *ret = g_malloc(256); hrs = sec / 3600; @@ -92,7 +86,7 @@ g_snprintf(minutes, sizeof(minutes), "%d minute.", min); else g_snprintf(minutes, sizeof(minutes), "%d minutes.", min); - sprintf(sep, ", "); + sep = ", "; } else { if (!hrs) g_snprintf(minutes, sizeof(minutes), "%d minutes.", min); @@ -100,7 +94,7 @@ minutes[0] = '.'; minutes[1] = '\0'; } - sep[0] = '\0'; + sep = ""; } if (hrs) {