#include "conf.h"
#include "modcmd.h"
#include "nickserv.h"
+#include "opserv.h"
#include "saxdb.h"
#include "timeq.h"
{ "MSMSG_LIST_END", "--------------End of Memos--------------" },
{ "MSMSG_BAR", "----------------------------------------"},
+ { "MSMSG_DEFCON_NO_NEW_MEMOS", "You cannot send new memos at this time, please try again soon." },
+
{ NULL, NULL }
};
unsigned long id;
};
+struct userNode *memoserv;
+
+#define MEMOSERV_FUNC(NAME) MODCMD_FUNC(NAME)
+#define MEMOSERV_SYNTAX() svccmd_send_help_brief(user, memoserv, cmd)
+#define MEMOSERV_MIN_PARAMS(N) if(argc < (N)) { \
+ reply("MSG_MISSING_PARAMS", argv[0]); \
+ MEMOSERV_SYNTAX(); \
+ return 0; }
+
DECLARE_LIST(memoList, struct memo*);
DEFINE_LIST(memoList, struct memo*);
DECLARE_LIST(historyList, struct history*);
struct memo_account *ma, *sender;
struct memo *memo;
+ MEMOSERV_MIN_PARAMS(3);
+
+ if (checkDefCon(DEFCON_NO_NEW_MEMOS) && !IsOper(user)) {
+ reply("MSMSG_DEFCON_NO_NEW_MEMOS");
+ return 0;
+ }
+
if (!(hi = modcmd_get_handle_info(user, argv[1])))
return 0;
struct memo *memo;
unsigned int memoid;
+ MEMOSERV_MIN_PARAMS(2);
+
if (!(ma = memoserv_get_account(user->handle_info)))
return 0;
if (!irccasecmp(argv[1], "*") || !irccasecmp(argv[1], "all")) {
struct memo *memo;
struct memo_account *ma;
+ MEMOSERV_MIN_PARAMS(2);
+
if (isdigit(argv[1][0])) {
id = strtoul(argv[1], NULL, 0);
} else {
struct handle_info *hi;
option_func_t *opt;
- if (argc < 2)
- return 0;
+ MEMOSERV_MIN_PARAMS(2);
if (!(hi = get_victim_oper(cmd, user, argv[1])))
return 0;
if (!memo->is_read)
unseen++;
}
- if (ma->recvd.used && memoserv_conf.bot)
- if(unseen) send_message(user, memoserv_conf.bot, "MSMSG_MEMOS_INBOX", unseen, ma->recvd.used - unseen);
+ if (ma->recvd.used && memoserv)
+ if(unseen) send_message(user, memoserv, "MSMSG_MEMOS_INBOX", unseen, ma->recvd.used - unseen);
}
}
}
str = database_get_data(conf_node, "bot", RECDB_QSTRING);
- if (str)
- memoserv_conf.bot = GetUserH(str);
- else
+ if (str) {
+ memoserv = memoserv_conf.bot;
+ const char *modes = conf_get_data("modules/memoserv/modes", RECDB_QSTRING);
+ memoserv = AddService(str, modes ? modes : NULL, "User-User Memorandum Services", NULL);
+
+ } else {
log_module(MS_LOG, LOG_ERROR, "database_get_data for memoserv_conf.bot failed!");
+ exit(1);
+ }
- if (autojoin_channels && memoserv_conf.bot) {
+ if (autojoin_channels && memoserv) {
for (i = 0; i < autojoin_channels->used; i++) {
chan = AddChannel(autojoin_channels->list[i], now, "+nt", NULL, NULL);
- AddChannelUser(memoserv_conf.bot, chan)->modes |= MODE_CHANOP;
+ AddChannelUser(memoserv, chan)->modes |= MODE_CHANOP;
}
}