--- a/mcabber/src/hbuf.h Fri Jul 15 22:27:07 2005 +0100
+++ b/mcabber/src/hbuf.h Sat Jul 16 13:27:00 2005 +0100
@@ -19,6 +19,7 @@
#define HBB_PREFIX_STATUS 4
#define HBB_PREFIX_AUTH 8
#define HBB_PREFIX_INFO 16
+#define HBB_PREFIX_ERR 32
typedef struct {
time_t timestamp;
--- a/mcabber/src/hooks.c Fri Jul 15 22:27:07 2005 +0100
+++ b/mcabber/src/hooks.c Sat Jul 16 13:27:00 2005 +0100
@@ -27,12 +27,15 @@
#include "roster.h"
#include "histolog.h"
#include "utf8.h"
+#include "hbuf.h"
static char *extcommand;
-inline void hk_message_in(const char *jid, time_t timestamp, const char *msg)
+inline void hk_message_in(const char *jid, time_t timestamp, const char *msg,
+ const char *type)
{
int new_guy = FALSE;
+ int message_flags;
// If this user isn't in the roster, we add it
if (!roster_exists(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT)) {
@@ -40,11 +43,19 @@
new_guy = TRUE;
}
+ if (type && !strcmp(type, "error")) {
+ message_flags = HBB_PREFIX_ERR | HBB_PREFIX_IN;
+ scr_LogPrint("Error message received from <%s>", jid);
+ } else
+ message_flags = 0;
+
// Note: the hlog_write should not be called first, because in some
// cases scr_WriteIncomingMessage() will load the history and we'd
// have the message twice...
- scr_WriteIncomingMessage(jid, msg, timestamp, 0);
- hlog_write_message(jid, timestamp, FALSE, msg);
+ scr_WriteIncomingMessage(jid, msg, timestamp, message_flags);
+ // We don't log the message if it is an error message
+ if (!(message_flags & HBB_PREFIX_ERR))
+ hlog_write_message(jid, timestamp, FALSE, msg);
hk_ext_cmd(jid, 'M', 'R', NULL);
// We need to rebuild the list if the sender is unknown or
// if the sender is offline/invisible and hide_offline_buddies is set
--- a/mcabber/src/hooks.h Fri Jul 15 22:27:07 2005 +0100
+++ b/mcabber/src/hooks.h Sat Jul 16 13:27:00 2005 +0100
@@ -5,7 +5,8 @@
#include "jabglue.h"
-inline void hk_message_in(const char *jid, time_t timestamp, const char *msg);
+inline void hk_message_in(const char *jid, time_t timestamp, const char *msg,
+ const char *type);
inline void hk_message_out(const char *jid, time_t timestamp, const char *msg);
inline void hk_statuschange(const char *jid, time_t timestamp,
enum imstatus status, char const *status_msg);
--- a/mcabber/src/jabglue.c Fri Jul 15 22:27:07 2005 +0100
+++ b/mcabber/src/jabglue.c Sat Jul 16 13:27:00 2005 +0100
@@ -566,7 +566,7 @@
*/
jid = jidtodisp(from);
- hk_message_in(jid, timestamp, buffer);
+ hk_message_in(jid, timestamp, buffer, type);
g_free(jid);
free(buffer);
}
--- a/mcabber/src/screen.c Fri Jul 15 22:27:07 2005 +0100
+++ b/mcabber/src/screen.c Sat Jul 16 13:27:00 2005 +0100
@@ -329,6 +329,13 @@
else if (line->flags & HBB_PREFIX_OUT)
dir = '>';
wprintw(win_entry->win, "%.11s *%c* ", date, dir);
+ } else if (line->flags & HBB_PREFIX_ERR) {
+ char dir = '#';
+ if (line->flags & HBB_PREFIX_IN)
+ dir = '<';
+ else if (line->flags & HBB_PREFIX_OUT)
+ dir = '>';
+ wprintw(win_entry->win, "%.11s #%c# ", date, dir);
} else if (line->flags & HBB_PREFIX_IN)
wprintw(win_entry->win, "%.11s <== ", date);
else if (line->flags & HBB_PREFIX_OUT)