summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2004-08-19 23:34:00 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2004-08-19 23:34:00 +0000
commit924ac8f91f87d9034dedb711ec33fe714f91a860 (patch)
treeb9f9666be1fdc8fee74c69adab39118622daabe0 /src/core
parent334b07ac286e16e71299404a57211d7492621a9a (diff)
downloadirssi-924ac8f91f87d9034dedb711ec33fe714f91a860.zip
Patch by jimmy: Details In 0.8.9 it is not possible to log all activity on a given
server; you must confine the logging to a window or a set of targets. This patch adds a default "*" target which matches everything on the server, including NULL items associated with it: git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3282 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r--src/core/log.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/core/log.c b/src/core/log.c
index 75768601..18715832 100644
--- a/src/core/log.c
+++ b/src/core/log.c
@@ -246,18 +246,34 @@ void log_write_rec(LOG_REC *log, const char *str, int level)
g_free_not_null(colorstr);
}
+static int itemcmp(const char *patt, const char *item)
+{
+ /* returns 0 on match, nonzero otherwise */
+
+ if (item == NULL)
+ return g_strcasecmp(patt, "*") != 0;
+
+ for (;*patt != '\0'; patt++, item++)
+ {
+ if (*patt == '*')
+ return 0;
+ if (*patt != *item)
+ return 1;
+ }
+ return 0;
+}
+
LOG_ITEM_REC *log_item_find(LOG_REC *log, int type, const char *item,
const char *servertag)
{
GSList *tmp;
g_return_val_if_fail(log != NULL, NULL);
- g_return_val_if_fail(item != NULL, NULL);
for (tmp = log->items; tmp != NULL; tmp = tmp->next) {
LOG_ITEM_REC *rec = tmp->data;
- if (rec->type == type && g_strcasecmp(rec->name, item) == 0 &&
+ if (rec->type == type && itemcmp(rec->name, item) == 0 &&
(rec->servertag == NULL || (servertag != NULL &&
g_strcasecmp(rec->servertag, servertag) == 0)))
return rec;