comparison mcabber/src/hooks.c @ 213:4fcdbfdf7c20

[/trunk] Changeset 225 by mikael * Fix a crash when renaming to a non-7bit name (same with group name) * Move all utf-8 usage to jabglue
author mikael
date Sun, 08 May 2005 20:27:14 +0000
parents 9c2023d60986
children 73f6ce668ba8
comparison
equal deleted inserted replaced
212:465d98d2f8e3 213:4fcdbfdf7c20
30 30
31 static char *extcommand; 31 static char *extcommand;
32 32
33 inline void hk_message_in(const char *jid, time_t timestamp, const char *msg) 33 inline void hk_message_in(const char *jid, time_t timestamp, const char *msg)
34 { 34 {
35 char *buffer = utf8_decode(msg);
36 int new_guy = FALSE; 35 int new_guy = FALSE;
37 36
38 // If this user isn't in the roster, we add it 37 // If this user isn't in the roster, we add it
39 if (!roster_exists(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT)) { 38 if (!roster_exists(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT)) {
40 roster_add_user(jid, NULL, NULL, ROSTER_TYPE_USER); 39 roster_add_user(jid, NULL, NULL, ROSTER_TYPE_USER);
42 } 41 }
43 42
44 // Note: the hlog_write should not be called first, because in some 43 // Note: the hlog_write should not be called first, because in some
45 // cases scr_WriteIncomingMessage() will load the history and we'd 44 // cases scr_WriteIncomingMessage() will load the history and we'd
46 // have the message twice... 45 // have the message twice...
47 scr_WriteIncomingMessage(jid, buffer, timestamp, 0); 46 scr_WriteIncomingMessage(jid, msg, timestamp, 0);
48 hlog_write_message(jid, timestamp, FALSE, buffer); 47 hlog_write_message(jid, timestamp, FALSE, msg);
49 hk_ext_cmd(jid, 'M', 'R', NULL); 48 hk_ext_cmd(jid, 'M', 'R', NULL);
50 free(buffer);
51 // We need to rebuild the list if the sender is unknown or 49 // We need to rebuild the list if the sender is unknown or
52 // if the sender is offline/invisible and hide_offline_buddies is set 50 // if the sender is offline/invisible and hide_offline_buddies is set
53 if (new_guy || 51 if (new_guy ||
54 (roster_getstatus(jid) == offline && buddylist_get_hide_offline_buddies())) 52 (roster_getstatus(jid) == offline && buddylist_get_hide_offline_buddies()))
55 { 53 {