# HG changeset patch # User Stu Tomlinson # Date 1132865266 0 # Node ID 4d3119205a333ea6ace642b1faa7946c48e18a51 # Parent 31b91bfab029d55692cd2ac74ceb6dba81603876 [gaim-migrate @ 14518] Remove GaimConvImFlags and GaimConvChatFlags - use GaimMessageFlags everywhere instead. Add a new GAIM_MESSAGE_IMAGES flag, and set it when sending a message containing images. When sending a message, the core will now always send "html" to the prpls, just like it expects to receive html from the prpls for received messages. This will allow text prpls such as SILC to support IM images and differentiate them from user input. Previously gaim_unescape_html() was used before passing the message to the prpl, now the prpl does this itself if it needs it. I think I updated all the prpls correctly, but I'm not so sure about sametime. committer: Tailor Script diff -r 31b91bfab029 -r 4d3119205a33 plugins/ChangeLog.API --- a/plugins/ChangeLog.API Thu Nov 24 20:38:24 2005 +0000 +++ b/plugins/ChangeLog.API Thu Nov 24 20:47:46 2005 +0000 @@ -55,6 +55,11 @@ * GaimXfer->ops.read, GaimXfer->ops.write, gaim_xfer_set_read_fnc(), gaim_xfer_set_write_fnc(), gaim_xfer_read(), gaim_xfer_write(): Changed ssize_t to gssize + * serv_got_im, serv_got_chat_in, serv_send_im and serv_chat_send all use + GaimMessageFlags instead of GaimConvImFlags / GaimConvChatFlags + * All core<->prpl message passing now uses html. This was previously true + for receiving messages, it's now also true for sending them. prpls that + don't support html need to gaim_unescape_html() the message. Removed: * gaim_gtk_sound_{get,set}_mute() (replaced by the /gaim/gtk/sound/mute @@ -97,6 +102,7 @@ * gaim_gtkpounce_menu_build() * gaim_gtkpounce_dialog_show() * GaimGtkBuddyList->bpmenu + * GaimConvImFlags and GaimConvChatFlags; use GaimMessageFlags instead Added: * gaim_prefs_disconnect_by_handle() diff -r 31b91bfab029 -r 4d3119205a33 plugins/perl/common/Server.xs --- a/plugins/perl/common/Server.xs Thu Nov 24 20:38:24 2005 +0000 +++ b/plugins/perl/common/Server.xs Thu Nov 24 20:47:46 2005 +0000 @@ -31,10 +31,11 @@ int b int -serv_chat_send(con, a, b) +serv_chat_send(con, a, b, flags) Gaim::Connection con int a const char * b + Gaim::MessageFlags flags void serv_chat_whisper(con, a, b, c) @@ -59,7 +60,7 @@ Gaim::Connection g int id const char *who - Gaim::ConvChatFlags chatflags + Gaim::MessageFlags chatflags const char *message time_t mtime @@ -100,7 +101,7 @@ Gaim::Connection gc const char *who const char *msg - Gaim::ConvImFlags imflags + Gaim::MessageFlags imflags time_t mtime Gaim::Conversation @@ -196,7 +197,7 @@ Gaim::Connection con const char * a const char * b - Gaim::ConvImFlags flags + Gaim::MessageFlags flags int serv_send_typing(con, a, b) diff -r 31b91bfab029 -r 4d3119205a33 plugins/perl/common/module.h --- a/plugins/perl/common/module.h Thu Nov 24 20:38:24 2005 +0000 +++ b/plugins/perl/common/module.h Thu Nov 24 20:47:46 2005 +0000 @@ -201,8 +201,6 @@ /* prpl.h */ typedef GaimBuddyIconSpec * Gaim__Buddy__Icon__Spec; typedef GaimPluginProtocolInfo * Gaim__PluginProtocolInfo; -typedef GaimConvImFlags Gaim__ConvImFlags; -typedef GaimConvChatFlags Gaim__ConvChatFlags; typedef GaimIconScaleRules Gaim__IconScaleRules; typedef GaimProtocolOptions Gaim__ProtocolOptions; diff -r 31b91bfab029 -r 4d3119205a33 plugins/signals-test.c --- a/plugins/signals-test.c Thu Nov 24 20:38:24 2005 +0000 +++ b/plugins/signals-test.c Thu Nov 24 20:47:46 2005 +0000 @@ -559,7 +559,6 @@ void *conv_handle = gaim_conversations_get_handle(); void *accounts_handle = gaim_accounts_get_handle(); void *ciphers_handle = gaim_ciphers_get_handle(); - void *buddy_icons_handle = gaim_buddy_icons_get_handle(); void *ft_handle = gaim_xfers_get_handle(); /* Accounts subsystem signals */ diff -r 31b91bfab029 -r 4d3119205a33 src/conversation.c --- a/src/conversation.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/conversation.c Thu Nov 24 20:47:46 2005 +0000 @@ -150,6 +150,8 @@ account, conv, displayed); } + msgflags |= GAIM_MESSAGE_SEND; + if (type == GAIM_CONV_TYPE_IM) { GaimConvIm *im = GAIM_CONV_IM(conv); @@ -158,22 +160,9 @@ gaim_conversation_get_name(conv), &sent); if (sent != NULL && sent[0] != '\0') { - GaimConvImFlags imflags = 0; - - msgflags |= GAIM_MESSAGE_SEND; - - if (msgflags & GAIM_MESSAGE_AUTO_RESP) - imflags |= GAIM_CONV_IM_AUTO_RESP; - - if (conv->features & GAIM_CONNECTION_HTML) { - err = serv_send_im(gc, gaim_conversation_get_name(conv), - sent, imflags); - } else { - gchar *tmp = gaim_unescape_html(sent); - err = serv_send_im(gc, gaim_conversation_get_name(conv), - tmp, imflags); - g_free(tmp); - } + + err = serv_send_im(gc, gaim_conversation_get_name(conv), + sent, msgflags); if ((err > 0) && (displayed != NULL)) gaim_conv_im_write(im, NULL, displayed, msgflags, time(NULL)); @@ -189,13 +178,7 @@ gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv))); if (sent != NULL && sent[0] != '\0') { - if (conv->features & GAIM_CONNECTION_HTML) { - err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), sent); - } else { - gchar *tmp = gaim_unescape_html(sent); - err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), tmp); - g_free(tmp); - } + err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), sent, msgflags); gaim_signal_emit(gaim_conversations_get_handle(), "sent-chat-msg", account, sent, diff -r 31b91bfab029 -r 4d3119205a33 src/conversation.h --- a/src/conversation.h Thu Nov 24 20:38:24 2005 +0000 +++ b/src/conversation.h Thu Nov 24 20:47:46 2005 +0000 @@ -107,7 +107,8 @@ GAIM_MESSAGE_WHISPER = 0x0080, /**< Whispered message. */ GAIM_MESSAGE_ERROR = 0x0200, /**< Error message. */ GAIM_MESSAGE_DELAYED = 0x0400, /**< Delayed message. */ - GAIM_MESSAGE_RAW = 0x0800 /**< "Raw" message - don't apply formatting */ + GAIM_MESSAGE_RAW = 0x0800, /**< "Raw" message - don't apply formatting */ + GAIM_MESSAGE_IMAGES = 0x1000 /**< Message contains images */ } GaimMessageFlags; diff -r 31b91bfab029 -r 4d3119205a33 src/gtkconv.c --- a/src/gtkconv.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/gtkconv.c Thu Nov 24 20:47:46 2005 +0000 @@ -490,6 +490,7 @@ GaimConversation *conv = gtkconv->active_conv; GaimAccount *account; GaimConnection *gc; + GaimMessageFlags flags = 0; char *buf, *clean; account = gaim_conversation_get_account(conv); @@ -516,6 +517,10 @@ return; } + /* XXX: is there a better way to tell if the message has images? */ + if (GTK_IMHTML(gtkconv->entry)->im_images != NULL) + flags |= GAIM_MESSAGE_IMAGES; + gc = gaim_account_get_connection(account); if (gc && (conv->features & GAIM_CONNECTION_NO_NEWLINES)) { char **bufs; @@ -525,9 +530,9 @@ for (i = 0; bufs[i]; i++) { send_history_add(conv, bufs[i]); if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) - gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]); + gaim_conv_im_send_with_flags(GAIM_CONV_IM(conv), bufs[i], flags); else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) - gaim_conv_chat_send(GAIM_CONV_CHAT(conv), bufs[i]); + gaim_conv_chat_send_with_flags(GAIM_CONV_CHAT(conv), bufs[i], flags); } g_strfreev(bufs); @@ -535,9 +540,9 @@ } else { send_history_add(conv, buf); if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) - gaim_conv_im_send(GAIM_CONV_IM(conv), buf); + gaim_conv_im_send_with_flags(GAIM_CONV_IM(conv), buf, flags); else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) - gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); + gaim_conv_chat_send_with_flags(GAIM_CONV_CHAT(conv), buf, flags); } g_free(clean); @@ -4973,9 +4978,6 @@ if (conv->features & GAIM_CONNECTION_HTML) { buttons = GTK_IMHTML_ALL; /* Everything on */ - if (!(prpl_info->options & OPT_PROTO_IM_IMAGE) || - conv->features & GAIM_CONNECTION_NO_IMAGES) - buttons &= ~GTK_IMHTML_IMAGE; if (conv->features & GAIM_CONNECTION_NO_BGCOLOR) buttons &= ~GTK_IMHTML_BACKCOLOR; if (conv->features & GAIM_CONNECTION_NO_FONTSIZE) @@ -4986,8 +4988,13 @@ if (conv->features & GAIM_CONNECTION_NO_URLDESC) buttons &= ~GTK_IMHTML_LINKDESC; } else { - buttons = GTK_IMHTML_SMILEY; + buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE; } + + if (!(prpl_info->options & OPT_PROTO_IM_IMAGE) || + conv->features & GAIM_CONNECTION_NO_IMAGES) + buttons &= ~GTK_IMHTML_IMAGE; + gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(account)); diff -r 31b91bfab029 -r 4d3119205a33 src/gtksound.c --- a/src/gtksound.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/gtksound.c Thu Nov 24 20:47:46 2005 +0000 @@ -195,7 +195,7 @@ static void chat_msg_received_cb(GaimAccount *account, char *sender, char *message, GaimConversation *conv, - int flags, GaimSoundEventID event) + GaimMessageFlags flags, GaimSoundEventID event) { GaimConvChat *chat; @@ -207,7 +207,7 @@ if (chat_nick_matches_name(conv, sender)) return; - if (flags & GAIM_CONV_CHAT_ALERT || gaim_utf8_has_word(message, chat->nick)) + if (flags & GAIM_MESSAGE_NICK || gaim_utf8_has_word(message, chat->nick)) play_conv_event(conv, GAIM_SOUND_CHAT_NICK); else play_conv_event(conv, event); diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/bonjour/bonjour.c --- a/src/protocols/bonjour/bonjour.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/bonjour/bonjour.c Thu Nov 24 20:47:46 2005 +0000 @@ -180,7 +180,7 @@ } int -bonjour_send_im(GaimConnection *connection, const char *to, const char *msg, GaimConvImFlags flags) +bonjour_send_im(GaimConnection *connection, const char *to, const char *msg, GaimMessageFlags flags) { if(!to || !msg) return 0; diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/gg/gg.c --- a/src/protocols/gg/gg.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/gg/gg.c Thu Nov 24 20:47:46 2005 +0000 @@ -1501,18 +1501,20 @@ } /* }}} */ -/* static int ggp_send_im(GaimConnection *gc, const char *who, const char *msg, GaimConvImFlags flags) {{{ */ +/* static int ggp_send_im(GaimConnection *gc, const char *who, const char *msg, GaimMessageFlags flags) {{{ */ static int ggp_send_im(GaimConnection *gc, const char *who, const char *msg, - GaimConvImFlags flags) + GaimMessageFlags flags) { GGPInfo *info = gc->proto_data; - char *tmp; + char *tmp, *plain; if (strlen(msg) == 0) return 1; + plain = gaim_unescape_html(msg); gaim_debug_info("gg", "ggp_send_im: msg = %s\n", msg); - tmp = charset_convert(msg, "UTF-8", "CP1250"); + tmp = charset_convert(plain, "UTF-8", "CP1250"); + g_free(plain); if (tmp != NULL && strlen(tmp) > 0) { if (gg_send_message(info->session, GG_CLASS_CHAT, @@ -1655,14 +1657,14 @@ } /* }}} */ -/* static int ggp_chat_send(GaimConnection *gc, int id, const char *message) {{{ */ -static int ggp_chat_send(GaimConnection *gc, int id, const char *message) +/* static int ggp_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) {{{ */ +static int ggp_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) { GaimConversation *conv; GGPInfo *info = gc->proto_data; GGPChat *chat = NULL; GList *l; - char *msg; + char *msg, *plain; uin_t *uins; int count = 0; @@ -1695,7 +1697,9 @@ uins[count++] = uin; } - msg = charset_convert(message, "UTF-8", "CP1250"); + plain = gaim_unescape_html(message); + msg = charset_convert(plain, "UTF-8", "CP1250"); + g_free(plain); gg_send_message_confer(info->session, GG_CLASS_CHAT, count, uins, (unsigned char *)msg); g_free(msg); diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/irc/irc.c --- a/src/protocols/irc/irc.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/irc/irc.c Thu Nov 24 20:47:46 2005 +0000 @@ -49,8 +49,8 @@ static void irc_login_cb(gpointer data, gint source, GaimInputCondition cond); static void irc_ssl_connect_failure(GaimSslConnection *gsc, GaimSslErrorType error, gpointer data); static void irc_close(GaimConnection *gc); -static int irc_im_send(GaimConnection *gc, const char *who, const char *what, GaimConvImFlags flags); -static int irc_chat_send(GaimConnection *gc, int id, const char *what); +static int irc_im_send(GaimConnection *gc, const char *who, const char *what, GaimMessageFlags flags); +static int irc_chat_send(GaimConnection *gc, int id, const char *what, GaimMessageFlags flags); static void irc_chat_join (GaimConnection *gc, GHashTable *data); static void irc_input_cb(gpointer data, gint source, GaimInputCondition cond); static void irc_input_cb_ssl(gpointer data, GaimSslConnection *gsc, GaimInputCondition cond); @@ -408,18 +408,22 @@ g_free(irc); } -static int irc_im_send(GaimConnection *gc, const char *who, const char *what, GaimConvImFlags flags) +static int irc_im_send(GaimConnection *gc, const char *who, const char *what, GaimMessageFlags flags) { struct irc_conn *irc = gc->proto_data; + char *plain; const char *args[2]; if (strchr(status_chars, *who) != NULL) args[0] = who + 1; else args[0] = who; - args[1] = what; + + plain = gaim_unescape_html(what); + args[1] = plain; irc_cmd_privmsg(irc, "msg", NULL, args); + g_free(plain); return 1; } @@ -596,7 +600,7 @@ serv_got_chat_left(gc, id); } -static int irc_chat_send(GaimConnection *gc, int id, const char *what) +static int irc_chat_send(GaimConnection *gc, int id, const char *what, GaimMessageFlags flags) { struct irc_conn *irc = gc->proto_data; GaimConversation *convo = gaim_find_chat(gc, id); @@ -612,13 +616,13 @@ return irc_parse_cmd(irc, convo->name, what + 1); } #endif + tmp = gaim_unescape_html(what); args[0] = convo->name; - args[1] = what; + args[1] = tmp; irc_cmd_privmsg(irc, "msg", NULL, args); - tmp = g_markup_escape_text(what, -1); - serv_got_chat_in(gc, id, gaim_connection_get_display_name(gc), 0, tmp, time(NULL)); + serv_got_chat_in(gc, id, gaim_connection_get_display_name(gc), 0, what, time(NULL)); g_free(tmp); return 0; } diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/irc/msgs.c --- a/src/protocols/irc/msgs.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/irc/msgs.c Thu Nov 24 20:47:46 2005 +0000 @@ -90,7 +90,7 @@ gc = gaim_account_get_connection(irc->account); if (gc) { msg = g_markup_escape_text(args[2], -1); - serv_got_im(gc, args[1], msg, GAIM_CONV_IM_AUTO_RESP, time(NULL)); + serv_got_im(gc, args[1], msg, GAIM_MESSAGE_AUTO_RESP, time(NULL)); g_free(msg); } } diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/jabber/message.c --- a/src/protocols/jabber/message.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/jabber/message.c Thu Nov 24 20:47:46 2005 +0000 @@ -188,7 +188,7 @@ if(jm->xhtml || jm->body) { if(jid->resource) serv_got_chat_in(jm->js->gc, chat->id, jid->resource, - jm->delayed ? GAIM_CONV_CHAT_DELAYED : 0, + jm->delayed ? GAIM_MESSAGE_DELAYED : 0, jm->xhtml ? jm->xhtml : jm->body, jm->sent); else if(chat->muc) gaim_conv_chat_write(GAIM_CONV_CHAT(chat->conv), "", @@ -444,7 +444,7 @@ } int jabber_message_send_im(GaimConnection *gc, const char *who, const char *msg, - GaimConvImFlags flags) + GaimMessageFlags flags) { JabberMessage *jm; JabberBuddy *jb; @@ -486,7 +486,7 @@ return 1; } -int jabber_message_send_chat(GaimConnection *gc, int id, const char *msg) +int jabber_message_send_chat(GaimConnection *gc, int id, const char *msg, GaimMessageFlags flags) { JabberChat *chat; JabberMessage *jm; diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/jabber/message.h --- a/src/protocols/jabber/message.h Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/jabber/message.h Thu Nov 24 20:47:46 2005 +0000 @@ -58,8 +58,8 @@ void jabber_message_parse(JabberStream *js, xmlnode *packet); int jabber_message_send_im(GaimConnection *gc, const char *who, const char *msg, - GaimConvImFlags flags); -int jabber_message_send_chat(GaimConnection *gc, int id, const char *message); + GaimMessageFlags flags); +int jabber_message_send_chat(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags); int jabber_send_typing(GaimConnection *gc, const char *who, int typing); diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/msn/msn.c Thu Nov 24 20:47:46 2005 +0000 @@ -769,7 +769,7 @@ static int msn_send_im(GaimConnection *gc, const char *who, const char *message, - GaimConvImFlags flags) + GaimMessageFlags flags) { GaimAccount *account; MsnMessage *msg; @@ -1174,7 +1174,7 @@ } static int -msn_chat_send(GaimConnection *gc, int id, const char *message) +msn_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) { GaimAccount *account; MsnSession *session; diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/napster/napster.c --- a/src/protocols/napster/napster.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/napster/napster.c Thu Nov 24 20:47:46 2005 +0000 @@ -126,17 +126,20 @@ } /* 205 - MSG_CLIENT_PRIVMSG */ -static int nap_send_im(GaimConnection *gc, const char *who, const char *message, GaimConvImFlags flags) +static int nap_send_im(GaimConnection *gc, const char *who, const char *message, GaimMessageFlags flags) { + char *tmp = gaim_unescape_html(message); - if ((strlen(message) < 2) || (message[0] != '/' ) || (message[1] == '/')) { + if ((strlen(tmp) < 2) || (tmp[0] != '/' ) || (tmp[1] == '/')) { /* Actually send a chat message */ - nap_write_packet(gc, 205, "%s %s", who, message); + nap_write_packet(gc, 205, "%s %s", who, tmp); } else { /* user typed an IRC-style command */ - nap_do_irc_style(gc, message, who); + nap_do_irc_style(gc, tmp, who); } + g_free(tmp); + return 1; } @@ -220,21 +223,24 @@ } /* 402 - MSG_CLIENT_PUBLIC */ -static int nap_chat_send(GaimConnection *gc, int id, const char *message) +static int nap_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) { GaimConversation *c = gaim_find_chat(gc, id); + char *tmp = gaim_unescape_html(message); if (!c) return -EINVAL; - if ((strlen(message) < 2) || (message[0] != '/' ) || (message[1] == '/')) { + if ((strlen(tmp) < 2) || (tmp[0] != '/' ) || (tmp[1] == '/')) { /* Actually send a chat message */ - nap_write_packet(gc, 402, "%s %s", c->name, message); + nap_write_packet(gc, 402, "%s %s", c->name, tmp); } else { /* user typed an IRC-style command */ - nap_do_irc_style(gc, message, c->name); + nap_do_irc_style(gc, tmp, c->name); } + g_free(tmp); + return 0; } diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/novell/novell.c --- a/src/protocols/novell/novell.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/novell/novell.c Thu Nov 24 20:47:46 2005 +0000 @@ -1741,7 +1741,7 @@ NMContact *contact = NULL; GaimConversation *gconv; NMConference *conference; - GaimConvImFlags imflags; + GaimMessageFlags flags; char *text = NULL; text = g_markup_escape_text(nm_event_get_text(event), -1); @@ -1757,13 +1757,13 @@ user_record = nm_find_user_record(user, nm_event_get_source(event)); if (user_record) { - imflags = 0; + flags = 0; if (nm_event_get_type(event) == NMEVT_RECEIVE_AUTOREPLY) - imflags |= GAIM_CONV_IM_AUTO_RESP; + flags |= GAIM_MESSAGE_AUTO_RESP; serv_got_im(gaim_account_get_connection(user->client_data), nm_user_record_get_display_id(user_record), - text, imflags, + text, flags, nm_event_get_gmt(event)); gconv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, @@ -2201,13 +2201,14 @@ static int novell_send_im(GaimConnection * gc, const char *name, - const char *message_body, GaimConvImFlags flags) + const char *message_body, GaimMessageFlags flags) { NMUserRecord *user_record = NULL; NMConference *conf = NULL; NMMessage *message; NMUser *user; const char *dn = NULL; + char *plain; gboolean done = TRUE, created_conf = FALSE; NMERR_T rc = NM_OK; @@ -2220,7 +2221,9 @@ return 0; /* Create a new message */ - message = nm_create_message(message_body); + plain = gaim_unescape_html(message_body); + message = nm_create_message(plain); + g_free(plain); /* Need to get the DN for the buddy so we can look up the convo */ dn = nm_lookup_dn(user, name); @@ -2412,7 +2415,7 @@ } static int -novell_chat_send(GaimConnection * gc, int id, const char *text) +novell_chat_send(GaimConnection * gc, int id, const char *text, GaimMessageFlags flags) { NMConference *conference; GaimConversation *chat; @@ -2421,7 +2424,7 @@ NMUser *user; NMERR_T rc = NM_OK; const char *name; - char *str; + char *str, *plain; if (gc == NULL || text == NULL) return -1; @@ -2430,7 +2433,9 @@ if (user == NULL) return -1; - message = nm_create_message(text); + plain = gaim_unescape_html(text); + message = nm_create_message(plain); + g_free(plain); for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { conference = cnode->data; diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/oscar/oscar.c Thu Nov 24 20:47:46 2005 +0000 @@ -1249,7 +1249,7 @@ */ static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { GaimConnection *gc = sess->aux_data; - GaimConvImFlags imflags = 0; + GaimMessageFlags imflags = 0; gchar *utf8; GString *newmsg = g_string_new(""); GSList *images = NULL; @@ -1271,7 +1271,7 @@ "Got DirectIM message from %s\n", sn); if (isawaymsg) - imflags |= GAIM_CONV_IM_AUTO_RESP; + imflags |= GAIM_MESSAGE_AUTO_RESP; /* message has a binary trailer */ if ((binary = gaim_strcasestr(msg, ""))) { @@ -1350,7 +1350,7 @@ /* set the flag if we caught any images */ if (images) - imflags |= GAIM_CONV_IM_IMAGES; + imflags |= GAIM_MESSAGE_IMAGES; } else { g_string_append_len(newmsg, msg, len); } @@ -1405,7 +1405,7 @@ return 1; } -static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, GaimConvImFlags imflags) { +static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, GaimMessageFlags imflags) { char *buf; size_t len; int ret; @@ -1478,7 +1478,7 @@ /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ - if (imflags & GAIM_CONV_IM_AUTO_RESP) + if (imflags & GAIM_MESSAGE_AUTO_RESP) ret = aim_odc_send_im(sess, conn, buf, len, 0, 1); else ret = aim_odc_send_im(sess, conn, buf, len, 0, 0); @@ -3892,7 +3892,7 @@ GaimConnection *gc = sess->aux_data; OscarData *od = gc->proto_data; GaimAccount *account = gaim_connection_get_account(gc); - GaimConvImFlags flags = 0; + GaimMessageFlags flags = 0; struct buddyinfo *bi; char *iconfile; GString *message; @@ -3912,7 +3912,7 @@ } if (args->icbmflags & AIM_IMFLAGS_AWAY) - flags |= GAIM_CONV_IM_AUTO_RESP; + flags |= GAIM_MESSAGE_AUTO_RESP; if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) bi->typingnot = TRUE; @@ -6320,9 +6320,9 @@ return 0; } -static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimConvImFlags); - -static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) { +static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimMessageFlags); + +static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimMessageFlags imflags) { OscarData *od = (OscarData *)gc->proto_data; GaimAccount *account = gaim_connection_get_account(gc); struct oscar_direct_im *dim = oscar_direct_im_find(od, name); @@ -6376,7 +6376,7 @@ args.features = features_aim; args.featureslen = sizeof(features_aim); - if (imflags & GAIM_CONV_IM_AUTO_RESP) + if (imflags & GAIM_MESSAGE_AUTO_RESP) args.flags |= AIM_IMFLAGS_AWAY; } @@ -6428,10 +6428,10 @@ if (aim_sn_is_icq(gaim_account_get_username(account))) { if (aim_sn_is_icq(name)) /* From ICQ to ICQ */ - tmpmsg = g_strdup(message); + tmpmsg = gaim_unescape_html(message); else /* From ICQ to AIM */ - tmpmsg = g_markup_escape_text(message, -1); + tmpmsg = g_strdup(message); } else { /* From AIM to AIM and AIM to ICQ */ tmpmsg = g_strdup(message); @@ -7433,7 +7433,7 @@ oscar_chat_kill(gc, cc); } -static int oscar_send_chat(GaimConnection *gc, int id, const char *message) { +static int oscar_send_chat(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) { OscarData *od = (OscarData *)gc->proto_data; GaimConversation *conv = NULL; struct chat_connection *c = NULL; diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/sametime/sametime.c --- a/src/protocols/sametime/sametime.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/sametime/sametime.c Thu Nov 24 20:47:46 2005 +0000 @@ -3908,7 +3908,7 @@ static int mw_prpl_send_im(GaimConnection *gc, const char *name, const char *message, - GaimConvImFlags flags) { + GaimMessageFlags flags) { struct mwGaimPluginData *pd; struct mwIdBlock who = { (char *) name, NULL }; @@ -3930,13 +3930,13 @@ which is bad. I'm not sure how to fix this correctly. */ if(strstr(message, "proto_data; SilcClient client = sg->client; @@ -1268,8 +1268,7 @@ SilcChannelPrivateKey key = NULL; SilcUInt32 flags; int ret; - const char *msg2; - char *tmp; + char *msg2, *tmp; gboolean found = FALSE; gboolean sign = gaim_account_get_bool(sg->account, "sign-verify", FALSE); @@ -1278,18 +1277,21 @@ flags = SILC_MESSAGE_FLAG_UTF8; - msg2 = msg; + tmp = msg2 = gaim_unescape_html(msg); if (!g_ascii_strncasecmp(msg2, "/me ", 4)) { msg2 += 4; - if (!msg2) + if (!*msg2) { + g_free(tmp); return 0; + } flags |= SILC_MESSAGE_FLAG_ACTION; } else if (strlen(msg) > 1 && msg[0] == '/') { if (!silc_client_command_call(client, conn, msg + 1)) gaim_notify_error(gc, ("Call Command"), _("Cannot call command"), _("Unknown command")); + g_free(tmp); return 0; } @@ -1306,13 +1308,17 @@ for (l = sg->grps; l; l = l->next) if (((SilcGaimPrvgrp)l->data)->id == id) break; - if (!l) + if (!l) { + g_free(tmp); return 0; + } prv = l->data; channel = silc_client_get_channel(sg->client, sg->conn, (char *)prv->parentch); - if (!channel) + if (!channel) { + g_free(tmp); return 0; + } key = prv->key; } @@ -1326,8 +1332,10 @@ } } silc_hash_table_list_reset(&htl); - if (!found) + if (!found) { + g_free(tmp); return 0; + } channel = chu->channel; } @@ -1336,11 +1344,10 @@ flags, (unsigned char *)msg2, strlen(msg2), TRUE); if (ret) { - tmp = g_markup_escape_text(msg, -1); - serv_got_chat_in(gc, id, gaim_connection_get_display_name(gc), 0, tmp, + serv_got_chat_in(gc, id, gaim_connection_get_display_name(gc), 0, msg, time(NULL)); - g_free(tmp); } + g_free(tmp); return ret; } diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/silc/silc.c --- a/src/protocols/silc/silc.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/silc/silc.c Thu Nov 24 20:47:46 2005 +0000 @@ -1062,38 +1062,45 @@ } static int -silcgaim_send_im(GaimConnection *gc, const char *who, const char *msg, - GaimConvImFlags flags) +silcgaim_send_im(GaimConnection *gc, const char *who, const char *message, + GaimMessageFlags flags) { SilcGaim sg = gc->proto_data; SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientEntry *clients; SilcUInt32 clients_count, mflags; - char *nickname; + char *nickname, *msg, *tmp; int ret; gboolean sign = gaim_account_get_bool(sg->account, "sign-verify", FALSE); - if (!who || !msg) + if (!who || !message) return 0; mflags = SILC_MESSAGE_FLAG_UTF8; + tmp = msg = gaim_unescape_html(message); + if (!g_ascii_strncasecmp(msg, "/me ", 4)) { msg += 4; - if (!msg) + if (!*msg) { + g_free(tmp); return 0; + } mflags |= SILC_MESSAGE_FLAG_ACTION; } else if (strlen(msg) > 1 && msg[0] == '/') { if (!silc_client_command_call(client, conn, msg + 1)) gaim_notify_error(gc, ("Call Command"), _("Cannot call command"), _("Unknown command")); + g_free(tmp); return 0; } - if (!silc_parse_userfqdn(who, &nickname, NULL)) + if (!silc_parse_userfqdn(who, &nickname, NULL)) { + g_free(tmp); return 0; + } if (sign) mflags |= SILC_MESSAGE_FLAG_SIGNED; @@ -1104,8 +1111,10 @@ if (!clients) { /* Resolve unknown user */ SilcGaimIM im = silc_calloc(1, sizeof(*im)); - if (!im) + if (!im) { + g_free(tmp); return 0; + } im->nick = g_strdup(who); im->message = g_strdup(msg); im->message_len = strlen(im->message); @@ -1113,6 +1122,7 @@ silc_client_get_clients(client, conn, nickname, NULL, silcgaim_send_im_resolved, im); silc_free(nickname); + g_free(tmp); return 0; } @@ -1121,6 +1131,7 @@ mflags, (unsigned char *)msg, strlen(msg), TRUE); + g_free(tmp); silc_free(nickname); silc_free(clients); return ret; diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/silc/silcgaim.h --- a/src/protocols/silc/silcgaim.h Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/silc/silcgaim.h Thu Nov 24 20:47:46 2005 +0000 @@ -133,7 +133,8 @@ void silcgaim_chat_invite(GaimConnection *gc, int id, const char *msg, const char *name); void silcgaim_chat_leave(GaimConnection *gc, int id); -int silcgaim_chat_send(GaimConnection *gc, int id, const char *msg); +int silcgaim_chat_send(GaimConnection *gc, int id, const char *msg, + GaimMessageFlags flags); void silcgaim_chat_set_topic(GaimConnection *gc, int id, const char *topic); GaimRoomlist *silcgaim_roomlist_get_list(GaimConnection *gc); void silcgaim_roomlist_cancel(GaimRoomlist *list); diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/simple/simple.c --- a/src/protocols/simple/simple.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/simple/simple.c Thu Nov 24 20:47:46 2005 +0000 @@ -494,14 +494,15 @@ static void send_sip_request(GaimConnection *gc, gchar *method, gchar *url, gchar *to, gchar *addheaders, gchar *body, struct sip_dialog *dialog, TransCallback tc) { struct simple_account_data *sip = gc->proto_data; char *callid= dialog ? g_strdup(dialog->callid) : gencallid(); + char *auth=""; + char *addh=""; + gchar *branch = genbranch(); + char *buf; + if(!strcmp(method,"REGISTER")) { if(sip->regcallid) callid = g_strdup(sip->regcallid); else sip->regcallid = g_strdup(callid); } - char *auth=""; - char *addh=""; - gchar *branch = genbranch(); - char *buf; if(addheaders) addh=addheaders; if(sip->registrar.type && !strcmp(method,"REGISTER")) { @@ -713,10 +714,10 @@ g_free(hdr); } -static int simple_im_send(GaimConnection *gc, const char *who, const char *what, GaimConvImFlags flags) { +static int simple_im_send(GaimConnection *gc, const char *who, const char *what, GaimMessageFlags flags) { struct simple_account_data *sip = gc->proto_data; char *to = g_strdup(who); - char *text = g_strdup(what); + char *text = gaim_unescape_html(what); simple_send_message(sip, to, text, NULL); g_free(to); g_free(text); diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/toc/toc.c --- a/src/protocols/toc/toc.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/toc/toc.c Thu Nov 24 20:47:46 2005 +0000 @@ -806,7 +806,7 @@ message++; message++; - a = (away && (*away == 'T')) ? GAIM_CONV_IM_AUTO_RESP : 0; + a = (away && (*away == 'T')) ? GAIM_MESSAGE_AUTO_RESP : 0; serv_got_im(gc, c, message, a, time(NULL)); } else if (!g_ascii_strcasecmp(c, "UPDATE_BUDDY")) { @@ -890,7 +890,7 @@ serv_got_joined_chat(gc, id, name); } else if (!g_ascii_strcasecmp(c, "CHAT_IN")) { int id; - GaimConvChatFlags flags; + GaimMessageFlags flags; char *m, *who, *whisper; sscanf(strtok(NULL, ":"), "%d", &id); @@ -901,7 +901,7 @@ m++; m++; - flags = (whisper && (*whisper == 'T')) ? GAIM_CONV_CHAT_WHISPER : 0; + flags = (whisper && (*whisper == 'T')) ? GAIM_MESSAGE_WHISPER : 0; serv_got_chat_in(gc, id, who, flags, m, time((time_t)NULL)); } else if (!g_ascii_strcasecmp(c, "CHAT_UPDATE_BUDDY")) { @@ -1142,7 +1142,7 @@ } } -static int toc_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags flags) +static int toc_send_im(GaimConnection *gc, const char *name, const char *message, GaimMessageFlags flags) { char *buf1, *buf2; @@ -1154,7 +1154,7 @@ return -E2BIG; } buf2 = g_strdup_printf("toc_send_im %s \"%s\"%s", gaim_normalize(gc->account, name), buf1, - ((flags & GAIM_CONV_IM_AUTO_RESP) ? " auto" : "")); + ((flags & GAIM_MESSAGE_AUTO_RESP) ? " auto" : "")); g_free(buf1); #else /* This doesn't work yet. See the comments below for details */ @@ -1178,7 +1178,7 @@ } buf2 = g_strdup_printf("toc2_send_im_enc %s F U en \"%s\" %s", gaim_normalize(gc->account, name), buf1, - ((flags & GAIM_CONV_IM_AUTO_RESP) ? "auto" : "")); + ((flags & GAIM_MESSAGE_AUTO_RESP) ? "auto" : "")); g_free(buf1); #endif @@ -1455,7 +1455,7 @@ g_free(buf2); } -static int toc_chat_send(GaimConnection *g, int id, const char *message) +static int toc_chat_send(GaimConnection *g, int id, const char *message, GaimMessageFlags flags) { char *buf1, *buf2; buf1 = escape_text(message); diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/yahoo/yahoo.c Thu Nov 24 20:47:46 2005 +0000 @@ -3007,7 +3007,7 @@ return m; } -static int yahoo_send_im(GaimConnection *gc, const char *who, const char *what, GaimConvImFlags flags) +static int yahoo_send_im(GaimConnection *gc, const char *who, const char *what, GaimMessageFlags flags) { struct yahoo_data *yd = gc->proto_data; struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0); diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/yahoo/yahoochat.c --- a/src/protocols/yahoo/yahoochat.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/yahoo/yahoochat.c Thu Nov 24 20:47:46 2005 +0000 @@ -802,7 +802,7 @@ return FALSE; } -static int yahoo_chat_send(GaimConnection *gc, const char *dn, const char *room, const char *what) +static int yahoo_chat_send(GaimConnection *gc, const char *dn, const char *room, const char *what, GaimMessageFlags flags) { struct yahoo_data *yd = gc->proto_data; struct yahoo_packet *pkt; @@ -943,7 +943,7 @@ serv_got_chat_left(gc, id); } -int yahoo_c_send(GaimConnection *gc, int id, const char *what) +int yahoo_c_send(GaimConnection *gc, int id, const char *what, GaimMessageFlags flags) { GaimConversation *c; int ret; @@ -962,7 +962,7 @@ gaim_conversation_get_name(c), gaim_conv_chat_get_users(GAIM_CONV_CHAT(c)), what); } else { ret = yahoo_chat_send(gc, gaim_connection_get_display_name(gc), - gaim_conversation_get_name(c), what); + gaim_conversation_get_name(c), what, flags); if (!ret) serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(c)), gaim_connection_get_display_name(gc), 0, what, time(NULL)); diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/yahoo/yahoochat.h --- a/src/protocols/yahoo/yahoochat.h Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/yahoo/yahoochat.h Thu Nov 24 20:47:46 2005 +0000 @@ -42,7 +42,7 @@ void yahoo_process_chat_goto(GaimConnection *gc, struct yahoo_packet *pkt); void yahoo_c_leave(GaimConnection *gc, int id); -int yahoo_c_send(GaimConnection *gc, int id, const char *what); +int yahoo_c_send(GaimConnection *gc, int id, const char *what, GaimMessageFlags flags); GList *yahoo_c_info(GaimConnection *gc); GHashTable *yahoo_c_info_defaults(GaimConnection *gc, const char *chat_name); void yahoo_c_join(GaimConnection *gc, GHashTable *data); diff -r 31b91bfab029 -r 4d3119205a33 src/protocols/zephyr/zephyr.c --- a/src/protocols/zephyr/zephyr.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/protocols/zephyr/zephyr.c Thu Nov 24 20:47:46 2005 +0000 @@ -749,7 +749,7 @@ char *sendertmp = g_strdup_printf("%s", zephyr->username); int signature_length = strlen(notice.z_message); int message_has_no_body = 0; - GaimConvImFlags flags = 0; + GaimMessageFlags flags = 0; gchar *tmpescape; /* Need to deal with 0 length messages to handle typing notification (OPCODE) ping messages */ @@ -778,7 +778,7 @@ && !g_ascii_strcasecmp(notice.z_recipient,zephyr->username)) { gchar* stripped_sender; if (!g_ascii_strcasecmp(notice.z_message, "Automated reply:")) - flags |= GAIM_CONV_IM_AUTO_RESP; + flags |= GAIM_MESSAGE_AUTO_RESP; stripped_sender = zephyr_strip_local_realm(zephyr,notice.z_sender); if (!g_ascii_strcasecmp(notice.z_opcode,"PING")) @@ -1991,7 +1991,7 @@ return sig; } -static int zephyr_chat_send(GaimConnection * gc, int id, const char *im) +static int zephyr_chat_send(GaimConnection * gc, int id, const char *im, GaimMessageFlags flags) { zephyr_triple *zt; const char *sig; @@ -2025,11 +2025,11 @@ } -static int zephyr_send_im(GaimConnection * gc, const char *who, const char *im, GaimConvImFlags flags) +static int zephyr_send_im(GaimConnection * gc, const char *who, const char *im, GaimMessageFlags flags) { const char *sig; zephyr_account *zephyr = gc->proto_data; - if (flags & GAIM_CONV_IM_AUTO_RESP) + if (flags & GAIM_MESSAGE_AUTO_RESP) sig = "Automated reply:"; else { sig = zephyr_get_signature(); diff -r 31b91bfab029 -r 4d3119205a33 src/prpl.h --- a/src/prpl.h Thu Nov 24 20:38:24 2005 +0000 +++ b/src/prpl.h Thu Nov 24 20:47:46 2005 +0000 @@ -35,22 +35,6 @@ /** @name Basic Protocol Information */ /**************************************************************************/ -/** - * Flags applicable to outgoing/incoming IMs from prpls. - */ -typedef enum -{ - GAIM_CONV_IM_AUTO_RESP = 0x0001, /**< Auto response. */ - GAIM_CONV_IM_IMAGES = 0x0002 /**< Contains images. */ -} GaimConvImFlags; - -typedef enum -{ - GAIM_CONV_CHAT_WHISPER = 0x0001, /**< Whispered message.*/ - GAIM_CONV_CHAT_DELAYED = 0x0002, /**< Delayed message. */ - GAIM_CONV_CHAT_ALERT = 0x0004 /**< Alert message. */ -} GaimConvChatFlags; - typedef enum { GAIM_ICON_SCALE_DISPLAY = 0x01, /**< We scale the icon when we display it */ GAIM_ICON_SCALE_SEND = 0x02 /**< We scale the icon before we send it to the server */ @@ -80,6 +64,7 @@ #define NO_BUDDY_ICONS {NULL, 0, 0, 0, 0, 0} #include "blist.h" +#include "conversation.h" #include "ft.h" #include "proxy.h" #include "plugin.h" @@ -237,7 +222,7 @@ */ int (*send_im)(GaimConnection *, const char *who, const char *message, - GaimConvImFlags flags); + GaimMessageFlags flags); void (*set_info)(GaimConnection *, const char *info); int (*send_typing)(GaimConnection *, const char *name, int typing); @@ -264,7 +249,7 @@ void (*chat_leave)(GaimConnection *, int id); void (*chat_whisper)(GaimConnection *, int id, const char *who, const char *message); - int (*chat_send)(GaimConnection *, int id, const char *message); + int (*chat_send)(GaimConnection *, int id, const char *message, GaimMessageFlags flags); void (*keepalive)(GaimConnection *); /* new user registration */ diff -r 31b91bfab029 -r 4d3119205a33 src/server.c --- a/src/server.c Thu Nov 24 20:38:24 2005 +0000 +++ b/src/server.c Thu Nov 24 20:47:46 2005 +0000 @@ -113,7 +113,7 @@ } int serv_send_im(GaimConnection *gc, const char *name, const char *message, - GaimConvImFlags imflags) + GaimMessageFlags flags) { GaimConversation *conv; GaimAccount *account; @@ -131,10 +131,10 @@ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, gc->account); if (prpl_info && prpl_info->send_im) - val = prpl_info->send_im(gc, name, message, imflags); + val = prpl_info->send_im(gc, name, message, flags); /* Only update the last_sent_time if the user actually sent the message */ - if (!(imflags & GAIM_CONV_IM_AUTO_RESP)) + if (!(flags & GAIM_MESSAGE_AUTO_RESP)) time(&gc->last_sent_time); /* @@ -400,7 +400,7 @@ prpl_info->chat_whisper(g, id, who, message); } -int serv_chat_send(GaimConnection *gc, int id, const char *message) +int serv_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) { int val = -EINVAL; GaimPluginProtocolInfo *prpl_info = NULL; @@ -409,7 +409,7 @@ prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); if (prpl_info && prpl_info->chat_send) - val = prpl_info->chat_send(gc, id, message); + val = prpl_info->chat_send(gc, id, message, flags); time(&gc->last_sent_time); @@ -433,13 +433,12 @@ * sure to follow along, kids */ void serv_got_im(GaimConnection *gc, const char *who, const char *msg, - GaimConvImFlags imflags, time_t mtime) + GaimMessageFlags flags, time_t mtime) { GaimAccount *account; GaimConversation *cnv; GaimPresence *presence; GaimStatus *status; - GaimMessageFlags msgflags; char *message, *name; char *angel, *buffy; int plugin_return; @@ -467,7 +466,7 @@ plugin_return = GPOINTER_TO_INT( gaim_signal_emit_return_1(gaim_conversations_get_handle(), "receiving-im-msg", gc->account, - &angel, &buffy, cnv, &imflags)); + &angel, &buffy, cnv, &flags)); if (!buffy || !angel || plugin_return) { if (buffy) @@ -481,7 +480,7 @@ message = buffy; gaim_signal_emit(gaim_conversations_get_handle(), "received-im-msg", gc->account, - name, message, cnv, imflags); + name, message, cnv, flags); /* Make sure URLs are clickable */ buffy = gaim_markup_linkify(message); @@ -489,14 +488,9 @@ message = buffy; /* - * Um. When we call gaim_conversation_write with the message we received, - * it's nice to pass whether or not it was an auto-response. So if it - * was an auto-response, we set the appropriate flag. This is just so - * prpls don't have to know about GAIM_MESSAGE_* (though some do anyway). + * XXX: Should we be setting this here, or relying on prpls to set it? */ - msgflags = GAIM_MESSAGE_RECV; - if (imflags & GAIM_CONV_IM_AUTO_RESP) - msgflags |= GAIM_MESSAGE_AUTO_RESP; + flags |= GAIM_MESSAGE_RECV; /* * Alright. Two cases for how to handle this. Either we're away or @@ -516,7 +510,7 @@ if (cnv == NULL) cnv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name); - gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, msgflags, mtime); + gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, flags, mtime); /* * Don't autorespond if: @@ -569,7 +563,7 @@ /* Move this to oscar.c! */ buffy = gaim_str_sub_away_formatters(away_msg, alias); - serv_send_im(gc, name, buffy, GAIM_CONV_IM_AUTO_RESP); + serv_send_im(gc, name, buffy, GAIM_MESSAGE_AUTO_RESP); #if 0 if (!cnv && awayqueue && @@ -607,7 +601,7 @@ if (cnv == NULL) cnv = gaim_conversation_new(GAIM_CONV_TYPE_IM, gc->account, name); - gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, msgflags, mtime); + gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, flags, mtime); } g_free(name); @@ -791,9 +785,8 @@ } void serv_got_chat_in(GaimConnection *g, int id, const char *who, - GaimConvChatFlags chatflags, const char *message, time_t mtime) + GaimMessageFlags flags, const char *message, time_t mtime) { - GaimMessageFlags msgflags = 0; GSList *bcs; GaimConversation *conv = NULL; GaimConvChat *chat = NULL; @@ -830,7 +823,7 @@ plugin_return = GPOINTER_TO_INT( gaim_signal_emit_return_1(gaim_conversations_get_handle(), "receiving-chat-msg", g->account, - &angel, &buffy, conv, &chatflags)); + &angel, &buffy, conv, &flags)); if (!buffy || !angel || plugin_return) { if (buffy) @@ -843,19 +836,12 @@ message = buffy; gaim_signal_emit(gaim_conversations_get_handle(), "received-chat-msg", g->account, - who, message, conv, chatflags); + who, message, conv, flags); /* Make sure URLs are clickable */ buf = gaim_markup_linkify(message); - if (chatflags & GAIM_CONV_CHAT_WHISPER) - msgflags |= GAIM_MESSAGE_WHISPER; - if (chatflags & GAIM_CONV_CHAT_DELAYED) - msgflags |= GAIM_MESSAGE_DELAYED; - if (chatflags & GAIM_CONV_CHAT_ALERT) - msgflags |= GAIM_MESSAGE_NICK; - - gaim_conv_chat_write(chat, who, buf, msgflags, mtime); + gaim_conv_chat_write(chat, who, buf, flags, mtime); g_free(angel); g_free(buf); diff -r 31b91bfab029 -r 4d3119205a33 src/server.h --- a/src/server.h Thu Nov 24 20:38:24 2005 +0000 +++ b/src/server.h Thu Nov 24 20:47:46 2005 +0000 @@ -33,7 +33,7 @@ extern "C" { #endif -int serv_send_im(GaimConnection *, const char *, const char *, GaimConvImFlags); +int serv_send_im(GaimConnection *, const char *, const char *, GaimMessageFlags flags); void serv_get_info(GaimConnection *, const char *); void serv_set_info(GaimConnection *, const char *); int serv_send_typing(GaimConnection *, const char *, int); @@ -48,7 +48,7 @@ void serv_chat_invite(GaimConnection *, int, const char *, const char *); void serv_chat_leave(GaimConnection *, int); void serv_chat_whisper(GaimConnection *, int, const char *, const char *); -int serv_chat_send(GaimConnection *, int, const char *); +int serv_chat_send(GaimConnection *, int, const char *, GaimMessageFlags flags); void serv_alias_buddy(GaimBuddy *); void serv_got_alias(GaimConnection *gc, const char *who, const char *alias); void serv_got_typing(GaimConnection *gc, const char *name, int timeout, @@ -56,7 +56,7 @@ void serv_set_buddyicon(GaimConnection *gc, const char *filename); void serv_got_typing_stopped(GaimConnection *gc, const char *name); void serv_got_im(GaimConnection *gc, const char *who, const char *msg, - GaimConvImFlags imflags, time_t mtime); + GaimMessageFlags flags, time_t mtime); void serv_got_chat_invite(GaimConnection *gc, const char *name, const char *who, const char *message, GHashTable *data); @@ -64,7 +64,7 @@ int id, const char *name); void serv_got_chat_left(GaimConnection *g, int id); void serv_got_chat_in(GaimConnection *g, int id, const char *who, - GaimConvChatFlags chatflags, const char *message, time_t mtime); + GaimMessageFlags flags, const char *message, time_t mtime); void serv_send_file(GaimConnection *gc, const char *who, const char *file); void serv_voice_chat(GaimConnection *gc, const char *who);