# HG changeset patch
# User andrew.victor@mxit.com
# Date 1319229569 0
# Node ID 75104780b1a31a46298de14ae021dad1ae078fd1
# Parent d72f2f13b60ff5a0d436609d6ca90c4ac6e49f4e
Hide struct _PurpleConvMessage.
diff -r d72f2f13b60f -r 75104780b1a3 ChangeLog.API
--- a/ChangeLog.API Fri Oct 21 14:36:18 2011 +0000
+++ b/ChangeLog.API Fri Oct 21 20:39:29 2011 +0000
@@ -16,6 +16,8 @@
* purple_connection_update_last_received
* purple_conversation_get_ui_data
* purple_conversation_set_ui_data
+ * purple_conversation_message_get_alias
+ * purple_conversation_message_get_conv
* purple_notify_searchresult_column_is_visible
* purple_notify_searchresult_column_set_visible
* purple_notify_user_info_prepend_pair_plaintext
@@ -216,6 +218,7 @@
* struct _PurpleConvChat
* struct _PurpleConvChatBuddy
* struct _PurpleConvIm
+ * struct _PurpleConvMessage
* struct _PurpleMenuAction
* struct _PurplePounce
* struct _PurpleProxyInfo
diff -r d72f2f13b60f -r 75104780b1a3 libpurple/conversation.c
--- a/libpurple/conversation.c Fri Oct 21 14:36:18 2011 +0000
+++ b/libpurple/conversation.c Fri Oct 21 20:39:29 2011 +0000
@@ -146,6 +146,19 @@
GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */
};
+/**
+ * Description of a conversation message
+ */
+struct _PurpleConvMessage
+{
+ char *who;
+ char *what;
+ PurpleMessageFlags flags;
+ time_t when;
+ PurpleConversation *conv;
+ char *alias;
+};
+
static GList *conversations = NULL;
static GList *ims = NULL;
@@ -2438,30 +2451,42 @@
return conv->message_history;
}
-const char *purple_conversation_message_get_sender(PurpleConvMessage *msg)
+const char *purple_conversation_message_get_sender(const PurpleConvMessage *msg)
{
g_return_val_if_fail(msg, NULL);
return msg->who;
}
-const char *purple_conversation_message_get_message(PurpleConvMessage *msg)
+const char *purple_conversation_message_get_message(const PurpleConvMessage *msg)
{
g_return_val_if_fail(msg, NULL);
return msg->what;
}
-PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg)
+PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConvMessage *msg)
{
g_return_val_if_fail(msg, 0);
return msg->flags;
}
-time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg)
+time_t purple_conversation_message_get_timestamp(const PurpleConvMessage *msg)
{
g_return_val_if_fail(msg, 0);
return msg->when;
}
+const char *purple_conversation_message_get_alias(const PurpleConvMessage *msg)
+{
+ g_return_val_if_fail(msg, NULL);
+ return msg->alias;
+}
+
+PurpleConversation *purple_conversation_message_get_conv(const PurpleConvMessage *msg)
+{
+ g_return_val_if_fail(msg, NULL);
+ return msg->conv;
+}
+
void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data)
{
g_return_if_fail(conv != NULL);
diff -r d72f2f13b60f -r 75104780b1a3 libpurple/conversation.h
--- a/libpurple/conversation.h Fri Oct 21 14:36:18 2011 +0000
+++ b/libpurple/conversation.h Fri Oct 21 20:39:29 2011 +0000
@@ -249,19 +249,6 @@
void (*_purple_reserved4)(void);
};
-/**
- * Description of a conversation message
- */
-struct _PurpleConvMessage
-{
- char *who;
- char *what;
- PurpleMessageFlags flags;
- time_t when;
- PurpleConversation *conv;
- char *alias;
-};
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -660,7 +647,7 @@
*
* @return The name of the sender of the message
*/
-const char *purple_conversation_message_get_sender(PurpleConvMessage *msg);
+const char *purple_conversation_message_get_sender(const PurpleConvMessage *msg);
/**
* Get the message from a PurpleConvMessage
@@ -669,7 +656,7 @@
*
* @return The name of the sender of the message
*/
-const char *purple_conversation_message_get_message(PurpleConvMessage *msg);
+const char *purple_conversation_message_get_message(const PurpleConvMessage *msg);
/**
* Get the message-flags of a PurpleConvMessage
@@ -678,7 +665,7 @@
*
* @return The message flags
*/
-PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg);
+PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConvMessage *msg);
/**
* Get the timestamp of a PurpleConvMessage
@@ -687,7 +674,25 @@
*
* @return The timestamp of the message
*/
-time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg);
+time_t purple_conversation_message_get_timestamp(const PurpleConvMessage *msg);
+
+/**
+ * Get the alias from a PurpleConvMessage
+ *
+ * @param msg A PurpleConvMessage
+ *
+ * @return The alias of the sender of the message
+ */
+const char *purple_conversation_message_get_alias(const PurpleConvMessage *msg);
+
+/**
+ * Get the conversation associated with the PurpleConvMessage
+ *
+ * @param msg A PurpleConvMessage
+ *
+ * @return The conversation
+ */
+PurpleConversation *purple_conversation_message_get_conv(const PurpleConvMessage *msg);
/**
* Set the UI data associated with this conversation.
diff -r d72f2f13b60f -r 75104780b1a3 pidgin/gtkconv.c
--- a/pidgin/gtkconv.c Fri Oct 21 14:36:18 2011 +0000
+++ b/pidgin/gtkconv.c Fri Oct 21 20:39:29 2011 +0000
@@ -8081,7 +8081,7 @@
message_compare(gconstpointer p1, gconstpointer p2)
{
const PurpleConvMessage *m1 = p1, *m2 = p2;
- return (m1->when > m2->when);
+ return (purple_conversation_message_get_timestamp(m1) > purple_conversation_message_get_timestamp(m2));
}
/* Adds some message history to the gtkconv. This happens in a idle-callback. */
@@ -8097,11 +8097,17 @@
gtkconv->attach.timer = 0;
while (gtkconv->attach.current && count < 100) { /* XXX: 100 is a random value here */
PurpleConvMessage *msg = gtkconv->attach.current->data;
- if (!im && when && when < msg->when) {
+ if (!im && when && when < purple_conversation_message_get_timestamp(msg)) {
gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "