gobjectification.conversation: 366b859d: Oscar compiles.
sadrul at pidgin.im
sadrul at pidgin.im
Sat Jul 24 23:10:42 EDT 2010
----------------------------------------------------------------------
Revision: 366b859dc4699232c6b986e97239425529feceac
Parent: d2c95980437273c94f72f8c878d95cde787db871
Author: sadrul at pidgin.im
Date: 07/24/10 22:05:34
Branch: im.pidgin.gobjectification.conversation
URL: http://d.pidgin.im/viewmtn/revision/info/366b859dc4699232c6b986e97239425529feceac
Changelog:
Oscar compiles.
Changes against parent d2c95980437273c94f72f8c878d95cde787db871
patched libpurple/protocols/oscar/family_icbm.c
patched libpurple/protocols/oscar/odc.c
patched libpurple/protocols/oscar/oscar.c
patched libpurple/protocols/oscar/peer.c
-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c ee3c932e814101d71079bf291e8991149871d2b2
+++ libpurple/protocols/oscar/oscar.c 4adfcc511b4ee46eb9510a5b9d6bf87fbd2d3132
@@ -1112,7 +1112,7 @@ oscar_chat_kill(PurpleConnection *gc, st
OscarData *od = (OscarData *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
/* Notify the conversation window that we've left the chat */
- serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(cc->conv)));
+ serv_got_chat_left(gc, purple_muc_get_id(PURPLE_MUC(cc->conv)));
/* Destroy the chat_connection */
od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
@@ -2377,6 +2377,7 @@ static int incomingim_chan1(OscarData *o
aim_mpmsg_section_t *curpart;
const char *start, *end;
GData *attribs;
+ PurpleMessage *msg;
purple_debug_misc("oscar", "Received IM from %s with %d parts\n",
userinfo->bn, args->mpmsg.numparts);
@@ -2518,8 +2519,10 @@ static int incomingim_chan1(OscarData *o
tmp = tmp2;
}
- serv_got_im(gc, userinfo->bn, tmp, flags,
+ msg = purple_message_new(userinfo->bn, NULL, tmp, flags,
(args->icbmflags & AIM_IMFLAGS_OFFLINE) ? args->timestamp : time(NULL));
+ if (!purple_im_new_with_receive(account, msg))
+ purple_message_free(msg);
g_free(tmp);
return 1;
@@ -2665,7 +2668,10 @@ incomingim_chan2(OscarData *od, FlapConn
rtfmsg = g_strdup(args->info.rtfmsg.rtfmsg);
}
if (rtfmsg) {
- serv_got_im(gc, userinfo->bn, rtfmsg, flags, time(NULL));
+ PurpleMessage *msg = purple_message_new(userinfo->bn, NULL, rtfmsg, flags,
+ time(NULL));
+ if (!purple_im_new_with_receive(account, msg))
+ purple_message_free(msg);
g_free(rtfmsg);
}
}
@@ -2854,6 +2860,7 @@ incomingim_chan4(OscarData *od, FlapConn
if (i >= 1) {
gchar *uin = g_strdup_printf("%u", args->uin);
gchar *tmp;
+ PurpleMessage *message;
/* If the message came from an ICQ user then escape any HTML */
tmp = g_markup_escape_text(msg2[0], -1);
@@ -2872,10 +2879,14 @@ incomingim_chan4(OscarData *od, FlapConn
t -= timezone;
# endif
#endif
- serv_got_im(gc, uin, tmp, 0, t);
} else { /* This is a message from MacICQ/Miranda */
- serv_got_im(gc, uin, tmp, 0, time(NULL));
+ t = time(NULL);
}
+
+ message = purple_message_new(uin, NULL, tmp, 0, t);
+ if (!purple_im_new_with_receive(account, message))
+ purple_message_free(message);
+
g_free(uin);
g_free(tmp);
}
@@ -2888,7 +2899,9 @@ incomingim_chan4(OscarData *od, FlapConn
gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>",
msg2[1],
(msg2[0] && msg2[0][0]) ? msg2[0] : msg2[1]);
- serv_got_im(gc, uin, message, 0, time(NULL));
+ PurpleMessage *msg = purple_message_new(uin, NULL, message, 0, time(NULL));
+ if (!purple_im_new_with_receive(account, msg))
+ purple_message_free(msg);
g_free(uin);
g_free(message);
}
@@ -3052,8 +3065,11 @@ incomingim_chan4(OscarData *od, FlapConn
if (xmltmp != NULL)
message = xmlnode_get_data(xmltmp);
- if ((uin != NULL) && (message != NULL))
- serv_got_im(gc, uin, message, 0, time(NULL));
+ if ((uin != NULL) && (message != NULL)) {
+ PurpleMessage *msg = purple_message_new(uin, NULL, message, 0, time(NULL));
+ if (!purple_im_new_with_receive(account, msg))
+ purple_message_free(msg);
+ }
g_free(uin);
g_free(message);
@@ -3190,7 +3206,7 @@ static int purple_parse_misses(OscarData
break;
}
- if (!purple_conv_present_error(userinfo->bn, account, buf))
+ if (!purple_conversations_present_error(userinfo->bn, account, buf))
purple_notify_error(od->gc, NULL, buf, NULL);
g_free(buf);
@@ -3390,7 +3406,7 @@ static int purple_parse_locerr(OscarData
purple_notify_user_info_add_pair(user_info, NULL, buf);
purple_notify_userinfo(od->gc, destn, user_info, NULL, NULL);
purple_notify_user_info_destroy(user_info);
- purple_conv_present_error(destn, purple_connection_get_account(od->gc), buf);
+ purple_conversations_present_error(destn, purple_connection_get_account(od->gc), buf);
g_free(buf);
return 1;
@@ -3577,7 +3593,7 @@ static int purple_conv_chat_join(OscarDa
return 1;
for (i = 0; i < count; i++)
- purple_conv_chat_add_user(PURPLE_CONV_CHAT(c->conv), info[i].bn, NULL, PURPLE_CBFLAGS_NONE, TRUE);
+ purple_muc_add_user(PURPLE_MUC(c->conv), info[i].bn, NULL, PURPLE_CBFLAGS_NONE, TRUE);
return 1;
}
@@ -3600,7 +3616,7 @@ static int purple_conv_chat_leave(OscarD
return 1;
for (i = 0; i < count; i++)
- purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c->conv), info[i].bn, NULL);
+ purple_muc_remove_user(PURPLE_MUC(c->conv), info[i].bn, NULL);
return 1;
}
@@ -3871,7 +3887,7 @@ static int purple_connerr(OscarData *od,
cc = find_oscar_chat_by_conn(gc, conn);
if (cc != NULL)
{
- conv = purple_find_chat(gc, cc->id);
+ conv = purple_conversations_find_muc(gc, cc->id);
if (conv != NULL)
{
@@ -3883,7 +3899,7 @@ static int purple_connerr(OscarData *od,
gchar *buf;
buf = g_strdup_printf(_("You have been disconnected from chat "
"room %s."), cc->name);
- purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_ERROR, time(NULL));
+ purple_conversation_write_message(conv, buf, PURPLE_MESSAGE_ERROR);
g_free(buf);
}
oscar_chat_kill(gc, cc);
@@ -4576,13 +4592,12 @@ oscar_send_im(PurpleConnection *gc, cons
PurpleStoredImage *img;
PurpleBuddy *buddy;
- conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account);
+ conv = PURPLE_CONVERSATION(purple_im_new(account, name));
if (strstr(tmp1, "<IMG "))
- purple_conversation_write(conv, "",
- _("Your IM Image was not sent. "
- "You must be Direct Connected to send IM Images."),
- PURPLE_MESSAGE_ERROR, time(NULL));
+ purple_conversation_write_message(conv, _("Your IM Image was not sent. "
+ "You must be Direct Connected to send IM Images."),
+ PURPLE_MESSAGE_ERROR);
buddy = purple_find_buddy(account, name);
@@ -4999,7 +5014,7 @@ oscar_add_buddy(PurpleConnection *gc, Pu
if (!oscar_util_valid_name(bname)) {
gchar *buf;
buf = g_strdup_printf(_("Unable to add the buddy %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), bname);
- if (!purple_conv_present_error(bname, account, buf))
+ if (!purple_conversations_present_error(bname, account, buf))
purple_notify_error(gc, NULL, _("Unable to Add"), buf);
g_free(buf);
@@ -5493,7 +5508,7 @@ static int purple_ssi_parseack(OscarData
case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */
gchar *buf;
buf = g_strdup_printf(_("Unable to add the buddy %s because you have too many buddies in your buddy list. Please remove one and try again."), (retval->name ? retval->name : _("(no name)")));
- if ((retval->name != NULL) && !purple_conv_present_error(retval->name, purple_connection_get_account(gc), buf))
+ if ((retval->name != NULL) && !purple_conversations_present_error(retval->name, purple_connection_get_account(gc), buf))
purple_notify_error(gc, NULL, _("Unable to Add"), buf);
g_free(buf);
}
@@ -5508,7 +5523,7 @@ static int purple_ssi_parseack(OscarData
purple_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack);
buf = g_strdup_printf(_("Unable to add the buddy %s for an unknown reason."),
(retval->name ? retval->name : _("(no name)")));
- if ((retval->name != NULL) && !purple_conv_present_error(retval->name, purple_connection_get_account(gc), buf))
+ if ((retval->name != NULL) && !purple_conversations_present_error(retval->name, purple_connection_get_account(gc), buf))
purple_notify_error(gc, NULL, _("Unable to Add"), buf);
g_free(buf);
} break;
@@ -5839,14 +5854,14 @@ oscar_chat_leave(PurpleConnection *gc, i
PurpleConversation *conv;
struct chat_connection *cc;
- conv = purple_find_chat(gc, id);
+ conv = purple_conversations_find_muc(gc, id);
g_return_if_fail(conv != NULL);
purple_debug_info("oscar", "Leaving chat room %s\n",
purple_conversation_get_name(conv));
- cc = find_oscar_chat(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)));
+ cc = find_oscar_chat(gc, purple_muc_get_id(PURPLE_MUC(conv)));
oscar_chat_kill(gc, cc);
}
@@ -5860,7 +5875,7 @@ int oscar_send_chat(PurpleConnection *gc
char *charsetstr = NULL;
int len;
- if (!(conv = purple_find_chat(gc, id)))
+ if (!(conv = purple_conversations_find_muc(gc, id)))
return -EINVAL;
if (!(c = find_oscar_chat_by_conv(gc, conv)))
@@ -5869,10 +5884,9 @@ int oscar_send_chat(PurpleConnection *gc
buf = purple_strdup_withhtml(message);
if (strstr(buf, "<IMG "))
- purple_conversation_write(conv, "",
- _("Your IM Image was not sent. "
- "You cannot send IM Images in AIM chats."),
- PURPLE_MESSAGE_ERROR, time(NULL));
+ purple_conversation_write_message(conv,
+ _("Your IM Image was not sent. You cannot send IM Images in AIM chats."),
+ PURPLE_MESSAGE_ERROR);
purple_plugin_oscar_convert_to_best_encoding(gc, NULL, buf, &buf2, &len, &charset, &charsubset);
/*
@@ -6434,9 +6448,8 @@ oscar_close_directim(gpointer object, gp
/* OSCAR_DISCONNECT_LOCAL_CLOSED doesn't write anything to the convo
* window. Let the user know that we canceled the Direct IM. */
- conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name);
- purple_conversation_write(conv, NULL, _("You closed the connection."),
- PURPLE_MESSAGE_SYSTEM, time(NULL));
+ conv = PURPLE_CONVERSATION(purple_im_new(account, name));
+ purple_conversation_write_message(conv, _("You closed the connection."), PURPLE_MESSAGE_SYSTEM);
}
}
@@ -7122,16 +7135,15 @@ static gboolean oscar_uri_handler(const
if (bname) {
char *message = g_hash_table_lookup(params, "message");
- PurpleConversation *conv = purple_find_conversation_with_account(
- PURPLE_CONV_TYPE_IM, bname, acct);
+ PurpleConversation *conv = purple_conversations_find(PURPLE_TYPE_IM, acct, bname);
if (conv == NULL)
- conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, bname);
+ conv = PURPLE_CONVERSATION(purple_im_new(acct, bname));
purple_conversation_present(conv);
if (message) {
/* Spaces are encoded as '+' */
g_strdelimit(message, "+", ' ');
- purple_conv_send_confirm(conv, message);
+ purple_conversation_send_confirm(conv, message);
}
}
/*else
============================================================
--- libpurple/protocols/oscar/family_icbm.c f92d100bbeaeb6bf8382c5f6fb2ceda23d514cd8
+++ libpurple/protocols/oscar/family_icbm.c 25bff900d45e895f0c6e13cd669f61d4fc87a9c8
@@ -236,7 +236,7 @@ error(OscarData *od, FlapConnection *con
else
buf = g_strdup_printf(_("Unable to send message: %s"), reason_str);
- if (!purple_conv_present_error(bn, purple_connection_get_account(gc), buf)) {
+ if (!purple_conversations_present_error(bn, purple_connection_get_account(gc), buf)) {
g_free(buf);
if (errcode != 0 && errcode < errcodereasonlen)
buf = g_strdup_printf(_("Unable to send message to %s: %s (%s)"),
============================================================
--- libpurple/protocols/oscar/peer.c 3445f821e51360f72e1abf3cc6a0ab48a0d1c3f2
+++ libpurple/protocols/oscar/peer.c e5f26d71fedf86fe0ed0b5aadb67dc75046f891b
@@ -702,10 +702,10 @@ peer_connection_establish_listener_cb(in
listener_port, ++conn->lastrequestnumber);
/* Print a message to a local conversation window */
- conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn);
+ conv = PURPLE_CONVERSATION(purple_im_new(account, conn->bn));
tmp = g_strdup_printf(_("Asking %s to connect to us at %s:%hu for "
"Direct IM."), conn->bn, listener_ip, listener_port);
- purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_message(conv, tmp, PURPLE_MESSAGE_SYSTEM);
g_free(tmp);
}
else if (conn->type == OSCAR_CAPABILITY_SENDFILE)
@@ -799,9 +799,8 @@ peer_connection_trynext(PeerConnection *
PurpleConversation *conv;
tmp = g_strdup_printf(_("Attempting to connect to %s:%hu."),
conn->verifiedip, conn->port);
- conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn);
- purple_conversation_write(conv, NULL, tmp,
- PURPLE_MESSAGE_SYSTEM, time(NULL));
+ conv = PURPLE_CONVERSATION(purple_im_new(account, conn->bn));
+ purple_conversation_write_message(conv, tmp, PURPLE_MESSAGE_SYSTEM);
g_free(tmp);
}
@@ -872,9 +871,8 @@ peer_connection_trynext(PeerConnection *
gchar *tmp;
PurpleConversation *conv;
tmp = g_strdup(_("Attempting to connect via proxy server."));
- conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn);
- purple_conversation_write(conv, NULL, tmp,
- PURPLE_MESSAGE_SYSTEM, time(NULL));
+ conv = PURPLE_CONVERSATION(purple_im_new(account, conn->bn));
+ purple_conversation_write_message(conv, tmp, PURPLE_MESSAGE_SYSTEM);
g_free(tmp);
}
@@ -914,8 +912,7 @@ peer_connection_propose(OscarData *od, g
purple_debug_info("oscar", "Already have a direct IM "
"session with %s.\n", bn);
account = purple_connection_get_account(od->gc);
- conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
- bn, account);
+ conv = purple_conversations_find(PURPLE_TYPE_IM, account, bn);
if (conv != NULL)
purple_conversation_present(conv);
return;
============================================================
--- libpurple/protocols/oscar/odc.c 19fbe86624736cfb6024181ae455a938fd746c2a
+++ libpurple/protocols/oscar/odc.c 9e1af3089ac6b6c48c78e161178f63d0c767204f
@@ -62,8 +62,8 @@ peer_odc_close(PeerConnection *conn)
PurpleConversation *conv;
account = purple_connection_get_account(conn->od->gc);
- conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn);
- purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ conv = PURPLE_CONVERSATION(purple_im_new(account, conn->bn));
+ purple_conversation_write_message(conv, tmp, PURPLE_MESSAGE_SYSTEM);
g_free(tmp);
}
@@ -246,6 +246,7 @@ peer_odc_handle_payload(PeerConnection *
gchar *utf8;
GString *newmsg;
PurpleMessageFlags imflags;
+ PurpleMessage *message;
gc = conn->od->gc;
account = purple_connection_get_account(gc);
@@ -400,7 +401,11 @@ peer_odc_handle_payload(PeerConnection *
imflags |= PURPLE_MESSAGE_IMAGES;
if (autoreply)
imflags |= PURPLE_MESSAGE_AUTO_RESP;
- serv_got_im(gc, conn->bn, newmsg->str, imflags, time(NULL));
+
+ message = purple_message_new(conn->bn, NULL, newmsg->str, imflags, time(NULL));
+ if (!purple_im_new_with_receive(account, message)) {
+ purple_message_free(message);
+ }
g_string_free(newmsg, TRUE);
/* unref any images we allocated */
@@ -558,9 +563,8 @@ peer_odc_recv_frame(PeerConnection *conn
/* Tell the local user that we are connected */
account = purple_connection_get_account(gc);
- conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn);
- purple_conversation_write(conv, NULL, _("Direct IM established"),
- PURPLE_MESSAGE_SYSTEM, time(NULL));
+ conv = PURPLE_CONVERSATION(purple_im_new(account, conn->bn));
+ purple_conversation_write_message(conv, _("Direct IM established"), PURPLE_MESSAGE_SYSTEM);
}
if ((frame->type != 0x0001) && (frame->subtype != 0x0006))
@@ -603,8 +607,8 @@ peer_odc_recv_frame(PeerConnection *conn
g_free(size2);
account = purple_connection_get_account(conn->od->gc);
- conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn);
- purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ conv = PURPLE_CONVERSATION(purple_im_new(account, conn->bn));
+ purple_conversation_write_message(conv, tmp, PURPLE_MESSAGE_SYSTEM);
g_free(tmp);
peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL);
More information about the Commits
mailing list