changeset 3159:fce1883cc608

[gaim-migrate @ 3175] new shortcuts: Ctrl-- Decrease Font Size Ctrl-= Increase Font Size Ctrl-0 Normal Font Size Ctrl-F Select Font Ctrl-C Text Color Ctrl-W Close IM/Chat Window (or Tab, if using tabbed conversations) Ctrl-N New IM/Chat Tab (if using tabbed conversations) Ctrl-Z Minimize (Iconify) IM/Chat Window -As suggested by Shreedeep K Bhachech committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 20 Apr 2002 08:10:13 +0000
parents ea6f8d8d74e5
children 09e342b27eff
files ChangeLog po/.cvsignore src/buddy.c src/conversation.c src/dialogs.c src/gtkimhtml.c src/gtkimhtml.h src/protocols/jabber/jabber.c src/protocols/jabber/jconn.c src/protocols/jabber/xstream.c src/protocols/oscar/im.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/ui.h
diffstat 14 files changed, 108 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Apr 20 07:07:06 2002 +0000
+++ b/ChangeLog	Sat Apr 20 08:10:13 2002 +0000
@@ -7,6 +7,8 @@
 	  Nathan Walp)
 	* Danish translation added (Thanks, Sarauw Hansen)
 	* Finnish translation update (Thanks, Tero Kuusela)
+	* Jabber improvements (Thanks, Nathan Walp)
+	* More keyboard shortcuts
 
 version 0.56 (04/11/2002):
 	* German translation update (Thanks Karsten Weiss)
--- a/po/.cvsignore	Sat Apr 20 07:07:06 2002 +0000
+++ b/po/.cvsignore	Sat Apr 20 08:10:13 2002 +0000
@@ -18,3 +18,4 @@
 sk.gmo
 fi.gmo
 it.gmo
+da.gmo
--- a/src/buddy.c	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/buddy.c	Sat Apr 20 08:10:13 2002 +0000
@@ -33,6 +33,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <ctype.h>
 #include <math.h>
 #include <time.h>
 #include <unistd.h>
@@ -1194,7 +1195,7 @@
 	
 	style = gtk_widget_get_style( widget );
 	
-	if (gc->prpl->list_icon)
+	if (gc->prpl->list_icon) {
 		if (gc->prpl->protocol ==  PROTO_OSCAR) { 
 			if (isdigit(*gc->username)) {
 				xpm = gc->prpl->list_icon(0);
@@ -1204,6 +1205,7 @@
 		} else { 
 			xpm = gc->prpl->list_icon (0);
 		}
+	}
 	if (xpm == NULL)
 		xpm = (char **)no_icon_xpm;
 	
@@ -1826,7 +1828,6 @@
 	GdkBitmap *bm;
 	GtkStyle *style;
 	GtkStyle *style2;
-	int j;
 
 	g->name = g_strdup(group);
 
--- a/src/conversation.c	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/conversation.c	Sat Apr 20 08:10:13 2002 +0000
@@ -31,6 +31,8 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <ctype.h>
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
 #include <gtk/gtk.h>
 #include "gtkimhtml.h"
 #include <gdk/gdkkeysyms.h>
@@ -852,18 +854,14 @@
 		int pos = 0;
 		switch (event->keyval) {
 		case GDK_Up:
-			debug_printf("YOU HIT UP!\n");
 			if (!c->send_history)
 				break;
-			debug_printf("history exists\n");
 			if (!c->send_history->prev) {
-				debug_printf("at curent\n");
 				if (c->send_history->data)
 					g_free(c->send_history->data);
 				c->send_history->data = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
 			} 
 			if (c->send_history->next && c->send_history->next->data) {
-				debug_printf("going to ->next\n");
 				c->send_history = c->send_history->next;
 				gtk_editable_delete_text (GTK_EDITABLE(entry),0,-1);
 				gtk_editable_insert_text(GTK_EDITABLE(entry), 
@@ -918,6 +916,34 @@
 				do_strike(c->strike, c->entry);
 				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
 				break;
+			
+			case '-':
+				do_small(NULL, c->entry);
+				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+				break;
+			case '=':
+			case '+':
+				do_big(NULL, c->entry);
+				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+				break;	
+			case '0':
+				do_normal(NULL, c->entry);
+				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+				break;
+			case 'f':
+			case 'F':
+				quiet_set(c->font,
+					  !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->font)));
+				toggle_font(c->font, c);
+				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+				break;
+			case 'c':
+			case 'C':
+				quiet_set(c->fgcolorbtn,
+					  !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->fgcolorbtn)));
+				toggle_fg_color(c->fgcolorbtn, c);
+				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+				break;
 			}
 		}
 		if (convo_options & OPT_CONVO_CTL_SMILEYS) {
@@ -990,7 +1016,22 @@
 			gtk_imhtml_clear(GTK_IMHTML(c->text));
 			g_string_free(c->history, TRUE);
 			c->history = g_string_new("");
+		} else if (event->keyval == 'w') {
+			gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+			close_callback(c->close, c);
+			c = NULL;
+			return TRUE;
+		} else if (event->keyval == 'n') {
+			gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+			show_im_dialog();
+		} else if (event->keyval == 'z') {
+			gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+			XIconifyWindow(GDK_DISPLAY(),
+				       GDK_WINDOW_XWINDOW(c->window->window),
+				       ((_XPrivDisplay)GDK_DISPLAY())->default_screen);		     
 		}
+		
+
 		if ((!c->is_chat && (im_options & OPT_IM_ONE_WINDOW)) ||
 		    (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) {
 			GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook);
@@ -1164,8 +1205,8 @@
 				imflags = IM_FLAG_CHECKBOX;
 			
 			if (c->images) {
-				int id, offset;
-				char *bigbuf;
+				int id = 0, offset = 0;
+				char *bigbuf = NULL;
 				GSList *tmplist = c->images;
 				id = 1;
 				
--- a/src/dialogs.c	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/dialogs.c	Sat Apr 20 08:10:13 2002 +0000
@@ -3218,7 +3218,6 @@
 void insert_smiley_text(GtkWidget *widget, struct conversation *c)
 {
 	char *smiley_text;
-	int i;
 
 	smiley_text = strdup(current_smiley);
 
--- a/src/gtkimhtml.c	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/gtkimhtml.c	Sat Apr 20 08:10:13 2002 +0000
@@ -2263,7 +2263,7 @@
 	return imhtml_type;
 }
 
-static void
+void
 gtk_imhtml_init_smileys (GtkIMHtml *imhtml)
 {
 	g_return_if_fail (imhtml != NULL);
--- a/src/gtkimhtml.h	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/gtkimhtml.h	Sat Apr 20 08:10:13 2002 +0000
@@ -121,7 +121,7 @@
 					gchar            *text,
 					gchar           **xpm);
 
-static void 	   gtk_imhtml_init_smileys     (GtkIMHtml *imhtml);
+void 	   gtk_imhtml_init_smileys     (GtkIMHtml *imhtml);
 
 void       gtk_imhtml_remove_smileys   (GtkIMHtml        *imhtml);
 
--- a/src/protocols/jabber/jabber.c	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/protocols/jabber/jabber.c	Sat Apr 20 08:10:13 2002 +0000
@@ -731,15 +731,40 @@
 	}
 }
 
+static time_t iso8601_to_time(char *timestamp)
+{
+   struct tm t;
+   if(sscanf(timestamp,"%04d%02d%02dT%02d:%02d:%02d", &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec))
+   {
+      t.tm_year -= 1900;
+      t.tm_mon -= 1;
+      return mktime(&t) - timezone;
+   }
+   return 0;
+}
+
 static void jabber_handlemessage(gjconn gjc, jpacket p)
 {
-	xmlnode y, xmlns, subj;
+	xmlnode y, xmlns, subj, z;
+	time_t time_sent = time(NULL);
 
 	char *from = NULL, *msg = NULL, *type = NULL, *topic = NULL;
 	char m[BUF_LONG * 2];
 
 	type = xmlnode_get_attrib(p->x, "type");
 
+	z = xmlnode_get_firstchild(p->x);
+
+	while(z)
+	{
+	   if(NSCHECK(z,NS_DELAY))
+	   {
+	      char *timestamp = xmlnode_get_attrib(z,"stamp");
+	      time_sent = iso8601_to_time(timestamp);
+	   }
+	   z = xmlnode_get_nextsibling(z);
+	}
+
 	if (!type || !strcasecmp(type, "normal") || !strcasecmp(type, "chat")) {
 
 		/* XXX namespaces could be handled better. (mid) */
@@ -778,13 +803,13 @@
 			struct jabber_chat *jc;
 			g_snprintf(m, sizeof(m), "%s", msg);
 			if (((jc = find_existing_chat(GJ_GC(gjc), p->from)) != NULL) && jc->b)
-				serv_got_chat_in(GJ_GC(gjc), jc->b->id, p->from->resource, 1, m, time(NULL));
+				serv_got_chat_in(GJ_GC(gjc), jc->b->id, p->from->resource, 1, m, time_sent);
 			else {
 				int flags = 0;
 				if (xmlnode_get_tag(p->x, "gaim"))
 					flags = IM_FLAG_GAIMUSER;
 				if (find_conversation(jid_full(p->from)))
-					serv_got_im(GJ_GC(gjc), jid_full(p->from), m, flags, time(NULL), -1);
+					serv_got_im(GJ_GC(gjc), jid_full(p->from), m, flags, time_sent, -1);
 				else {
 					if(p->from->user) {
 					    from = g_strdup_printf("%s@%s", p->from->user, p->from->server);
@@ -792,7 +817,7 @@
 					    /* server message? */
 					    from = g_strdup(p->from->server);
 					}
-					serv_got_im(GJ_GC(gjc), from, m, flags, time(NULL), -1);
+					serv_got_im(GJ_GC(gjc), from, m, flags, time_sent, -1);
 					g_free(from);
 				}
 			}
@@ -870,7 +895,7 @@
 				
 
 				g_snprintf(buf, sizeof(buf), "%s", msg);
-				serv_got_chat_in(GJ_GC(gjc), jc->b->id, p->from->resource, 0, buf, time(NULL));
+				serv_got_chat_in(GJ_GC(gjc), jc->b->id, p->from->resource, 0, buf, time_sent);
 			}
 		} else { /* message from the server */
 		   	if(jc->b && topic) {
@@ -887,7 +912,7 @@
 		debug_printf("unhandled message %s\n", type);
 	}
 }
-
+	   
 static void jabber_handlepresence(gjconn gjc, jpacket p)
 {
 	char *to, *from, *type;
@@ -908,20 +933,18 @@
 	from = xmlnode_get_attrib(p->x, "from");
 	type = xmlnode_get_attrib(p->x, "type");
 	
-	z = xmlnode_get_tag(p->x, "x");
+	z = xmlnode_get_firstchild(p->x);
 	
-	if(NSCHECK(z,NS_DELAY))
+	while(z)
 	{
-	   struct tm t;
-	   char *timestamp = xmlnode_get_attrib(z,"stamp");
-	   if(sscanf(timestamp,"%04d%02d%02dT%02d:%02d:%02d", &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec))
+	   if(NSCHECK(z,NS_DELAY))
 	   {
-	      t.tm_year -= 1900;
-	      t.tm_mon -= 1;
-	      signon = mktime(&t) - timezone;
+	      char *timestamp = xmlnode_get_attrib(z,"stamp");
+	      signon = iso8601_to_time(timestamp);
 	   }
+	   z = xmlnode_get_nextsibling(z);
 	}
-
+	
 	if ((y = xmlnode_get_tag(p->x, "show"))) {
 		show = xmlnode_get_data(y);
 		if (!show) {
--- a/src/protocols/jabber/jconn.c	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/protocols/jabber/jconn.c	Sat Apr 20 08:10:13 2002 +0000
@@ -384,7 +384,7 @@
 char *jab_reg(jconn j)
 {
     xmlnode x,y,z;
-    char *hash, *user, *id;
+    char *user, *id;
 
     if (!j) return(NULL);
 
--- a/src/protocols/jabber/xstream.c	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/protocols/jabber/xstream.c	Sat Apr 20 08:10:13 2002 +0000
@@ -153,7 +153,7 @@
 /* attempts to parse the buff onto this stream firing events to the handler, returns the last known status */
 int xstream_eat(xstream xs, char *buff, int len)
 {
-    char *err;
+    char *err = NULL;
     xmlnode xerr;
     static char maxerr[] = "maximum node size reached";
     static char deeperr[] = "maximum node depth reached";
--- a/src/protocols/oscar/im.c	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/protocols/oscar/im.c	Sat Apr 20 08:10:13 2002 +0000
@@ -1603,7 +1603,7 @@
 	aim_rxcallback_t userfunc;
 	aim_tlv_t *block;
 	struct aim_incomingim_ch4_args args;
-	int ret;
+	int ret = 0;
 
 	/*
 	 * Make a bstream for the meaty part.  Yum.  Meat.
--- a/src/protocols/oscar/oscar.c	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/protocols/oscar/oscar.c	Sat Apr 20 08:10:13 2002 +0000
@@ -1444,7 +1444,7 @@
 static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) {
 	char *uin, message;
 	struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
-	uin = g_strdup_printf("%d", data->uin);
+	uin = g_strdup_printf("%lu", data->uin);
 	message = 0;
 	aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message);
 	show_got_added(data->gc, NULL, uin, NULL, NULL);
@@ -1456,7 +1456,7 @@
 	if (data->uin) {
 		char *uin, *message;
 		struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
-		uin = g_strdup_printf("%d", data->uin);
+		uin = g_strdup_printf("%lu", data->uin);
 		message = g_strdup_printf("No reason given.");
 		aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHDENIED, message);
 		g_free(uin);
@@ -1471,8 +1471,8 @@
 static void gaim_icq_authask(struct gaim_connection *gc, fu32_t uin, char *msg) {
 	struct icq_auth *data = g_new(struct icq_auth, 1);
 	/* The first 6 chars of the message are some type of alien gibberish, so skip them */
-	char *dialog_msg = g_strdup_printf("The user %d wants to add you to their buddy list for the following reason:\n\n%s", uin, (msg && strlen(msg)>6) ? msg+6 : "No reason given.");
-	debug_printf("Received an authorization request from UIN %ld\n", uin);
+	char *dialog_msg = g_strdup_printf("The user %lu wants to add you to their buddy list for the following reason:\n\n%s", uin, (msg && strlen(msg)>6) ? msg+6 : "No reason given.");
+	debug_printf("Received an authorization request from UIN %lu\n", uin);
 	data->gc = gc;
 	data->uin = uin;
 	do_ask_dialog(dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
@@ -1489,14 +1489,14 @@
 
 		case 0x0007: { /* Someone has denied you authorization */
 			char *dialog_msg;
-			dialog_msg = g_strdup_printf(_("The user %d has denied your request to add them to your contact list for the following reason:\n\n"), args->uin, args->msg ? args->msg : _("No reason given."));
+			dialog_msg = g_strdup_printf(_("The user %lu has denied your request to add them to your contact list for the following reason:\n%s"), args->uin, args->msg ? args->msg : _("No reason given."));
 			do_error_dialog(dialog_msg, _("Gaim - ICQ Authorization Denied"));
 			g_free(dialog_msg);
 		} break;
 
 		case 0x0008: { /* Someone has granted you authorization */
 			char *dialog_msg;
-			dialog_msg = g_strdup_printf(_("The user %d has granted your request to add them to your contact list."), args->uin);
+			dialog_msg = g_strdup_printf(_("The user %lu has granted your request to add them to your contact list."), args->uin);
 			do_error_dialog(dialog_msg, _("Gaim - ICQ Authorization Granted"));
 			g_free(dialog_msg);
 		} break;
@@ -2364,14 +2364,14 @@
 
 		case 0x0007: { /* Someone has denied you authorization */
 			char *dialog_msg;
-			dialog_msg = g_strdup_printf(_("The user %d has denied your request to add them to your contact list for the following reason:\n\n"), msg->sender, msg->msg ? msg->msg : _("No reason given."));
+			dialog_msg = g_strdup_printf(_("The user %lu has denied your request to add them to your contact list for the following reason:\n%s"), msg->sender, msg->msg ? msg->msg : _("No reason given."));
 			do_error_dialog(dialog_msg, _("Gaim - ICQ Authorization Denied"));
 			g_free(dialog_msg);
 		} break;
 
 		case 0x0008: { /* Someone has granted you authorization */
 			char *dialog_msg;
-			dialog_msg = g_strdup_printf(_("The user %d has granted your request to add them to your contact list."), msg->sender);
+			dialog_msg = g_strdup_printf(_("The user %lu has granted your request to add them to your contact list."), msg->sender);
 			do_error_dialog(dialog_msg, _("Gaim - ICQ Authorization Granted"));
 			g_free(dialog_msg);
 		} break;
--- a/src/protocols/toc/toc.c	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/protocols/toc/toc.c	Sat Apr 20 08:10:13 2002 +0000
@@ -789,7 +789,7 @@
 	} else if (!strcasecmp(c, "RVOUS_PROPOSE")) {
 		char *user, *uuid, *cookie;
 		int seq;
-		char *rip, *pip, *vip, *trillian;
+		char *rip, *pip, *vip, *trillian = NULL;
 		int port;
 		
 		user = strtok(NULL, ":");
--- a/src/ui.h	Sat Apr 20 07:07:06 2002 +0000
+++ b/src/ui.h	Sat Apr 20 08:10:13 2002 +0000
@@ -348,6 +348,7 @@
 extern void toggle_buddy_pixmaps();
 extern void gaim_separator(GtkWidget *);
 extern void redo_buddy_list(); /* you really shouldn't call this function */
+extern void set_blist_tab();
 
 /* Functions in buddy_chat.c */
 extern void join_chat();
@@ -395,6 +396,7 @@
 extern void toggle_spellchk();
 extern void set_convo_gc(struct conversation *, struct gaim_connection *);
 extern void update_buttons_by_protocol(struct conversation *);
+extern void toggle_fg_color(GtkWidget *, struct conversation *);
 extern void toggle_smileys();
 extern void toggle_timestamps();
 extern void update_pixmaps();
@@ -408,6 +410,7 @@
 extern void update_progress(struct conversation *, float);
 extern void show_typing(struct conversation *);
 extern gboolean reset_typing(char *);
+extern void set_anim();
 
 /* Functions in dialogs.c */
 extern void alias_dialog_bud(struct buddy *);