From 56c157d2a9966393a9e9d5719907e4ddc144aab1 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Fri, 6 Mar 2009 08:04:13 -0500 Subject: [PATCH] Report the number of memos, not recipients, in /msg MemoServ status. Another bug spotted by ZeRoFiGhter. src/mod-memoserv.c (memoCount): New variable. (delete_memo): Decrement it. (add_memo): Increment it. (cmd_status): Report it. --- src/mod-memoserv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mod-memoserv.c b/src/mod-memoserv.c index d580b66..447744f 100644 --- a/src/mod-memoserv.c +++ b/src/mod-memoserv.c @@ -118,7 +118,9 @@ static struct { const char *memoserv_module_deps[] = { NULL }; static struct module *memoserv_module; static struct log_type *MS_LOG; -static unsigned long memosSent, memosExpired; +static unsigned long memoCount; +static unsigned long memosSent; +static unsigned long memosExpired; static struct dict *memos; /* memo_account->handle->handle -> memo_account */ static struct memo_account * @@ -146,6 +148,7 @@ delete_memo(struct memo *memo) memoList_remove(&memo->sender->sent, memo); free(memo->message); free(memo); + memoCount--; } static void @@ -205,6 +208,7 @@ add_memo(unsigned long sent, struct memo_account *recipient, struct memo_account memo->sent = sent; memo->message = strdup(message); memosSent++; + memoCount++; return memo; } @@ -436,7 +440,7 @@ static MODCMD_FUNC(cmd_set_private) static MODCMD_FUNC(cmd_status) { - reply("MSMSG_STATUS_TOTAL", dict_size(memos)); + reply("MSMSG_STATUS_TOTAL", memoCount); reply("MSMSG_STATUS_EXPIRED", memosExpired); reply("MSMSG_STATUS_SENT", memosSent); return 1; -- 2.20.1