comparison src/protocols/jabber/message.c @ 7318:02b713a5c7e2

[gaim-migrate @ 7904] don't rename chats when someone privately IMs you from one committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 23 Oct 2003 12:54:08 +0000
parents dd4b4a187171
children 803c7238f6d8
comparison
equal deleted inserted replaced
7317:9b303dd88cb2 7318:02b713a5c7e2
51 51
52 g_free(jm); 52 g_free(jm);
53 } 53 }
54 54
55 static GaimConversation * 55 static GaimConversation *
56 find_unnormalized_conv(const char *name, GaimAccount *account) 56 find_unnormalized_im(const char *name, GaimAccount *account)
57 { 57 {
58 GaimConversation *c = NULL; 58 GaimConversation *c = NULL;
59 GList *cnv; 59 GList *cnv;
60 60
61 g_return_val_if_fail(name != NULL, NULL); 61 g_return_val_if_fail(name != NULL, NULL);
62 62
63 for(cnv = gaim_get_conversations(); cnv; cnv = cnv->next) { 63 for(cnv = gaim_get_conversations(); cnv; cnv = cnv->next) {
64 c = (GaimConversation*)cnv->data; 64 c = (GaimConversation*)cnv->data;
65 if(!gaim_utf8_strcasecmp(name, gaim_conversation_get_name(c)) && 65 if(gaim_conversation_get_type(c) == GAIM_CONV_IM &&
66 !gaim_utf8_strcasecmp(name, gaim_conversation_get_name(c)) &&
66 account == gaim_conversation_get_account(c)) 67 account == gaim_conversation_get_account(c))
67 return c; 68 return c;
68 } 69 }
69 70
70 return NULL; 71 return NULL;
82 return; 83 return;
83 84
84 jb = jabber_buddy_find(jm->js, jm->from, TRUE); 85 jb = jabber_buddy_find(jm->js, jm->from, TRUE);
85 jbr = jabber_buddy_find_resource(jb, jid->resource); 86 jbr = jabber_buddy_find_resource(jb, jid->resource);
86 87
87 if(find_unnormalized_conv(jm->from, jm->js->gc->account)) { 88 if(find_unnormalized_im(jm->from, jm->js->gc->account)) {
88 from = g_strdup(jm->from); 89 from = g_strdup(jm->from);
89 } else if(jid->node) { 90 } else if(jid->node) {
90 GaimConversation *conv; 91 GaimConversation *conv;
91 92
92 from = g_strdup_printf("%s@%s", jid->node, jid->domain); 93 from = g_strdup_printf("%s@%s", jid->node, jid->domain);
93 conv = find_unnormalized_conv(from, jm->js->gc->account); 94 conv = find_unnormalized_im(from, jm->js->gc->account);
94 if(conv) 95 if(conv)
95 gaim_conversation_set_name(conv, jm->from); 96 gaim_conversation_set_name(conv, jm->from);
96 g_free(from); 97 g_free(from);
97 from = g_strdup(jm->from); 98 from = g_strdup(jm->from);
98 } else { 99 } else {