Mercurial > hg
comparison mcabber/src/hooks.c @ 325:ff6fb51bfd78
Handle "error" message type
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 16 Jul 2005 13:27:00 +0100 |
parents | 45076d02eeef |
children | c5a7a7273986 |
comparison
equal
deleted
inserted
replaced
324:c981455284d5 | 325:ff6fb51bfd78 |
---|---|
25 | 25 |
26 #include "hooks.h" | 26 #include "hooks.h" |
27 #include "roster.h" | 27 #include "roster.h" |
28 #include "histolog.h" | 28 #include "histolog.h" |
29 #include "utf8.h" | 29 #include "utf8.h" |
30 #include "hbuf.h" | |
30 | 31 |
31 static char *extcommand; | 32 static char *extcommand; |
32 | 33 |
33 inline void hk_message_in(const char *jid, time_t timestamp, const char *msg) | 34 inline void hk_message_in(const char *jid, time_t timestamp, const char *msg, |
35 const char *type) | |
34 { | 36 { |
35 int new_guy = FALSE; | 37 int new_guy = FALSE; |
38 int message_flags; | |
36 | 39 |
37 // If this user isn't in the roster, we add it | 40 // If this user isn't in the roster, we add it |
38 if (!roster_exists(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT)) { | 41 if (!roster_exists(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT)) { |
39 roster_add_user(jid, NULL, NULL, ROSTER_TYPE_USER); | 42 roster_add_user(jid, NULL, NULL, ROSTER_TYPE_USER); |
40 new_guy = TRUE; | 43 new_guy = TRUE; |
41 } | 44 } |
42 | 45 |
46 if (type && !strcmp(type, "error")) { | |
47 message_flags = HBB_PREFIX_ERR | HBB_PREFIX_IN; | |
48 scr_LogPrint("Error message received from <%s>", jid); | |
49 } else | |
50 message_flags = 0; | |
51 | |
43 // Note: the hlog_write should not be called first, because in some | 52 // Note: the hlog_write should not be called first, because in some |
44 // cases scr_WriteIncomingMessage() will load the history and we'd | 53 // cases scr_WriteIncomingMessage() will load the history and we'd |
45 // have the message twice... | 54 // have the message twice... |
46 scr_WriteIncomingMessage(jid, msg, timestamp, 0); | 55 scr_WriteIncomingMessage(jid, msg, timestamp, message_flags); |
47 hlog_write_message(jid, timestamp, FALSE, msg); | 56 // We don't log the message if it is an error message |
57 if (!(message_flags & HBB_PREFIX_ERR)) | |
58 hlog_write_message(jid, timestamp, FALSE, msg); | |
48 hk_ext_cmd(jid, 'M', 'R', NULL); | 59 hk_ext_cmd(jid, 'M', 'R', NULL); |
49 // We need to rebuild the list if the sender is unknown or | 60 // We need to rebuild the list if the sender is unknown or |
50 // if the sender is offline/invisible and hide_offline_buddies is set | 61 // if the sender is offline/invisible and hide_offline_buddies is set |
51 if (new_guy || | 62 if (new_guy || |
52 (roster_getstatus(jid) == offline && buddylist_get_hide_offline_buddies())) | 63 (roster_getstatus(jid) == offline && buddylist_get_hide_offline_buddies())) |