pidgin/pidgin

Switch sent-im-msg to PurpleMessage

2014-05-22, Tomasz Wasilczyk
6764e037a308
Parents 637a1a87c4d3
Children 247d94c903c3
Switch sent-im-msg to PurpleMessage
--- a/finch/gntsound.c Thu May 22 16:42:04 2014 +0200
+++ b/finch/gntsound.c Thu May 22 16:52:23 2014 +0200
@@ -204,11 +204,11 @@
}
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);
}
--- a/libpurple/conversation.c Thu May 22 16:42:04 2014 +0200
+++ b/libpurple/conversation.c Thu May 22 16:52:23 2014 +0200
@@ -144,13 +144,11 @@
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)) {
--- a/libpurple/conversations.c Thu May 22 16:42:04 2014 +0200
+++ b/libpurple/conversations.c Thu May 22 16:52:23 2014 +0200
@@ -309,9 +309,8 @@
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,
--- a/libpurple/idle.c Thu May 22 16:42:04 2014 +0200
+++ b/libpurple/idle.c Thu May 22 16:52:23 2014 +0200
@@ -230,8 +230,7 @@
}
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();
--- a/libpurple/plugins/signals-test.c Thu May 22 16:42:04 2014 +0200
+++ b/libpurple/plugins/signals-test.c Thu May 22 16:52:23 2014 +0200
@@ -311,10 +311,12 @@
}
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
--- a/libpurple/protocols/irc/cmds.c Thu May 22 16:42:04 2014 +0200
+++ b/libpurple/protocols/irc/cmds.c Thu May 22 16:52:23 2014 +0200
@@ -169,8 +169,7 @@
/* 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,
--- a/pidgin/gtksound.c Thu May 22 16:42:04 2014 +0200
+++ b/pidgin/gtksound.c Thu May 22 16:52:23 2014 +0200
@@ -150,11 +150,12 @@
}
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);
}
--- a/pidgin/plugins/cap/cap.c Thu May 22 16:42:04 2014 +0200
+++ b/pidgin/plugins/cap/cap.c Thu May 22 16:52:23 2014 +0200
@@ -339,22 +339,23 @@
/* 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)
--- a/pidgin/plugins/cap/cap.h Thu May 22 16:42:04 2014 +0200
+++ b/pidgin/plugins/cap/cap.h Thu May 22 16:52:23 2014 +0200
@@ -89,7 +89,7 @@
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 */
--- a/pidgin/plugins/notify.c Thu May 22 16:42:04 2014 +0200
+++ b/pidgin/plugins/notify.c Thu May 22 16:52:23 2014 +0200
@@ -273,12 +273,13 @@
}
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);
}
}
--- a/pidgin/plugins/unity.c Thu May 22 16:42:04 2014 +0200
+++ b/pidgin/plugins/unity.c Thu May 22 16:52:23 2014 +0200
@@ -197,10 +197,11 @@
}
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));
}