pidgin/pidgin

Fix message flags

2014-05-22, Tomasz Wasilczyk
cf0a11121049
Parents bb03db248026
Children bb8b3a86d99f
Fix message flags
--- a/libpurple/message.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/message.c Thu May 22 22:09:55 2014 +0200
@@ -62,6 +62,12 @@
purple_message_new(const gchar *who, const gchar *contents,
PurpleMessageFlags flags)
{
+ if (!(flags & (PURPLE_MESSAGE_SEND |
+ PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_SYSTEM)))
+ {
+ purple_debug_warning("message", "Invalid flags %#x", flags);
+ }
+
return g_object_new(PURPLE_TYPE_MESSAGE,
"who", who,
"contents", contents,
@@ -125,11 +131,7 @@
void
purple_message_set_time(PurpleMessage *msg, guint64 msgtime)
{
- PurpleMessagePrivate *priv = PURPLE_MESSAGE_GET_PRIVATE(msg);
-
- g_return_if_fail(priv != NULL);
-
- priv->msgtime = msgtime;
+ g_object_set(msg, "time", msgtime, NULL);
}
guint64
@@ -145,11 +147,7 @@
void
purple_message_set_flags(PurpleMessage *msg, PurpleMessageFlags flags)
{
- PurpleMessagePrivate *priv = PURPLE_MESSAGE_GET_PRIVATE(msg);
-
- g_return_if_fail(priv != NULL);
-
- priv->flags = flags;
+ g_object_set(msg, "flags", flags, NULL);
}
PurpleMessageFlags
--- a/libpurple/plugins/tcl/tcl_cmds.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/plugins/tcl/tcl_cmds.c Thu May 22 22:09:55 2014 +0200
@@ -1411,7 +1411,7 @@
who = Tcl_GetString(objv[2]);
text = Tcl_GetString(objv[3]);
- purple_serv_send_im(gc, purple_message_new(who, text, 0));
+ purple_serv_send_im(gc, purple_message_new(who, text, PURPLE_MESSAGE_SEND));
return TCL_OK;
}
--- a/libpurple/protocols/irc/cmds.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/irc/cmds.c Thu May 22 22:09:55 2014 +0200
@@ -583,9 +583,8 @@
g_free(tmp2);
} else
buf = g_strdup(_("No topic is set"));
- purple_conversation_write_message(PURPLE_CONVERSATION(chat),
- purple_message_new(target, buf,
- PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG));
+ purple_conversation_write_system_message(
+ PURPLE_CONVERSATION(chat), buf, PURPLE_MESSAGE_NO_LOG);
g_free(buf);
return 0;
--- a/libpurple/protocols/irc/msgs.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/irc/msgs.c Thu May 22 22:09:55 2014 +0200
@@ -1315,9 +1315,10 @@
purple_serv_got_im(gc, nick, msg, 0, time(NULL));
} else {
chat = purple_conversations_find_chat_with_account(irc_nick_skip_mode(irc, to), irc->account);
- if (chat)
- purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(chat), nick, 0, msg, time(NULL));
- else
+ if (chat) {
+ purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(chat),
+ nick, PURPLE_MESSAGE_RECV, msg, time(NULL));
+ } else
purple_debug_error("irc", "Got a %s on %s, which does not exist\n",
notice ? "NOTICE" : "PRIVMSG", to);
}
--- a/libpurple/protocols/jabber/jabber.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/jabber/jabber.c Thu May 22 22:09:55 2014 +0200
@@ -3072,7 +3072,7 @@
who = g_strdup_printf("%s@%s/%s", chat->room, chat->server, args[0]);
jabber_message_send_im(purple_conversation_get_connection(conv),
- purple_message_new(who, args[1], 0));
+ purple_message_new(who, args[1], PURPLE_MESSAGE_SEND));
g_free(who);
return PURPLE_CMD_RET_OK;
--- a/libpurple/protocols/jabber/message.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/jabber/message.c Thu May 22 22:09:55 2014 +0200
@@ -220,7 +220,7 @@
{
JabberID *jid = jabber_id_new(jm->from);
JabberChat *chat;
- PurpleMessageFlags messageFlags = 0;
+ PurpleMessageFlags messageFlags = PURPLE_MESSAGE_RECV;
if(!jid)
return;
--- a/libpurple/protocols/msn/msg.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/msn/msg.c Thu May 22 22:09:55 2014 +0200
@@ -702,8 +702,8 @@
purple_debug_misc("msn", "plain_msg: current_users(%d)\n",
swboard->current_users);
- purple_serv_got_chat_in(gc, swboard->chat_id, passport, 0, body_final,
- time(NULL));
+ purple_serv_got_chat_in(gc, swboard->chat_id, passport,
+ PURPLE_MESSAGE_RECV, body_final, time(NULL));
if (swboard->conv == NULL)
{
swboard->conv = PURPLE_CONVERSATION(purple_conversations_find_chat(gc, swboard->chat_id));
--- a/libpurple/protocols/msn/switchboard.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/msn/switchboard.c Thu May 22 22:09:55 2014 +0200
@@ -838,8 +838,8 @@
if (swboard->current_users > 1 ||
((swboard->conv != NULL) &&
PURPLE_IS_CHAT_CONVERSATION(swboard->conv)))
- purple_serv_got_chat_in(gc, swboard->chat_id, passport, 0, image_msg,
- time(NULL));
+ purple_serv_got_chat_in(gc, swboard->chat_id, passport,
+ PURPLE_MESSAGE_RECV, image_msg, time(NULL));
else
purple_serv_got_im(gc, passport, image_msg, 0, time(NULL));
--- a/libpurple/protocols/novell/novell.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/novell/novell.c Thu May 22 22:09:55 2014 +0200
@@ -1869,8 +1869,8 @@
}
purple_serv_got_chat_in(purple_account_get_connection(user->client_data),
- purple_chat_conversation_get_id(chat),
- name, 0, text, nm_event_get_gmt(event));
+ purple_chat_conversation_get_id(chat),
+ name, PURPLE_MESSAGE_RECV, text, nm_event_get_gmt(event));
}
}
}
--- a/libpurple/protocols/oscar/oscar.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/oscar/oscar.c Thu May 22 22:09:55 2014 +0200
@@ -2409,7 +2409,8 @@
va_end(ap);
utf8 = oscar_encoding_to_utf8(charset, msg, len);
- purple_serv_got_chat_in(gc, ccon->id, info->bn, 0, utf8, time(NULL));
+ purple_serv_got_chat_in(gc, ccon->id, info->bn,
+ PURPLE_MESSAGE_RECV, utf8, time(NULL));
g_free(utf8);
return 1;
--- a/libpurple/protocols/sametime/sametime.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/sametime/sametime.c Thu May 22 22:09:55 2014 +0200
@@ -2085,7 +2085,7 @@
gc = pd->gc;
esc = g_markup_escape_text(text, -1);
- purple_serv_got_chat_in(gc, CONF_TO_ID(conf), who->user_id, 0, esc, time(NULL));
+ purple_serv_got_chat_in(gc, CONF_TO_ID(conf), who->user_id, PURPLE_MESSAGE_RECV, esc, time(NULL));
g_free(esc);
}
@@ -3079,7 +3079,8 @@
gc = pd->gc;
esc = g_markup_escape_text(msg, -1);
- purple_serv_got_chat_in(gc, PLACE_TO_ID(place), who->user, 0, esc, time(NULL));
+ purple_serv_got_chat_in(gc, PLACE_TO_ID(place), who->user,
+ PURPLE_MESSAGE_RECV, esc, time(NULL));
g_free(esc);
}
--- a/libpurple/protocols/silc/ops.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/silc/ops.c Thu May 22 22:09:55 2014 +0200
@@ -311,7 +311,7 @@
tmp = g_markup_escape_text(msg, -1);
/* Send to Purple */
purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(chat),
- sender->nickname, 0, tmp, time(NULL));
+ sender->nickname, PURPLE_MESSAGE_RECV, tmp, time(NULL));
g_free(tmp);
g_free(msg);
return;
@@ -340,7 +340,7 @@
tmp = g_markup_escape_text(msg, -1);
/* Send to Purple */
purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(chat),
- sender->nickname, 0, tmp, time(NULL));
+ sender->nickname, PURPLE_MESSAGE_RECV, tmp, time(NULL));
g_free(salvaged);
g_free(tmp);
}
--- a/libpurple/protocols/yahoo/yahoochat.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/yahoo/yahoochat.c Thu May 22 22:09:55 2014 +0200
@@ -261,7 +261,8 @@
{
msg_tmp = yahoo_string_decode(gc, msg, utf8);
msg = yahoo_codes_to_html(msg_tmp);
- purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(c), who, 0, msg, time(NULL));
+ purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(c),
+ who, PURPLE_MESSAGE_RECV, msg, time(NULL));
g_free(msg_tmp);
g_free(msg);
}
@@ -393,7 +394,8 @@
msg2 = yahoo_string_decode(gc, msg, utf8);
msg = yahoo_codes_to_html(msg2);
- purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(c), who, 0, msg, time(NULL));
+ purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(c), who,
+ PURPLE_MESSAGE_RECV, msg, time(NULL));
g_free(msg);
g_free(msg2);
}
@@ -747,7 +749,8 @@
msg = tmp;
}
- purple_serv_got_chat_in(gc, YAHOO_CHAT_ID, who, 0, msg, time(NULL));
+ purple_serv_got_chat_in(gc, YAHOO_CHAT_ID, who,
+ PURPLE_MESSAGE_RECV, msg, time(NULL));
g_free(msg);
g_free(room);
}
--- a/libpurple/protocols/yahoo/ycht.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/yahoo/ycht.c Thu May 22 22:09:55 2014 +0200
@@ -165,7 +165,7 @@
what = tmp;
}
- purple_serv_got_chat_in(gc, YAHOO_CHAT_ID, who, 0, what, time(NULL));
+ purple_serv_got_chat_in(gc, YAHOO_CHAT_ID, who, PURPLE_MESSAGE_RECV, what, time(NULL));
g_free(what);
}
--- a/libpurple/protocols/zephyr/zephyr.c Thu May 22 21:43:22 2014 +0200
+++ b/libpurple/protocols/zephyr/zephyr.c Thu May 22 22:09:55 2014 +0200
@@ -918,7 +918,8 @@
#endif
purple_chat_conversation_add_user(gcc, stripped_sender, ipaddr, PURPLE_CHAT_USER_NONE, TRUE);
}
- purple_serv_got_chat_in(gc, zt2->id, send_inst_utf8, 0, buf3, time(NULL));
+ purple_serv_got_chat_in(gc, zt2->id, send_inst_utf8,
+ PURPLE_MESSAGE_RECV, buf3, time(NULL));
g_free(send_inst_utf8);
free_triple(zt1);