changeset 18656:2848d536ac7e

merge of '004a538ba55a170d9662546cda8d93eb7d64507b' and '0a09dfc15a18e5e6eb535ecef8289b9a2ecb2fbd'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 27 Jul 2007 10:48:24 +0000
parents 2ec7abcedf47 (diff) a5f441181e48 (current diff)
children 46629aab70b1 1987beefd494
files pidgin/gtkconv.c
diffstat 6 files changed, 32 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/idle.c	Fri Jul 27 10:44:24 2007 +0000
+++ b/libpurple/idle.c	Fri Jul 27 10:48:24 2007 +0000
@@ -30,8 +30,6 @@
 #include "savedstatuses.h"
 #include "signals.h"
 
-#define IDLEMARK 600 /* 10 minutes! */
-
 typedef enum
 {
 	PURPLE_IDLE_NOT_AWAY = 0,
@@ -121,7 +119,7 @@
 	gboolean report_idle = TRUE;
 	gint away_seconds = 0;
 	gint idle_recheck_interval = 0;
-
+	gint idle_poll_seconds = purple_prefs_get_int("/purple/away/mins_before_away") * 60;
 	purple_signal_emit(purple_blist_get_handle(), "update-idle");
 
 	idle_reporting = purple_prefs_get_string("/purple/away/idle_reporting");
@@ -132,7 +130,7 @@
 	{
 		/* Use system idle time (mouse or keyboard movement, etc.) */
 		time_idle = idle_ui_ops->get_time_idle();
-		idle_recheck_interval = 60;
+		idle_recheck_interval = 1;
 	}
 	else if (!strcmp(idle_reporting, "purple"))
 	{
@@ -153,7 +151,7 @@
 			if ((idle_ui_ops != NULL) && (idle_ui_ops->get_time_idle != NULL))
 			{
 				time_idle = idle_ui_ops->get_time_idle();
-				idle_recheck_interval = 60;
+				idle_recheck_interval = 1;
 			}
 			else
 			{
@@ -173,7 +171,7 @@
 		}
 	}
 
-	time_until_next_idle_event = IDLEMARK - time_idle;
+	time_until_next_idle_event = idle_poll_seconds - time_idle;
 	if (time_until_next_idle_event < 0)
 	{
 		/* If we're already idle, check again as appropriate. */
@@ -197,7 +195,7 @@
 	}
 
 	/* Idle reporting stuff */
-	if (report_idle && (time_idle >= IDLEMARK))
+	if (report_idle && (time_idle >= idle_poll_seconds))
 	{
 		GList *l;
 		for (l = purple_connections_get_all(); l != NULL; l = l->next)
@@ -206,7 +204,7 @@
 			set_account_idle(purple_connection_get_account(gc), time_idle);
 		}
 	}
-	else if (!report_idle || (time_idle < IDLEMARK))
+	else if (!report_idle || (time_idle < idle_poll_seconds ))
 	{
 		while (idled_accts != NULL)
 			set_account_unidle(idled_accts->data);
@@ -306,6 +304,11 @@
 
 static gboolean _do_purple_idle_touch_cb(gpointer data)
 {
+	int idle_poll_minutes = purple_prefs_get_int("/purple/away/mins_before_away");
+
+	 /* +1 more for g_timeout_add_seconds rounding. */
+	idle_timer = purple_timeout_add_seconds((idle_poll_minutes * 60) + 2, check_idleness_timer, NULL);
+
 	purple_idle_touch();
 
 	return FALSE;
@@ -315,11 +318,6 @@
 void
 purple_idle_init()
 {
-	/* Add the timer to check if we're idle.
-	 * IDLEMARK + 1 as the boundary,
-	 * +1 more for g_timeout_add_seconds rounding. */
-	idle_timer = purple_timeout_add_seconds((IDLEMARK + 2), check_idleness_timer, NULL);
-
 	purple_signal_connect(purple_conversations_get_handle(), "sent-im-msg",
 						purple_idle_get_handle(),
 						PURPLE_CALLBACK(im_msg_sent_cb), NULL);
--- a/libpurple/protocols/bonjour/jabber.c	Fri Jul 27 10:44:24 2007 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Fri Jul 27 10:48:24 2007 +0000
@@ -350,7 +350,6 @@
 	PurpleAccount *account = pb->account;
 	BonjourBuddy *bb = pb->proto_data;
 	gboolean closed_conversation = FALSE;
-	xmlnode *message_node;
 
 	/* Read the data from the socket */
 	if ((message_length = _read_data(socket, &message)) == -1) {
@@ -374,9 +373,6 @@
 		}
 	}
 
-	/* Parse the message into an XMLnode for analysis */
-	message_node = xmlnode_from_str(message, strlen(message));
-
 	/*
 	 * Check that this is not the end of the conversation.  This is
 	 * using a magic string, but xmlnode won't play nice when just
@@ -396,16 +392,22 @@
 			purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
 			g_free(tmp);
 		}
-	} else if (message_node != NULL) {
-		/* Parse the message to get the data and send to the ui */
-		_jabber_parse_and_write_message_to_ui(message_node, account->gc, pb);
 	} else {
-		/* TODO: Deal with receiving only a partial message */
+		xmlnode *message_node;
+
+		/* Parse the message into an XMLnode for analysis */
+		message_node = xmlnode_from_str(message, strlen(message));
+
+		if (message_node != NULL) {
+			/* Parse the message to get the data and send to the ui */
+			_jabber_parse_and_write_message_to_ui(message_node, account->gc, pb);
+			xmlnode_free(message_node);
+		} else {
+			/* TODO: Deal with receiving only a partial message */
+		}
 	}
 
 	g_free(message);
-	if (message_node != NULL)
-		xmlnode_free(message_node);
 }
 
 struct _stream_start_data {
@@ -638,7 +640,7 @@
 	PurpleBuddy *pb = data;
 	BonjourBuddy *bb = pb->proto_data;
 	int len, ret;
-	char *stream_start = g_strdup_printf(DOCTYPE, purple_account_get_username(pb->account), purple_buddy_get_name(pb));
+	char *stream_start;
 
 	bb->conversation->connect_data = NULL;
 
@@ -659,6 +661,7 @@
 		return;
 	}
 
+	stream_start = g_strdup_printf(DOCTYPE, purple_account_get_username(pb->account), purple_buddy_get_name(pb));
 	len = strlen(stream_start);
 
 	/* Start the stream and send queued messages */
--- a/libpurple/protocols/oscar/family_chatnav.c	Fri Jul 27 10:44:24 2007 +0000
+++ b/libpurple/protocols/oscar/family_chatnav.c	Fri Jul 27 10:48:24 2007 +0000
@@ -427,7 +427,7 @@
 	if (snac2->type == 0x0002) /* request chat rights */
 		ret = parseinfo_perms(od, conn, mod, frame, snac, bs, snac2);
 	else if (snac2->type == 0x0003) /* request exchange info */
-		purple_debug_misc("oscar", "chatnav_parse_info: resposne to exchange info\n");
+		purple_debug_misc("oscar", "chatnav_parse_info: response to exchange info\n");
 	else if (snac2->type == 0x0004) /* request room info */
 		purple_debug_misc("oscar", "chatnav_parse_info: response to room info\n");
 	else if (snac2->type == 0x0005) /* request more room info */
--- a/libpurple/protocols/oscar/tlv.c	Fri Jul 27 10:44:24 2007 +0000
+++ b/libpurple/protocols/oscar/tlv.c	Fri Jul 27 10:48:24 2007 +0000
@@ -423,25 +423,6 @@
 }
 
 /**
- * Adds the given userinfo struct to a TLV chain.
- *
- * @param list Destination chain.
- * @param type TLV type to add.
- * @return The size of the value added.
- */
-int aim_tlvlist_add_userinfo(GSList **list, guint16 type, aim_userinfo_t *userinfo)
-{
-	guint8 buf[1024]; /* TODO: Don't use a fixed length buffer */
-	ByteStream bs;
-
-	byte_stream_init(&bs, buf, sizeof(buf));
-
-	aim_putuserinfo(&bs, userinfo);
-
-	return aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), buf);
-}
-
-/**
  * Adds the given chatroom info to a TLV chain.
  *
  * @param list Destination chain.
--- a/libpurple/protocols/yahoo/yahoo.c	Fri Jul 27 10:44:24 2007 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Fri Jul 27 10:48:24 2007 +0000
@@ -1917,6 +1917,7 @@
 	char *msg;
 	char *url = NULL;
 	char *fullmsg;
+	PurpleAccount *account = gc->account;
 
 	while (l) {
 		struct yahoo_pair *pair = l->data;
@@ -1949,6 +1950,9 @@
 			return;
 		}
 #endif
+		if (!purple_account_get_remember_password(account))
+			purple_account_set_password(account, NULL);
+
 		msg = g_strdup(_("Incorrect password."));
 		break;
 	case 14:
--- a/pidgin/gtkconv.c	Fri Jul 27 10:44:24 2007 +0000
+++ b/pidgin/gtkconv.c	Fri Jul 27 10:48:24 2007 +0000
@@ -2365,6 +2365,8 @@
 			&(gtkconv->infopane_iter),
 			CONV_EMBLEM_COLUMN, emblem, -1);
 
+	/* XXX seanegan Why do I have to do this? */
+	gtk_widget_queue_draw(gtkconv->infopane);
 
 	if (status != NULL)
 		g_object_unref(status);