changeset 19709:5d44126c0205

merge of '0485ab28f09f39d5e0b47621901f1f0ba0c26c5e' and '496506f552dcc01dcc38820f472dc9d27a82a997'
author Richard Laager <rlaager@wiktel.com>
date Mon, 10 Sep 2007 20:09:34 +0000
parents 6d04b27c7f53 (diff) d3d9e3978d82 (current diff)
children 93d10000432e
files
diffstat 13 files changed, 62 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Mon Sep 10 20:07:45 2007 +0000
+++ b/ChangeLog.API	Mon Sep 10 20:09:34 2007 +0000
@@ -9,6 +9,15 @@
 		* serv_send_attention(), serv_got_attention(), as well as send_attention 
 		  and attention_types in PurplePluginProtocolInfo. This new API is used
 		  for zapping in MySpaceIM, buzzing in Yahoo, and nudging in MSN.
+		* PurpleConvMessage structure to represent a message in a
+		  conversation. purple_conversation_message_get_sender,
+		  purple_conversation_message_get_message,
+		  purple_conversation_message_get_flags and
+		  purple_conversation_message_get_timestamp to get information about a
+		  PurpleConvMessage.
+		* purple_conversation_get_message_history() to retrieve a list of
+		  PurpleConvMessage's in a conversation, and
+		  purple_conversation_clear_message_history to clear the history.
 
 		Changed:
 		* purple_prefs_load is now called within purple_prefs_init.
--- a/libpurple/conversation.c	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/conversation.c	Mon Sep 10 20:09:34 2007 +0000
@@ -39,7 +39,6 @@
 static GList *ims = NULL;
 static GList *chats = NULL;
 static PurpleConversationUiOps *default_ops = NULL;
-static GHashTable *histories = NULL;
 
 void
 purple_conversations_set_ui_ops(PurpleConversationUiOps *ops)
@@ -209,7 +208,6 @@
 add_message_to_history(PurpleConversation *conv, const char *who, const char *message,
 		PurpleMessageFlags flags, time_t when)
 {
-	GList *list;
 	PurpleConvMessage *msg;
 
 	if (flags & PURPLE_MESSAGE_SEND) {
@@ -228,9 +226,7 @@
 	msg->what = g_strdup(message);
 	msg->when = when;
 
-	list = g_hash_table_lookup(histories, conv);
-	list = g_list_prepend(list, msg);
-	g_hash_table_insert(histories, conv, list);
+	conv->message_history = g_list_prepend(conv->message_history, msg);
 }
 
 static void
@@ -2068,14 +2064,14 @@
 
 void purple_conversation_clear_message_history(PurpleConversation *conv)
 {
-	GList *list = g_hash_table_lookup(histories, conv);
+	GList *list = conv->message_history;
 	message_history_free(list);
-	g_hash_table_remove(histories, conv);
+	conv->message_history = NULL;
 }
 
 GList *purple_conversation_get_message_history(PurpleConversation *conv)
 {
-	return g_hash_table_lookup(histories, conv);
+	return conv->message_history;
 }
 
 const char *purple_conversation_message_get_sender(PurpleConvMessage *msg)
@@ -2382,9 +2378,6 @@
 			     purple_value_new(PURPLE_TYPE_SUBTYPE,
 					    PURPLE_SUBTYPE_CONVERSATION),
 			     purple_value_new(PURPLE_TYPE_BOXED, "GList **"));
-
-	/* Initialize the history */
-	histories = g_hash_table_new(g_direct_hash, g_direct_equal);
 }
 
 void
@@ -2393,6 +2386,5 @@
 	while (conversations)
 		purple_conversation_destroy((PurpleConversation*)conversations->data);
 	purple_signals_unregister_by_instance(purple_conversations_get_handle());
-	g_hash_table_destroy(histories);
-	histories = NULL;
 }
+
--- a/libpurple/conversation.h	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/conversation.h	Mon Sep 10 20:09:34 2007 +0000
@@ -327,7 +327,7 @@
 	GHashTable *data;                        /**< Plugin-specific data.   */
 
 	PurpleConnectionFlags features; /**< The supported features */
-
+	GList *message_history;         /**< Message history, as a GList of PurpleConvMessage's */
 };
 
 #ifdef __cplusplus
--- a/libpurple/protocols/jabber/Makefile.mingw	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/protocols/jabber/Makefile.mingw	Mon Sep 10 20:09:34 2007 +0000
@@ -42,8 +42,11 @@
 ##
 ##  SOURCES, OBJECTS
 ##
-C_SRC =			auth.c \
+C_SRC =	\
+			adhoccommands.c \
+			auth.c \
 			buddy.c \
+			caps.c \
 			chat.c \
 			disco.c \
 			google.c \
@@ -53,10 +56,14 @@
 			message.c \
 			oob.c \
 			parser.c \
+			pep.c \
 			ping.c \
 			presence.c \
 			roster.c \
 			si.c \
+			usermood.c \
+			usernick.c \
+			usertune.c \
 			xdata.c \
 			win32/posix.uname.c
 
--- a/libpurple/protocols/jabber/adhoccommands.c	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/protocols/jabber/adhoccommands.c	Mon Sep 10 20:09:34 2007 +0000
@@ -19,6 +19,8 @@
  *
  */
 
+#include "internal.h"
+
 #include "adhoccommands.h"
 #include <assert.h>
 #include <string.h>
@@ -264,7 +266,7 @@
 	jabber_iq_send(iq);
 }
 
-void jabber_adhoc_server_execute(PurplePluginAction *action) {
+static void jabber_adhoc_server_execute(PurplePluginAction *action) {
 	JabberAdHocCommands *cmd = action->user_data;
 	if(cmd) {
 		PurpleConnection *gc = (PurpleConnection *) action->context;
--- a/libpurple/protocols/jabber/caps.c	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/protocols/jabber/caps.c	Mon Sep 10 20:09:34 2007 +0000
@@ -19,6 +19,8 @@
  *
  */
 
+#include "internal.h"
+
 #include "caps.h"
 #include <string.h>
 #include "internal.h"
@@ -464,19 +466,22 @@
 	JabberCapsValue *client;
 	JabberCapsKey *key = g_new0(JabberCapsKey, 1);
 	char *originalext = g_strdup(ext);
-	char *oneext, *ctx;
 	jabber_caps_cbplususerdata *userdata = g_new0(jabber_caps_cbplususerdata, 1);
 	userdata->cb = cb;
 	userdata->user_data = user_data;
 	userdata->who = g_strdup(who);
 	userdata->node = g_strdup(node);
 	userdata->ver = g_strdup(ver);
-	
-	if(originalext)
-		for(oneext = strtok_r(originalext, " ", &ctx); oneext; oneext = strtok_r(NULL, " ", &ctx)) {
-			userdata->ext = g_list_append(userdata->ext,g_strdup(oneext));
+
+	if(originalext) {
+		gchar **tmp;
+		gchar **splat = g_strsplit(originalext, " ", 0);
+		for(tmp = splat; *tmp; tmp++) {
+			userdata->ext = g_list_append(userdata->ext, tmp);
 			++userdata->extOutstanding;
 		}
+		g_free(splat);
+	}
 	g_free(originalext);
 	
 	key->node = g_strdup(node);
--- a/libpurple/protocols/jabber/jabber.h	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.h	Mon Sep 10 20:09:34 2007 +0000
@@ -34,7 +34,7 @@
 	JABBER_CAP_IQ_SEARCH      = 1 << 7,
 	JABBER_CAP_IQ_REGISTER    = 1 << 8,
 
-	/* Google Talk extensions: 
+	/* Google Talk extensions:
 	 * http://code.google.com/apis/talk/jep_extensions/extensions.html
 	 */
 	JABBER_CAP_GMAIL_NOTIFY   = 1 << 9,
--- a/libpurple/protocols/jabber/pep.c	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/protocols/jabber/pep.c	Mon Sep 10 20:09:34 2007 +0000
@@ -19,6 +19,8 @@
  *
  */
 
+#include "internal.h"
+
 #include "pep.h"
 #include "iq.h"
 #include <string.h>
@@ -107,21 +109,22 @@
 
 void jabber_pep_publish(JabberStream *js, xmlnode *publish) {
 	JabberIq *iq;
-	
+	xmlnode *pubsub;
+
 	if(js->pep != TRUE) {
 		/* ignore when there's no PEP support on the server */
 		xmlnode_free(publish);
 		return;
 	}
-	
+
 	iq = jabber_iq_new(js, JABBER_IQ_SET);
-	
-	xmlnode *pubsub = xmlnode_new("pubsub");
+
+	pubsub = xmlnode_new("pubsub");
 	xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub");
-	
+
 	xmlnode_insert_child(pubsub, publish);
-	
+
 	xmlnode_insert_child(iq->node, pubsub);
-	
+
 	jabber_iq_send(iq);
 }
--- a/libpurple/protocols/jabber/presence.c	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/protocols/jabber/presence.c	Mon Sep 10 20:09:34 2007 +0000
@@ -209,9 +209,9 @@
 		js->old_length = length;
 		js->old_track = g_strdup(track);
 	}
-	
-#undef CHANGED(a,b)
-		
+
+#undef CHANGED
+
 	jabber_presence_fake_to_self(js, status);
 }
 
--- a/libpurple/protocols/jabber/usermood.c	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/protocols/jabber/usermood.c	Mon Sep 10 20:09:34 2007 +0000
@@ -19,6 +19,8 @@
  *
  */
 
+#include "internal.h"
+
 #include "usermood.h"
 #include "pep.h"
 #include <assert.h>
@@ -125,18 +127,17 @@
 		}
 	}
 	if (newmood != NULL) {
+		const char *status_id;
 		JabberBuddyResource *resource = jabber_buddy_find_resource(buddy, NULL);
 		if(!resource) { /* huh? */
-			if (moodtext)
-				g_free(moodtext);
+			g_free(moodtext);
 			return;
 		}
-		const char *status_id = jabber_buddy_state_get_status_id(resource->state);
-		
+		status_id = jabber_buddy_state_get_status_id(resource->state);
+
 		purple_prpl_got_user_status(js->gc->account, from, status_id, "mood", _(newmood), "moodtext", moodtext?moodtext:"", NULL);
 	}
-	if (moodtext)
-		g_free(moodtext);
+	g_free(moodtext);
 }
 
 void jabber_mood_init(void) {
--- a/libpurple/protocols/jabber/usernick.c	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/protocols/jabber/usernick.c	Mon Sep 10 20:09:34 2007 +0000
@@ -19,6 +19,8 @@
  *
  */
 
+#include "internal.h"
+
 #include "usernick.h"
 #include "pep.h"
 #include <assert.h>
--- a/libpurple/protocols/jabber/usertune.c	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/protocols/jabber/usertune.c	Mon Sep 10 20:09:34 2007 +0000
@@ -19,6 +19,8 @@
  *
  */
 
+#include "internal.h"
+
 #include "usertune.h"
 #include "pep.h"
 #include <assert.h>
--- a/libpurple/protocols/jabber/xdata.c	Mon Sep 10 20:07:45 2007 +0000
+++ b/libpurple/protocols/jabber/xdata.c	Mon Sep 10 20:09:34 2007 +0000
@@ -172,8 +172,8 @@
 		data->values = g_slist_delete_link(data->values, data->values);
 	}
 	if (data->actions) {
+		GList *action;
 		hasActions = TRUE;
-		GList *action;
 		for(action = data->actions; action; action = g_list_next(action)) {
 			g_free(action->data);
 		}