Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/hooks.c @ 141:6533a231a65e
[/trunk] Changeset 153 by mikael
* We now rebuild the buddy list when receiving a message from an
offline/invisible buddy.
author | mikael |
---|---|
date | Thu, 28 Apr 2005 20:34:40 +0000 |
parents | cfd3df636d5f |
children | 50f23c38743a |
comparison
equal
deleted
inserted
replaced
140:3b480b73df19 | 141:6533a231a65e |
---|---|
28 | 28 |
29 | 29 |
30 inline void hk_message_in(const char *jid, time_t timestamp, const char *msg) | 30 inline void hk_message_in(const char *jid, time_t timestamp, const char *msg) |
31 { | 31 { |
32 char *buffer = utf8_decode(msg); | 32 char *buffer = utf8_decode(msg); |
33 // XXX Maybe filter out special chars? | 33 int new_guy = FALSE; |
34 | |
35 // If this user isn't in the roster, we add it | |
36 if (!roster_exists(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT)) { | |
37 roster_add_user(jid, NULL, NULL, ROSTER_TYPE_USER); | |
38 new_guy = TRUE; | |
39 } | |
40 | |
34 scr_WriteIncomingMessage(jid, buffer); | 41 scr_WriteIncomingMessage(jid, buffer); |
35 hlog_write_message(jid, timestamp, FALSE, buffer); | 42 hlog_write_message(jid, timestamp, FALSE, buffer); |
36 free(buffer); | 43 free(buffer); |
44 if (new_guy) { | |
45 buddylist_build(); | |
46 update_roster = TRUE; | |
47 } | |
37 } | 48 } |
38 | 49 |
39 inline void hk_message_out(const char *jid, time_t timestamp, const char *msg) | 50 inline void hk_message_out(const char *jid, time_t timestamp, const char *msg) |
40 { | 51 { |
41 scr_WriteOutgoingMessage(jid, msg); | 52 scr_WriteOutgoingMessage(jid, msg); |