/pidgin/main: 6764e037a308: Switch sent-im-msg to PurpleMessage
Tomasz Wasilczyk
twasilczyk at pidgin.im
Thu May 22 13:37:35 EDT 2014
Changeset: 6764e037a308b32f3f1d39252022700f7d99bdd0
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-05-22 16:52 +0200
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/6764e037a308
Description:
Switch sent-im-msg to PurpleMessage
diffstat:
finch/gntsound.c | 6 +++---
libpurple/conversation.c | 8 +++-----
libpurple/conversations.c | 5 ++---
libpurple/idle.c | 3 +--
libpurple/plugins/signals-test.c | 6 ++++--
libpurple/protocols/irc/cmds.c | 3 +--
pidgin/gtksound.c | 7 ++++---
pidgin/plugins/cap/cap.c | 9 +++++----
pidgin/plugins/cap/cap.h | 2 +-
pidgin/plugins/notify.c | 5 +++--
pidgin/plugins/unity.c | 5 +++--
11 files changed, 30 insertions(+), 29 deletions(-)
diffs (195 lines):
diff --git a/finch/gntsound.c b/finch/gntsound.c
--- a/finch/gntsound.c
+++ b/finch/gntsound.c
@@ -204,11 +204,11 @@ im_msg_received_cb(PurpleAccount *accoun
}
static void
-im_msg_sent_cb(PurpleAccount *account, const char *receiver,
- const char *message, PurpleSoundEventID event)
+im_msg_sent_cb(PurpleAccount *account, PurpleMessage *msg,
+ PurpleSoundEventID event)
{
PurpleIMConversation *im = purple_conversations_find_im_with_account(
- receiver, account);
+ purple_message_get_who(msg), account);
play_conv_event(PURPLE_CONVERSATION(im), event);
}
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -144,13 +144,11 @@ common_send(PurpleConversation *conv, co
err = purple_serv_send_im(gc, msg);
- if ((err > 0) && (displayed != NULL))
+ if ((err > 0) && (displayed != NULL)) /* TODO: use msg! */
purple_conversation_write_message(conv, NULL, displayed, msgflags, time(NULL));
- /* TODO: use msg! */
- purple_signal_emit(purple_conversations_get_handle(), "sent-im-msg",
- account,
- purple_conversation_get_name(conv), sent);
+ purple_signal_emit(purple_conversations_get_handle(),
+ "sent-im-msg", account, msg);
}
}
else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
diff --git a/libpurple/conversations.c b/libpurple/conversations.c
--- a/libpurple/conversations.c
+++ b/libpurple/conversations.c
@@ -309,9 +309,8 @@ purple_conversations_init(void)
2, PURPLE_TYPE_ACCOUNT, PURPLE_TYPE_MESSAGE);
purple_signal_register(handle, "sent-im-msg",
- purple_marshal_VOID__POINTER_POINTER_POINTER,
- G_TYPE_NONE, 3, PURPLE_TYPE_ACCOUNT, G_TYPE_STRING,
- G_TYPE_STRING);
+ purple_marshal_VOID__POINTER_POINTER_POINTER, G_TYPE_NONE,
+ 2, PURPLE_TYPE_ACCOUNT, PURPLE_TYPE_MESSAGE);
purple_signal_register(handle, "receiving-im-msg",
purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
diff --git a/libpurple/idle.c b/libpurple/idle.c
--- a/libpurple/idle.c
+++ b/libpurple/idle.c
@@ -230,8 +230,7 @@ check_idleness_timer(void)
}
static void
-im_msg_sent_cb(PurpleAccount *account, const char *receiver,
- const char *message, void *data)
+im_msg_sent_cb(PurpleAccount *account, PurpleMessage *msg, void *data)
{
/* Check our idle time after an IM is sent */
check_idleness();
diff --git a/libpurple/plugins/signals-test.c b/libpurple/plugins/signals-test.c
--- a/libpurple/plugins/signals-test.c
+++ b/libpurple/plugins/signals-test.c
@@ -311,10 +311,12 @@ sending_im_msg_cb(PurpleAccount *account
}
static void
-sent_im_msg_cb(PurpleAccount *account, const char *recipient, const char *buffer, void *data)
+sent_im_msg_cb(PurpleAccount *account, PurpleMessage *msg, void *data)
{
purple_debug_misc("signals test", "sent-im-msg (%s, %s, %s)\n",
- purple_account_get_username(account), recipient, buffer);
+ purple_account_get_username(account),
+ purple_message_get_who(msg),
+ purple_message_get_contents(msg));
}
static gboolean
diff --git a/libpurple/protocols/irc/cmds.c b/libpurple/protocols/irc/cmds.c
--- a/libpurple/protocols/irc/cmds.c
+++ b/libpurple/protocols/irc/cmds.c
@@ -169,8 +169,7 @@ int irc_cmd_ctcp_action(struct irc_conn
/* XXX: we'd prefer to keep this in conversation.c */
if (PURPLE_IS_IM_CONVERSATION(convo)) {
purple_signal_emit(purple_conversations_get_handle(),
- "sent-im-msg", irc->account,
- purple_conversation_get_name(convo), msg);
+ "sent-im-msg", irc->account, pmsg);
} else {
purple_signal_emit(purple_conversations_get_handle(),
"sent-chat-msg", irc->account, msg,
diff --git a/pidgin/gtksound.c b/pidgin/gtksound.c
--- a/pidgin/gtksound.c
+++ b/pidgin/gtksound.c
@@ -150,11 +150,12 @@ im_msg_received_cb(PurpleAccount *accoun
}
static void
-im_msg_sent_cb(PurpleAccount *account, const char *receiver,
- const char *message, PurpleSoundEventID event)
+im_msg_sent_cb(PurpleAccount *account, PurpleMessage *msg,
+ PurpleSoundEventID event)
{
PurpleConversation *conv = PURPLE_CONVERSATION(
- purple_conversations_find_im_with_account(receiver, account));
+ purple_conversations_find_im_with_account(
+ purple_message_get_who(msg), account));
play_conv_event(conv, event);
}
diff --git a/pidgin/plugins/cap/cap.c b/pidgin/plugins/cap/cap.c
--- a/pidgin/plugins/cap/cap.c
+++ b/pidgin/plugins/cap/cap.c
@@ -339,22 +339,23 @@ static gboolean max_message_difference_c
/* Purple Signal Handlers */
/* sent-im-msg */
-static void sent_im_msg(PurpleAccount *account, const char *receiver, const char *message) {
+static void sent_im_msg(PurpleAccount *account, PurpleMessage *msg, gpointer _unused)
+{
PurpleBuddy *buddy;
guint interval, words;
CapStatistics *stats = NULL;
- buddy = purple_blist_find_buddy(account, receiver);
+ buddy = purple_blist_find_buddy(account, purple_message_get_who(msg));
if (buddy == NULL)
return;
interval = purple_prefs_get_int("/plugins/gtk/cap/max_msg_difference") * 60;
- words = word_count(message);
+ words = word_count(purple_message_get_contents(msg));
stats = get_stats_for(buddy);
- insert_word_count(purple_account_get_username(account), receiver, words);
+ insert_word_count(purple_account_get_username(account), purple_message_get_who(msg), words);
stats->last_message = time(NULL);
stats->last_message_status_id = purple_status_get_id(get_status_for(buddy));
if(stats->timeout_source_id != 0)
diff --git a/pidgin/plugins/cap/cap.h b/pidgin/plugins/cap/cap.h
--- a/pidgin/plugins/cap/cap.h
+++ b/pidgin/plugins/cap/cap.h
@@ -89,7 +89,7 @@ static void insert_cap_failure(CapStatis
static gboolean max_message_difference_cb(gpointer data);
/* Pidgin Signal Handlers */
/* sent-im-msg */
-static void sent_im_msg(PurpleAccount *account, const char *receiver, const char *message);
+static void sent_im_msg(PurpleAccount *account, PurpleMessage *msg, gpointer _unused);
/* received-im-msg */
static void received_im_msg(PurpleAccount *account, char *sender, char *message, PurpleConversation *conv, PurpleMessageFlags flags);
/* buddy-status-changed */
diff --git a/pidgin/plugins/notify.c b/pidgin/plugins/notify.c
--- a/pidgin/plugins/notify.c
+++ b/pidgin/plugins/notify.c
@@ -273,12 +273,13 @@ message_displayed_cb(PurpleAccount *acco
}
static void
-im_sent_im(PurpleAccount *account, const char *receiver, const char *message)
+im_sent_im(PurpleAccount *account, PurpleMessage *msg, gpointer _unused)
{
PurpleIMConversation *im = NULL;
if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) {
- im = purple_conversations_find_im_with_account(receiver, account);
+ im = purple_conversations_find_im_with_account(
+ purple_message_get_who(msg), account);
unnotify(PURPLE_CONVERSATION(im), TRUE);
}
}
diff --git a/pidgin/plugins/unity.c b/pidgin/plugins/unity.c
--- a/pidgin/plugins/unity.c
+++ b/pidgin/plugins/unity.c
@@ -197,10 +197,11 @@ message_displayed_cb(PurpleAccount *acco
}
static void
-im_sent_im(PurpleAccount *account, const char *receiver, const char *message)
+im_sent_im(PurpleAccount *account, PurpleMessage *msg, gpointer _unused)
{
PurpleIMConversation *im = NULL;
- im = purple_conversations_find_im_with_account(receiver, account);
+ im = purple_conversations_find_im_with_account(
+ purple_message_get_who(msg), account);
unalert(PURPLE_CONVERSATION(im));
}
More information about the Commits
mailing list