Mercurial > pidgin
changeset 10246:a66cf83552dc
[gaim-migrate @ 11386]
I changed gaim_find_conversation and gaim_find_conversation_with_account
The first parameter is now one of GAIM_CONV_IM, GAIM_CONV_CHAT or
GAIM_CONV_ANY. Unfortunately, this changes a bajillion files.
Please look over this and make sure I use the correct type everywhere.
Especially in Novell and MSN, and somewhat in SILC.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 23 Nov 2004 06:14:15 +0000 |
parents | c143a3fac58d |
children | a05868a7920e |
files | ChangeLog plugins/ChangeLog.API plugins/filectl.c plugins/gevolution/gevo-util.c plugins/notify.c plugins/perl/common/Conversation.xs plugins/statenotify.c plugins/tcl/tcl_cmds.c src/blist.c src/buddyicon.c src/conversation.c src/conversation.h src/ft.c src/gtkblist.c src/gtkconv.c src/gtkdialogs.c src/gtkpounce.c src/protocols/irc/cmds.c src/protocols/irc/msgs.c src/protocols/msn/switchboard.c src/protocols/novell/novell.c src/protocols/oscar/oscar.c src/protocols/silc/buddy.c src/protocols/silc/chat.c src/protocols/silc/ops.c src/protocols/silc/silc.c src/protocols/silc/silcgaim.h src/protocols/yahoo/yahoo.c src/protocols/zephyr/zephyr.c src/server.c |
diffstat | 30 files changed, 197 insertions(+), 148 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Nov 23 05:53:59 2004 +0000 +++ b/ChangeLog Tue Nov 23 06:14:15 2004 +0000 @@ -15,6 +15,8 @@ Bug fixes: * People using input methods can now use Enter again. + * Many problems related to having an IM conversation and a chat open + with the same name (Andrew Hart) Preference changes: * Removed "Dim idle buddies" buddy list preference, default to "Yes."
--- a/plugins/ChangeLog.API Tue Nov 23 05:53:59 2004 +0000 +++ b/plugins/ChangeLog.API Tue Nov 23 06:14:15 2004 +0000 @@ -8,6 +8,8 @@ /gaim/gtk/sound/mute preference) * Changed: gtk_imhtml_toolbar now descends from GtkHBox making it easier to add your own widgets to it + * Changed: gaim_find_conversation, added a "type" parameter + * Changed: gaim_find_conversation_with_account, added a "type" parameter Signals: * Changed: "received-im-msg and "received-chat-msg" to match, both
--- a/plugins/filectl.c Tue Nov 23 05:53:59 2004 +0000 +++ b/plugins/filectl.c Tue Nov 23 06:14:15 2004 +0000 @@ -89,7 +89,7 @@ GaimConversation *c; arg1 = getarg(buffer, 1, 0); arg2 = getarg(buffer, 2, 1); - c = gaim_find_conversation(arg1); + c = gaim_find_conversation(GAIM_CONV_ANY, arg1); if (c) { /* disable for now
--- a/plugins/gevolution/gevo-util.c Tue Nov 23 05:53:59 2004 +0000 +++ b/plugins/gevolution/gevo-util.c Tue Nov 23 06:14:15 2004 +0000 @@ -33,7 +33,7 @@ GaimBuddy *buddy; GaimGroup *group; - conv = gaim_find_conversation_with_account(screenname, account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, screenname, account); if ((group = gaim_find_group(group_name)) == NULL) {
--- a/plugins/notify.c Tue Nov 23 05:53:59 2004 +0000 +++ b/plugins/notify.c Tue Nov 23 06:14:15 2004 +0000 @@ -234,7 +234,7 @@ GaimConversation *conv = NULL; if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { - conv = gaim_find_conversation_with_account(receiver, account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, receiver, account); unnotify(conv, TRUE); } }
--- a/plugins/perl/common/Conversation.xs Tue Nov 23 05:53:59 2004 +0000 +++ b/plugins/perl/common/Conversation.xs Tue Nov 23 06:14:15 2004 +0000 @@ -99,7 +99,7 @@ const char *name Gaim::Account account CODE: - RETVAL = gaim_find_conversation_with_account(name, account); + RETVAL = gaim_find_conversation_with_account(GAIM_CONV_ANY, name, account); OUTPUT: RETVAL
--- a/plugins/statenotify.c Tue Nov 23 05:53:59 2004 +0000 +++ b/plugins/statenotify.c Tue Nov 23 06:14:15 2004 +0000 @@ -20,7 +20,8 @@ char buf[256]; char *escaped; - conv = gaim_find_conversation_with_account(buddy->name, buddy->account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, + buddy->name, buddy->account); if (conv == NULL) return; @@ -75,10 +76,10 @@ ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_away", _("Buddy Goes _Away")); gaim_plugin_pref_frame_add(frame, ppref); - + ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_idle", _("Buddy Goes _Idle")); gaim_plugin_pref_frame_add(frame, ppref); - + return frame; }
--- a/plugins/tcl/tcl_cmds.c Tue Nov 23 05:53:59 2004 +0000 +++ b/plugins/tcl/tcl_cmds.c Tue Nov 23 06:14:15 2004 +0000 @@ -516,9 +516,9 @@ return error; } if (account != NULL) { - convo = gaim_find_conversation_with_account(Tcl_GetString(objv[argsused]), account); + convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, Tcl_GetString(objv[argsused]), account); } else { - convo = gaim_find_conversation(Tcl_GetString(objv[argsused])); + convo = gaim_find_conversation(GAIM_CONV_ANY, Tcl_GetString(objv[argsused])); } Tcl_SetIntObj(result, (int)convo); break;
--- a/src/blist.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/blist.c Tue Nov 23 06:14:15 2004 +0000 @@ -262,7 +262,8 @@ if (ops && ops->update) ops->update(gaimbuddylist, (GaimBlistNode*)buddy); - conv = gaim_find_conversation_with_account(buddy->name, buddy->account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, buddy->name, + buddy->account); if (conv) { if (buddy->present == GAIM_BUDDY_ONLINE) gaim_conversation_update(conv, GAIM_CONV_ACCOUNT_ONLINE); @@ -425,7 +426,8 @@ if (ops && ops->update) ops->update(gaimbuddylist, (GaimBlistNode *)buddy); - conv = gaim_find_conversation_with_account(buddy->name, buddy->account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, buddy->name, + buddy->account); if (conv) gaim_conversation_autoset_title(conv); } @@ -448,7 +450,8 @@ if (ops && ops->update) ops->update(gaimbuddylist, (GaimBlistNode *)buddy); - conv = gaim_find_conversation_with_account(buddy->name, buddy->account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, buddy->name, + buddy->account); if (conv) gaim_conversation_autoset_title(conv); }
--- a/src/buddyicon.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/buddyicon.c Tue Nov 23 06:14:15 2004 +0000 @@ -105,8 +105,8 @@ account = gaim_buddy_icon_get_account(icon); username = gaim_buddy_icon_get_username(icon); - conv = gaim_find_conversation_with_account(username, account); - if (conv != NULL && gaim_conversation_get_type(conv) == GAIM_CONV_IM) + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, username, account); + if (conv != NULL) gaim_conv_im_set_icon(GAIM_CONV_IM(conv), NULL); for (list = sl = gaim_find_buddies(account, username); sl != NULL; @@ -190,9 +190,9 @@ g_slist_free(list); - conv = gaim_find_conversation_with_account(username, account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, username, account); - if (conv != NULL && gaim_conversation_get_type(conv) == GAIM_CONV_IM) + if (conv != NULL) gaim_conv_im_set_icon(GAIM_CONV_IM(conv), icon); }
--- a/src/conversation.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/conversation.c Tue Nov 23 06:14:15 2004 +0000 @@ -754,8 +754,7 @@ g_return_val_if_fail(name != NULL, NULL); /* Check if this conversation already exists. */ - if (((conv = gaim_find_conversation_with_account(name, account)) != NULL) && - (gaim_conversation_get_type(conv) == type)) + if ((conv = gaim_find_conversation_with_account(type, name, account)) != NULL) { if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT || gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) @@ -1320,50 +1319,63 @@ } -/* This is deprecated, right? */ +/* + * This is deprecated, right? --SomeOne + * + * I don't know, I could see uses for it. Specifically, a plugin + * that wants to know if you're talking to a specific person. + * --KingAnt + */ GaimConversation * -gaim_find_conversation(const char *name) +gaim_find_conversation(GaimConversationType type, + const char *name) { GaimConversation *c = NULL; - char *cuser; + gchar *name1; + const gchar *name2; GList *cnv; g_return_val_if_fail(name != NULL, NULL); - cuser = g_strdup(gaim_normalize(NULL, name)); + name1 = g_strdup(gaim_normalize(NULL, name)); for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) { c = (GaimConversation *)cnv->data; - - if (!gaim_utf8_strcasecmp(cuser, gaim_normalize(NULL, gaim_conversation_get_name(c)))) + name2 = gaim_normalize(NULL, gaim_conversation_get_name(c)); + + if ((type == gaim_conversation_get_type(c)) && + !gaim_utf8_strcasecmp(name1, name2)) break; c = NULL; } - g_free(cuser); + g_free(name1); return c; } GaimConversation * -gaim_find_conversation_with_account(const char *name, +gaim_find_conversation_with_account(GaimConversationType type, + const char *name, const GaimAccount *account) { GaimConversation *c = NULL; - char *cuser; + gchar *name1; + const gchar *name2; GList *cnv; g_return_val_if_fail(name != NULL, NULL); - cuser = g_strdup(gaim_normalize(account, name)); + name1 = g_strdup(gaim_normalize(account, name)); for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) { c = (GaimConversation *)cnv->data; - - if (!gaim_utf8_strcasecmp(cuser, - gaim_normalize(account, gaim_conversation_get_name(c))) && - account == gaim_conversation_get_account(c)) { + name2 = gaim_normalize(account, gaim_conversation_get_name(c)); + + if ((type == gaim_conversation_get_type(c)) && + (account == gaim_conversation_get_account(c)) && + !gaim_utf8_strcasecmp(name1, name2)) { break; } @@ -1371,7 +1383,7 @@ c = NULL; } - g_free(cuser); + g_free(name1); return c; } @@ -1713,13 +1725,18 @@ g_return_val_if_fail(account !=NULL, FALSE); g_return_val_if_fail(what != NULL, FALSE); - conv = gaim_find_conversation_with_account(who, account); + conv = gaim_find_conversation_with_account(GAIM_CONV_ANY, who, account); if (conv != NULL) gaim_conversation_write(conv, NULL, what, GAIM_MESSAGE_ERROR, time(NULL)); else return FALSE; window = gaim_conversation_get_window(conv); - if (!gaim_conv_window_has_focus(window)) /* don't change the active conversation if the user is using this window */ + + /* + * Change the active conversation to this conversation unless the + * user is already using this window. + */ + if (!gaim_conv_window_has_focus(window)) gaim_conv_window_switch_conversation(window, gaim_conversation_get_index(conv)); gaim_conv_window_raise(window);
--- a/src/conversation.h Tue Nov 23 05:53:59 2004 +0000 +++ b/src/conversation.h Tue Nov 23 06:14:15 2004 +0000 @@ -47,7 +47,8 @@ GAIM_CONV_UNKNOWN = 0, /**< Unknown conversation type. */ GAIM_CONV_IM, /**< Instant Message. */ GAIM_CONV_CHAT, /**< Chat room. */ - GAIM_CONV_MISC /**< A misc. conversation. */ + GAIM_CONV_MISC, /**< A misc. conversation. */ + GAIM_CONV_ANY /**< Any type of conversation. */ } GaimConversationType; @@ -783,24 +784,30 @@ GList *gaim_get_chats(void); /** - * Finds the conversation with the specified name. + * Finds the conversation with the specified type and name. In most + * cases you should use gaim_find_conversation_with_account() instead + * of this. * + * @param type The type of the conversation. * @param name The name of the conversation. * * @return The conversation if found, or @c NULL otherwise. */ -GaimConversation *gaim_find_conversation(const char *name); +GaimConversation *gaim_find_conversation(GaimConversationType type, + const char *name); /** - * Finds a conversation with the specified name and user. + * Finds a conversation with the specified type, name, and Gaim account. * + * @param type The type of the conversation. * @param name The name of the conversation. * @param account The gaim_account associated with the conversation. * * @return The conversation if found, or @c NULL otherwise. */ GaimConversation *gaim_find_conversation_with_account( - const char *name, const GaimAccount *account); + GaimConversationType type, const char *name, + const GaimAccount *account); /** * Writes to a conversation window.
--- a/src/ft.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/ft.c Tue Nov 23 06:14:15 2004 +0000 @@ -123,7 +123,8 @@ g_return_if_fail(xfer != NULL); g_return_if_fail(message != NULL); - conv = gaim_find_conversation_with_account(xfer->who, gaim_xfer_get_account(xfer)); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, xfer->who, + gaim_xfer_get_account(xfer)); if (conv == NULL) return;
--- a/src/gtkblist.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/gtkblist.c Tue Nov 23 06:14:15 2004 +0000 @@ -3883,8 +3883,6 @@ if (*whoalias == '\0') whoalias = NULL; - c = gaim_find_conversation_with_account(who, data->account); - if ((g = gaim_find_group(grp)) == NULL) { g = gaim_group_new(grp); @@ -3908,6 +3906,7 @@ * and gaim_blist_add_buddy(). Or something. --Mark */ + c = gaim_find_conversation_with_account(GAIM_CONV_IM, who, data->account); if (c != NULL) { gaim_buddy_icon_update(gaim_conv_im_get_icon(GAIM_CONV_IM(c))); gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD); @@ -4094,9 +4093,11 @@ if (GAIM_PLUGIN_PROTOCOL_INFO(data->account->gc->prpl)->get_chat_name != NULL) chat_name = GAIM_PLUGIN_PROTOCOL_INFO( data->account->gc->prpl)->get_chat_name(chat->components); - + if (chat_name != NULL) { - conv = gaim_find_conversation_with_account(chat_name, data->account); + conv = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + chat_name, + data->account); g_free(chat_name); }
--- a/src/gtkconv.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/gtkconv.c Tue Nov 23 06:14:15 2004 +0000 @@ -1276,7 +1276,7 @@ if(!real_who) return; - conv2 = gaim_find_conversation_with_account(real_who, account); + conv2 = gaim_find_conversation_with_account(GAIM_CONV_IM, real_who, account); if (conv2 != NULL) gaim_conv_window_show(gaim_conversation_get_window(conv2)); @@ -4317,7 +4317,7 @@ * just move the conv to this window. Otherwise, create a new * conv and add it to this window. */ - c = gaim_find_conversation(b->name); + c = gaim_find_conversation(GAIM_CONV_IM, b->name); if (c != NULL) { GaimConvWindow *oldwin; oldwin = gaim_conversation_get_window(c);
--- a/src/gtkdialogs.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/gtkdialogs.c Tue Nov 23 06:14:15 2004 +0000 @@ -381,7 +381,7 @@ g_return_if_fail(account != NULL); g_return_if_fail(username != NULL); - conv = gaim_find_conversation_with_account(username, account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, username, account); if (conv == NULL) conv = gaim_conversation_new(GAIM_CONV_IM, account, username); @@ -765,7 +765,9 @@ GaimConversation *conv; buddy = (GaimBuddy*)bnode; bnode = bnode->next; - conv = gaim_find_conversation_with_account(buddy->name, buddy->account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, + buddy->name, + buddy->account); if (gaim_account_is_connected(buddy->account)) { serv_remove_buddy(buddy->account->gc, buddy, group); gaim_blist_remove_buddy(buddy); @@ -807,6 +809,7 @@ g_free(text); } +/* XXX - Some of this should be moved into the core, methinks. */ static void gaim_gtkdialogs_remove_buddy_cb(GaimBuddy *buddy) { @@ -824,8 +827,7 @@ serv_remove_buddy(buddy->account->gc, buddy, group); gaim_blist_remove_buddy(buddy); - conv = gaim_find_conversation_with_account(name, account); - + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, name, account); if (conv != NULL) gaim_conversation_update(conv, GAIM_CONV_UPDATE_REMOVE); @@ -864,7 +866,7 @@ gaim_blist_remove_chat(chat); if (name != NULL) { - conv = gaim_find_conversation_with_account(name, account); + conv = gaim_find_conversation_with_account(GAIM_CONV_CHAT, name, account); g_free(name); }
--- a/src/gtkpounce.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/gtkpounce.c Tue Nov 23 06:14:15 2004 +0000 @@ -939,7 +939,7 @@ if (gaim_pounce_action_is_enabled(pounce, "open-window")) { - conv = gaim_find_conversation_with_account(pouncee, account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, pouncee, account); if (conv == NULL) conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee); @@ -999,7 +999,7 @@ if (message != NULL) { - conv = gaim_find_conversation_with_account(pouncee, account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, pouncee, account); if (conv == NULL) conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee);
--- a/src/protocols/irc/cmds.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/irc/cmds.c Tue Nov 23 06:14:15 2004 +0000 @@ -34,7 +34,7 @@ int irc_cmd_default(struct irc_conn *irc, const char *cmd, const char *target, const char **args) { - GaimConversation *convo = gaim_find_conversation_with_account(target, irc->account); + GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, target, irc->account); char *buf; if (!convo) @@ -110,7 +110,7 @@ g_free(newargs[1]); g_free(newargs); - convo = gaim_find_conversation_with_account(target, irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, target, irc->account); if (convo) { action = g_strdup_printf("/me %s", args[0]); if (action[strlen(action) - 1] == '\n') @@ -167,8 +167,8 @@ if (!args || !args[0]) return 0; - convo = gaim_find_conversation_with_account(target, irc->account); - if (!convo || gaim_conversation_get_type(convo) != GAIM_CONV_CHAT) + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, target, irc->account); + if (!convo) return 0; if (args[1]) @@ -436,8 +436,8 @@ if (!args) return 0; - convo = gaim_find_conversation_with_account(target, irc->account); - if (!convo || gaim_conversation_get_type(convo) != GAIM_CONV_CHAT) + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, target, irc->account); + if (!convo) return 0; if (!args[0]) {
--- a/src/protocols/irc/msgs.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/irc/msgs.c Tue Nov 23 06:14:15 2004 +0000 @@ -118,7 +118,7 @@ if (!args || !args[1] || !args[2]) return; - convo = gaim_find_conversation_with_account(args[1], irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); if (!convo) /* XXX punt on channels we are not in for now */ return; @@ -271,7 +271,7 @@ topic = irc_mirc2txt (args[2]); } - convo = gaim_find_conversation_with_account(chan, irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, chan, irc->account); if (!convo) { gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan); } @@ -316,7 +316,7 @@ GaimConversation *convo; if (!strcmp(name, "366")) { - convo = gaim_find_conversation_with_account(irc->nameconv ? irc->nameconv : args[1], irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, irc->nameconv ? irc->nameconv : args[1], irc->account); if (!convo) { gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a NAMES list for %s, which doesn't exist\n", args[2]); g_string_free(irc->names, TRUE); @@ -431,7 +431,7 @@ GaimConnection *gc; GaimConversation *convo; - convo = gaim_find_conversation_with_account(args[1], irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, args[1], irc->account); if (convo) { if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) /* does this happen? */ gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], _("no such channel"), @@ -456,7 +456,7 @@ GaimConnection *gc; GaimConversation *convo; - convo = gaim_find_conversation_with_account(args[1], irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); if (convo) { gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], args[2], GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); } else { @@ -468,7 +468,7 @@ void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args) { - GaimConversation *convo = gaim_find_conversation_with_account(args[1], irc->account); + GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); gaim_debug(GAIM_DEBUG_INFO, "irc", "We're apparently not in %s, but tried to use it\n", args[1]); if (convo) { @@ -485,7 +485,7 @@ if (!args || !args[1] || !args[2]) return; - convo = gaim_find_conversation_with_account(args[1], irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); if (!convo) return; @@ -583,7 +583,7 @@ return; } - convo = gaim_find_conversation_with_account(args[0], irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); if (convo == NULL) { gaim_debug(GAIM_DEBUG_ERROR, "irc", "JOIN for %s failed\n", args[0]); g_free(nick); @@ -605,7 +605,7 @@ void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args) { GaimConnection *gc = gaim_account_get_connection(irc->account); - GaimConversation *convo = gaim_find_conversation_with_account(args[0], irc->account); + GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); char *nick = irc_mask_nick(from), *buf; if (!gc) { @@ -640,7 +640,7 @@ char *nick = irc_mask_nick(from), *buf; if (*args[0] == '#' || *args[0] == '&') { /* Channel */ - convo = gaim_find_conversation_with_account(args[0], irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); if (!convo) { gaim_debug(GAIM_DEBUG_ERROR, "irc", "MODE received for %s, which we are not in\n", args[0]); g_free(nick); @@ -769,7 +769,7 @@ if (!args || !args[0] || !gc) return; - convo = gaim_find_conversation_with_account(args[0], irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); if (!convo) { gaim_debug(GAIM_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", args[0]); return; @@ -822,7 +822,7 @@ msg = g_strdup_printf(_("PING reply -- Lag: %lu seconds"), time(NULL) - oldstamp); } - convo = gaim_find_conversation_with_account(parts[0], irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, parts[0], irc->account); g_strfreev(parts); if (convo) { if (gaim_conversation_get_type (convo) == GAIM_CONV_CHAT) @@ -876,7 +876,7 @@ } else if (notice) { serv_got_im(gc, nick, msg, 0, time(NULL)); } else { - convo = gaim_find_conversation_with_account(args[0], irc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); if (convo) serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)), nick, 0, msg, time(NULL)); else
--- a/src/protocols/msn/switchboard.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/msn/switchboard.c Tue Nov 23 06:14:15 2004 +0000 @@ -116,7 +116,9 @@ } else if (swboard->conv == NULL) { - swboard->conv = gaim_find_conversation_with_account(user, account); + /* XXX - I think this should probably be GAIM_CONV_CHAT, but I'm hedging */ + swboard->conv = gaim_find_conversation_with_account(GAIM_CONV_ANY, + user, account); } else { @@ -149,7 +151,9 @@ account = swboard->session->account; - return gaim_find_conversation_with_account(swboard->im_user, account); + /* XXX - I think this should probably be GAIM_CONV_IM, but I'm hedging */ + return gaim_find_conversation_with_account(GAIM_CONV_IM, + swboard->im_user, account); } void
--- a/src/protocols/novell/novell.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/novell/novell.c Tue Nov 23 06:14:15 2004 +0000 @@ -194,7 +194,9 @@ if (user_record) { /* Set the title for the conversation */ - gconv = gaim_find_conversation_with_account(nm_user_record_get_display_id(user_record), + /* XXX - Should this be GAIM_CONV_IM? */ + gconv = gaim_find_conversation_with_account(GAIM_CONV_ANY, + nm_user_record_get_display_id(user_record), (GaimAccount *) user->client_data); if (gconv) { @@ -1760,7 +1762,7 @@ text, imflags, nm_event_get_gmt(event)); - gconv = gaim_find_conversation_with_account( + gconv = gaim_find_conversation_with_account(GAIM_CONV_IM, nm_user_record_get_display_id(user_record), (GaimAccount *) user->client_data); if (gconv) { @@ -2034,8 +2036,10 @@ ur = nm_find_user_record(user, nm_event_get_source(event)); if (ur) { + /* XXX - Should this be GAIM_CONV_IM? */ gconv = - gaim_find_conversation_with_account(nm_user_record_get_display_id(ur), + gaim_find_conversation_with_account(GAIM_CONV_ANY, + nm_user_record_get_display_id(ur), user->client_data); if (gconv) { const char *name = nm_user_record_get_full_name(ur);
--- a/src/protocols/oscar/oscar.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/oscar/oscar.c Tue Nov 23 06:14:15 2004 +0000 @@ -900,7 +900,8 @@ else g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), dim->name); - conv = gaim_find_conversation_with_account(dim->name, gaim_connection_get_account(dim->gc)); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, dim->name, + gaim_connection_get_account(dim->gc)); if (conv) { gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); gaim_conversation_update_progress(conv, 0); @@ -1151,7 +1152,8 @@ dim->watcher = 0; } - c = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); + c = gaim_find_conversation_with_account(GAIM_CONV_IM, sn, + gaim_connection_get_account(gc)); if (c != NULL) gaim_conversation_update_progress(c, percent); dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, @@ -5345,9 +5347,10 @@ static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags 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); int ret = 0; - const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); + const char *iconfile = gaim_account_get_buddy_icon(account); char *tmpmsg = NULL, *tmpmsg2 = NULL; if (dim && dim->connected) { @@ -5358,7 +5361,9 @@ struct aim_sendimext_args args; struct stat st; gsize len; - GaimConversation *conv = gaim_find_conversation_with_account(name, gaim_connection_get_account(gc)); + GaimConversation *conv; + + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, name, account); if (strstr(message, "<IMG ")) gaim_conversation_write(conv, "", @@ -5366,10 +5371,10 @@ "You must be Direct Connected to send IM Images."), GAIM_MESSAGE_ERROR, time(NULL)); - bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); + bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, name)); if (!bi) { bi = g_new0(struct buddyinfo, 1); - g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, name)), bi); + g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, name)), bi); } args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; @@ -5431,7 +5436,7 @@ */ if (aim_sn_is_icq(name) ) { /* being sent to an ICQ user */ - if (!aim_sn_is_icq(gaim_account_get_username(gc->account))) { + if (!aim_sn_is_icq(gaim_account_get_username(account))) { /* from an AIM user - ICQ receiving from AIM *expects the messsage to be HTML formatted* */ tmpmsg = gaim_str_add_cr(message); } else { @@ -5440,7 +5445,7 @@ } } else { /* being sent to an AIM user */ - if (aim_sn_is_icq(gaim_account_get_username(gc->account))) { + if (aim_sn_is_icq(gaim_account_get_username(account))) { /* from an ICQ user */ tmpmsg2 = gaim_strdup_withhtml(message); tmpmsg = gaim_escape_html(tmpmsg2);
--- a/src/protocols/silc/buddy.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/silc/buddy.c Tue Nov 23 06:14:15 2004 +0000 @@ -93,8 +93,8 @@ silc_ske_free_key_material(key); /* Open IM window */ - convo = gaim_find_conversation_with_account(client_entry->nickname, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_IM, + client_entry->nickname, sg->account); if (convo) gaim_conv_window_show(gaim_conversation_get_window(convo)); else
--- a/src/protocols/silc/chat.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/silc/chat.c Tue Nov 23 06:14:15 2004 +0000 @@ -967,8 +967,8 @@ /* Add channel to Gaim */ channel->context = SILC_32_TO_PTR(++sg->channel_ids); serv_got_joined_chat(gc, sg->channel_ids, channel->channel_name); - convo = gaim_find_conversation_with_account(channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + channel->channel_name, sg->account); if (!convo) return;
--- a/src/protocols/silc/ops.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/silc/ops.c Tue Nov 23 06:14:15 2004 +0000 @@ -63,14 +63,14 @@ for (l = sg->grps; l; l = l->next) if (((SilcGaimPrvgrp)l->data)->key == key) { prv = l->data; - convo = gaim_find_conversation_with_account(prv->channel, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + prv->channel, sg->account); break; } } if (!convo) - convo = gaim_find_conversation_with_account(channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + channel->channel_name, sg->account); if (!convo) return; @@ -149,7 +149,9 @@ return; if (sender->nickname) - convo = gaim_find_conversation_with_account(sender->nickname, sg->account); + /* XXX - Should this be GAIM_CONV_IM? */ + convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, + sender->nickname, sg->account); if (flags & SILC_MESSAGE_FLAG_SIGNED && gaim_prefs_get_bool("/plugins/prpl/silc/verify_im")) { @@ -263,8 +265,8 @@ if (client_entry == conn->local_entry) break; - convo = gaim_find_conversation_with_account(channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + channel->channel_name, sg->account); if (!convo) break; @@ -280,8 +282,8 @@ client_entry = va_arg(va, SilcClientEntry); channel = va_arg(va, SilcChannelEntry); - convo = gaim_find_conversation_with_account(channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + channel->channel_name, sg->account); if (!convo) break; @@ -301,8 +303,8 @@ /* Remove from all channels */ silc_hash_table_list(client_entry->channels, &htl); while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = gaim_find_conversation_with_account(chu->channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + chu->channel->channel_name, sg->account); if (!convo) continue; gaim_conv_chat_remove_user(GAIM_CONV_CHAT(convo), @@ -321,8 +323,8 @@ tmp = va_arg(va, char *); channel = va_arg(va, SilcChannelEntry); - convo = gaim_find_conversation_with_account(channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + channel->channel_name, sg->account); if (!convo) break; @@ -379,8 +381,8 @@ /* Change nick on all channels */ silc_hash_table_list(client_entry2->channels, &htl); while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = gaim_find_conversation_with_account(chu->channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + chu->channel->channel_name, sg->account); if (!convo) continue; if (gaim_conv_chat_find_user(GAIM_CONV_CHAT(convo), client_entry->nickname)) @@ -403,8 +405,8 @@ buffer = va_arg(va, SilcBuffer); channel = va_arg(va, SilcChannelEntry); - convo = gaim_find_conversation_with_account(channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + channel->channel_name, sg->account); if (!convo) break; @@ -440,8 +442,8 @@ client_entry2 = va_arg(va, SilcClientEntry); channel = va_arg(va, SilcChannelEntry); - convo = gaim_find_conversation_with_account(channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + channel->channel_name, sg->account); if (!convo) break; @@ -486,8 +488,8 @@ client_entry2 = va_arg(va, SilcClientEntry); channel = va_arg(va, SilcChannelEntry); - convo = gaim_find_conversation_with_account(channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + channel->channel_name, sg->account); if (!convo) break; @@ -541,8 +543,8 @@ /* Remove us from all channels */ silc_hash_table_list(client_entry->channels, &htl); while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = gaim_find_conversation_with_account(chu->channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + chu->channel->channel_name, sg->account); if (!convo) continue; gaim_conv_chat_write(GAIM_CONV_CHAT(convo), client_entry->nickname, @@ -572,8 +574,8 @@ /* Remove user from all channels */ silc_hash_table_list(client_entry->channels, &htl); while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = gaim_find_conversation_with_account(chu->channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + chu->channel->channel_name, sg->account); if (!convo) continue; gaim_conv_chat_remove_user(GAIM_CONV_CHAT(convo), @@ -605,8 +607,8 @@ silc_hash_table_list(clients[i]->channels, &htl); while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { convo = - gaim_find_conversation_with_account(chu->channel->channel_name, - sg->account); + gaim_find_conversation_with_account(GAIM_CONV_CHAT, + chu->channel->channel_name, sg->account); if (!convo) continue; gaim_conv_chat_remove_user(GAIM_CONV_CHAT(convo), @@ -1172,20 +1174,14 @@ channel = va_arg(vp, SilcChannelEntry); - convo = gaim_find_conversation_with_account(channel->channel_name, - sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + channel->channel_name, sg->account); if (!convo) { gaim_debug_error("silc", "Got a topic for %s, which doesn't exist\n", channel->channel_name); break; } - if (gaim_conversation_get_type(convo) != GAIM_CONV_CHAT) { - gaim_debug_error("silc", "Got a topic for %s, which isn't a chat\n", - channel->channel_name); - break; - } - /* Set topic */ if (channel->topic) gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, channel->topic); @@ -1213,9 +1209,9 @@ /* Change nick on all channels */ silc_hash_table_list(local_entry->channels, &htl); while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = gaim_find_conversation_with_account(chu->channel->channel_name, - sg->account); - if (!convo || (gaim_conversation_get_type(convo) != GAIM_CONV_CHAT)) + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + chu->channel->channel_name, sg->account); + if (!convo) continue; oldnick = gaim_conv_chat_get_nick(GAIM_CONV_CHAT(convo)); if (strcmp(oldnick, local_entry->nickname)) {
--- a/src/protocols/silc/silc.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/silc/silc.c Tue Nov 23 06:14:15 2004 +0000 @@ -842,7 +842,8 @@ char tmp[256], *nickname = NULL; SilcClientEntry client_entry; - convo = gaim_find_conversation_with_account(im->nick, sg->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_IM, im->nick, + sg->account); if (!convo) return; @@ -979,15 +980,11 @@ return GAIM_CMD_RET_FAILED; if(args && args[0]) { - convo = gaim_find_conversation_with_account(args[0], gc->account); + convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], + gc->account); } else convo = conv; - if (gaim_conversation_get_type(convo) != GAIM_CONV_CHAT) { - *error = g_strdup(_("Failed to leave channel")); - return GAIM_CMD_RET_FAILED; - } - id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)); if (id == 0)
--- a/src/protocols/silc/silcgaim.h Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/silc/silcgaim.h Tue Nov 23 06:14:15 2004 +0000 @@ -24,15 +24,16 @@ #include "internal.h" #include "account.h" #include "accountopt.h" +#include "cmds.h" +#include "conversation.h" #include "debug.h" +#include "ft.h" #include "notify.h" #include "prpl.h" #include "request.h" +#include "roomlist.h" #include "server.h" #include "util.h" -#include "roomlist.h" -#include "ft.h" -#include "cmds.h" /* Default public and private key file names */ #define SILCGAIM_PUBLIC_KEY_NAME "public_key.pub"
--- a/src/protocols/yahoo/yahoo.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/yahoo/yahoo.c Tue Nov 23 06:14:15 2004 +0000 @@ -1810,7 +1810,8 @@ serv_add_deny(account->gc, name); - conv = gaim_find_conversation_with_account(name, account); + /* The follow should really be done by the core... */ + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, name, account); if (conv != NULL) gaim_conversation_update(conv, GAIM_CONV_UPDATE_REMOVE);
--- a/src/protocols/zephyr/zephyr.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/protocols/zephyr/zephyr.c Tue Nov 23 06:14:15 2004 +0000 @@ -852,7 +852,8 @@ serv_got_chat_in(gc, zt2->id, send_inst_utf8, 0, buf3, time(NULL)); g_free(send_inst); - gconv1 = gaim_find_conversation_with_account(zt2->name, gc->account); + gconv1 = gaim_find_conversation_with_account(GAIM_CONV_CHAT, + zt2->name, gc->account); gcc = gaim_conversation_get_chat_data(gconv1); if (!gaim_conv_chat_find_user(gcc, sendertmp)) { @@ -1956,7 +1957,8 @@ sig = zephyr_get_signature(); - gconv1 = gaim_find_conversation_with_account(zt->name, gc->account); + gconv1 = gaim_find_conversation_with_account(GAIM_CONV_CHAT, zt->name, + gc->account); gcc = gaim_conversation_get_chat_data(gconv1); if (!(inst = (char *)gaim_conv_chat_get_topic(gcc))) @@ -2434,7 +2436,8 @@ /* find_sub_by_id can return NULL */ if (!zt) return; - gconv = gaim_find_conversation_with_account(zt->name, gc->account); + gconv = gaim_find_conversation_with_account(GAIM_CONV_CHAT, zt->name, + gc->account); gcc = gaim_conversation_get_chat_data(gconv); topic_utf8 = zephyr_recv_convert(gc,(gchar *)topic,strlen(topic));
--- a/src/server.c Tue Nov 23 05:53:59 2004 +0000 +++ b/src/server.c Tue Nov 23 06:14:15 2004 +0000 @@ -267,7 +267,7 @@ account = gaim_connection_get_account(gc); presence = gaim_account_get_presence(account); - conv = gaim_find_conversation_with_account(name, gc->account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, name, gc->account); if (prpl_info && prpl_info->send_im) val = prpl_info->send_im(gc, name, message, imflags); @@ -463,7 +463,7 @@ b = buds->data; gaim_blist_server_alias_buddy(b, alias); - conv = gaim_find_conversation_with_account(b->name, account); + conv = gaim_find_conversation_with_account(GAIM_CONV_IM, b->name, account); if (conv != NULL && b->server_alias != NULL && strcmp(b->server_alias, alias)) @@ -790,7 +790,7 @@ * We should update the conversation window buttons and menu, * if it exists. */ - cnv = gaim_find_conversation_with_account(who, gc->account); + cnv = gaim_find_conversation_with_account(GAIM_CONV_IM, who, gc->account); /* * Plugin stuff. we pass a char ** but we don't want to pass what's @@ -1024,7 +1024,7 @@ #if 0 if (docklet_count && gaim_prefs_get_bool("/plugins/gtk/docklet/queue_messages") && - !gaim_find_conversation_with_account(name, gc->account)) { + !gaim_find_conversation_with_account(GAIM_CONV_IM, name, gc->account)) { /* * We're gonna queue it up and wait for the user to ask for * it... probably by clicking the docklet or windows tray icon. @@ -1058,9 +1058,10 @@ GaimTypingState state) { GaimBuddy *b; - GaimConversation *cnv = gaim_find_conversation_with_account(name, gc->account); + GaimConversation *cnv; GaimConvIm *im; + cnv = gaim_find_conversation_with_account(GAIM_CONV_IM, name, gc->account); if (!cnv) return; @@ -1092,10 +1093,11 @@ void serv_got_typing_stopped(GaimConnection *gc, const char *name) { - GaimConversation *c = gaim_find_conversation_with_account(name, gc->account); + GaimConversation *c; GaimConvIm *im; GaimBuddy *b; + c = gaim_find_conversation_with_account(GAIM_CONV_IM, name, gc->account); if (!c) return;