changeset 17917:5bb6dcba5e4f

propagate from branch 'im.pidgin.pidgin' (head bdd3cb040100fe925456b862d03cc6c5a61648ef) to branch 'org.maemo.garage.pidgin.smiley-install' (head 619530ecef0838dc85b081e0692ed145cc4b1bb0)
author Gabriel Schulhof <nix@go-nix.ca>
date Sat, 02 Jun 2007 07:33:10 +0000
parents 855a767cd9a9 (current diff) 79ecaab86f91 (diff)
children 76066eb86611
files
diffstat 5 files changed, 30 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/dbus-analyze-functions.py	Sat Jun 02 07:31:01 2007 +0000
+++ b/libpurple/dbus-analyze-functions.py	Sat Jun 02 07:33:10 2007 +0000
@@ -2,7 +2,6 @@
 import string
 import sys
 
-
 # types translated into "int"
 simpletypes = ["int", "gint", "guint", "gboolean"]
 
@@ -362,8 +361,12 @@
         self.ccode.append("\t%s;" % self.call) # just call the function
 
     def outputstring(self, type, name, const):
-        self.cdecls.append("\tconst char *%s;" % name)
-        self.ccode.append("\t%s = null_to_empty(%s);" % (name, self.call))
+        if const:
+            self.cdecls.append("\tconst char *%s;" % name)
+        else:
+            self.cdecls.append("\tchar *%s;" % name)
+        self.ccode.append("\tif ((%s = %s) == NULL)" % (name, self.call))
+        self.ccode.append("\t\t%s = \"\";" % (name))
         self.cparamsout.append(("STRING", name))
         self.addouttype("s", name)
         if not const:
--- a/libpurple/dbus-bindings.h	Sat Jun 02 07:31:01 2007 +0000
+++ b/libpurple/dbus-bindings.h	Sat Jun 02 07:33:10 2007 +0000
@@ -35,9 +35,9 @@
 extern "C" {
 #endif
 
-gint purple_dbus_pointer_to_id(gpointer node);
+gint purple_dbus_pointer_to_id(gconstpointer node);
 gpointer purple_dbus_id_to_pointer(gint id, PurpleDBusType *type);
-gint  purple_dbus_pointer_to_id_error(gpointer ptr, DBusError *error);
+gint  purple_dbus_pointer_to_id_error(gconstpointer ptr, DBusError *error);
 gpointer purple_dbus_id_to_pointer_error(gint id, PurpleDBusType *type,
 				       const char *typename, DBusError *error);
 
--- a/libpurple/dbus-server.c	Sat Jun 02 07:31:01 2007 +0000
+++ b/libpurple/dbus-server.c	Sat Jun 02 07:33:10 2007 +0000
@@ -108,7 +108,7 @@
 }
 
 gint
-purple_dbus_pointer_to_id(gpointer node)
+purple_dbus_pointer_to_id(gconstpointer node)
 {
 	gint id = GPOINTER_TO_INT(g_hash_table_lookup(map_node_id, node));
 	if ((id == 0) && (node != NULL))
@@ -138,7 +138,7 @@
 }
 
 gint
-purple_dbus_pointer_to_id_error(gpointer ptr, DBusError *error)
+purple_dbus_pointer_to_id_error(gconstpointer ptr, DBusError *error)
 {
 	gint id = purple_dbus_pointer_to_id(ptr);
 
--- a/libpurple/proxy.c	Sat Jun 02 07:31:01 2007 +0000
+++ b/libpurple/proxy.c	Sat Jun 02 07:33:10 2007 +0000
@@ -559,7 +559,7 @@
 	int len, headers_len, status = 0;
 	gboolean error;
 	PurpleProxyConnectData *connect_data = data;
-	guchar *p;
+	char *p;
 	gsize max_read;
 
 	if (connect_data->read_buffer == NULL)
@@ -569,7 +569,7 @@
 		connect_data->read_len = 0;
 	}
 
-	p = connect_data->read_buffer + connect_data->read_len;
+	p = (char *)connect_data->read_buffer + connect_data->read_len;
 	max_read = connect_data->read_buf_len - connect_data->read_len - 1;
 
 	len = read(connect_data->fd, p, max_read);
@@ -596,11 +596,11 @@
 	connect_data->read_len += len;
 	p[len] = '\0';
 
-	p = (guchar *)g_strstr_len((const gchar *)connect_data->read_buffer,
+	p = g_strstr_len((const gchar *)connect_data->read_buffer,
 			connect_data->read_len, "\r\n\r\n");
 	if (p != NULL) {
 		*p = '\0';
-		headers_len = (p - connect_data->read_buffer) + 4;
+		headers_len = (p - (char *)connect_data->read_buffer) + 4;
 	} else if(len == max_read)
 		headers_len = len;
 	else
@@ -610,34 +610,34 @@
 	if (!error)
 	{
 		int major;
-		p = connect_data->read_buffer + 5;
-		major = strtol((const char *)p, (char**)&p, 10);
+		p = (char *)connect_data->read_buffer + 5;
+		major = strtol(p, &p, 10);
 		error = (major == 0) || (*p != '.');
 		if(!error) {
 			int minor;
 			p++;
-			minor = strtol((const char *)p, (char **)&p, 10);
+			minor = strtol(p, &p, 10);
 			error = (*p != ' ');
 			if(!error) {
 				p++;
-				status = strtol((const char *)p, (char **)&p, 10);
+				status = strtol(p, &p, 10);
 				error = (*p != ' ');
 			}
 		}
 	}
 
 	/* Read the contents */
-	p = (guchar *)g_strrstr((const gchar *)connect_data->read_buffer, "Content-Length: ");
+	p = g_strrstr((const gchar *)connect_data->read_buffer, "Content-Length: ");
 	if (p != NULL)
 	{
 		gchar *tmp;
 		int len = 0;
 		char tmpc;
 		p += strlen("Content-Length: ");
-		tmp = strchr((const char *)p, '\r');
+		tmp = strchr(p, '\r');
 		if(tmp)
 			*tmp = '\0';
-		len = atoi((const char *)p);
+		len = atoi(p);
 		if(tmp)
 			*tmp = '\r';
 
--- a/libpurple/status.c	Sat Jun 02 07:31:01 2007 +0000
+++ b/libpurple/status.c	Sat Jun 02 07:33:10 2007 +0000
@@ -1275,6 +1275,7 @@
 purple_presence_set_idle(PurplePresence *presence, gboolean idle, time_t idle_time)
 {
 	gboolean old_idle;
+	time_t current_time;
 
 	g_return_if_fail(presence != NULL);
 
@@ -1285,14 +1286,14 @@
 	presence->idle      = idle;
 	presence->idle_time = (idle ? idle_time : 0);
 
+	current_time = time(NULL);
+
 	if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_BUDDY)
 	{
-		time_t current_time = time(NULL);
-
 		update_buddy_idle(purple_presence_get_buddy(presence), presence, current_time,
-		old_idle, idle);
+		                  old_idle, idle);
 	}
-	else if(purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_ACCOUNT)
+	else if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_ACCOUNT)
 	{
 		PurpleAccount *account;
 		PurpleConnection *gc;
@@ -1312,9 +1313,10 @@
 					msg = g_strdup_printf(_("+++ %s became idle"), purple_account_get_username(account));
 				else
 					msg = g_strdup_printf(_("+++ %s became unidle"), purple_account_get_username(account));
+
 				purple_log_write(log, PURPLE_MESSAGE_SYSTEM,
-							   purple_account_get_username(account),
-							   idle_time, msg);
+				                 purple_account_get_username(account),
+				                 (idle ? idle_time : current_time), msg);
 				g_free(msg);
 			}
 		}
@@ -1326,7 +1328,7 @@
 			prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
 		if (prpl_info && prpl_info->set_idle)
-			prpl_info->set_idle(gc, (idle ? (time(NULL) - idle_time) : 0));
+			prpl_info->set_idle(gc, (idle ? (current_time - idle_time) : 0));
 	}
 }