]>
jfr.im git - irc/evilnet/x3.git/blob - src/mod-memoserv.c
bc6a6cb8e54da3ad70f1368aebd3697d6489bc3f
1 /* mod-memoserv.c - MemoServ module for srvx
2 * Copyright 2003-2004 Martijn Smit and srvx Development Team
4 * This file is part of x3.
6 * x3 is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with srvx; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 * /msg opserv bind nickserv * *memoserv.*
24 * If you want a dedicated MemoServ bot, make sure the service control
25 * commands are bound to OpServ:
26 * /msg opserv bind opserv service *modcmd.joiner
27 * /msg opserv bind opserv service\ add *modcmd.service\ add
28 * /msg opserv bind opserv service\ rename *modcmd.service\ rename
29 * /msg opserv bind opserv service\ trigger *modcmd.service\ trigger
30 * /msg opserv bind opserv service\ remove *modcmd.service\ remove
32 * /msg opserv service add MemoServ User-to-user Memorandum Service
33 * /msg opserv bind memoserv help *modcmd.help
34 * Restart srvx with the updated conf file (as above, butwith "bot"
35 * "MemoServ"), and bind the commands to it:
36 * /msg opserv bind memoserv * *memoserv.*
37 * /msg opserv bind memoserv set *modcmd.joiner
47 #define KEY_SENT "sent"
48 #define KEY_RECIPIENT "to"
49 #define KEY_FROM "from"
50 #define KEY_MESSAGE "msg"
51 #define KEY_READ "read"
53 static const struct message_entry msgtab
[] = {
54 { "MSMSG_CANNOT_SEND", "You cannot send to account $b%s$b." },
55 { "MSMSG_MEMO_SENT", "Message sent to $b%s$b." },
56 { "MSMSG_NO_MESSAGES", "You have no messages." },
57 { "MSMSG_MEMOS_FOUND", "Found $b%d$b matches.\nUse /msg $S READ <ID> to read a message." },
58 { "MSMSG_CLEAN_INBOX", "You have $b%d$b or more messages, please clean out your inbox.\nUse /msg $S READ <ID> to read a message." },
59 { "MSMSG_LIST_HEAD", "$bID$b $bFrom$b $bTime Sent$b" },
60 { "MSMSG_LIST_FORMAT", "%-2u %s %s" },
61 { "MSMSG_MEMO_HEAD", "Memo %u From $b%s$b, received on %s:" },
62 { "MSMSG_BAD_MESSAGE_ID", "$b%s$b is not a valid message ID (it should be a number between 0 and %u)." },
63 { "MSMSG_NO_SUCH_MEMO", "You have no memo with that ID." },
64 { "MSMSG_MEMO_DELETED", "Memo $b%d$b deleted." },
65 { "MSMSG_EXPIRY_OFF", "I am currently not expiring messages. (turned off)" },
66 { "MSMSG_EXPIRY", "Messages will be expired when they are %s old (%d seconds)." },
67 { "MSMSG_MESSAGES_EXPIRED", "$b%lu$b message(s) expired." },
68 { "MSMSG_MEMOS_INBOX", "You have $b%d$b new message(s) in your inbox and %d old messages. Use /msg $S LIST to list them." },
69 { "MSMSG_NEW_MESSAGE", "You have a new message from $b%s$b. /msg $S LIST" },
70 { "MSMSG_DELETED_ALL", "Deleted all of your messages." },
71 { "MSMSG_USE_CONFIRM", "Please use /msg $S DELETE * $bCONFIRM$b to delete $uall$u of your messages." },
73 { "MSMSG_STATUS_TOTAL", "I have $b%u$b memos in my database." },
74 { "MSMSG_STATUS_EXPIRED", "$b%ld$b memos expired during the time I am awake." },
75 { "MSMSG_STATUS_SENT", "$b%ld$b memos have been sent." },
77 { "MSMSG_INVALID_OPTION", "$b%s$b is not a valid %s option." },
78 { "MSMSG_INVALID_BINARY", "$b%s$b is an invalid binary value." },
79 { "MSMSG_SET_NOTIFY", "$bNotify: $b %s" },
80 { "MSMSG_SET_AUTHNOTIFY", "$bAuthNotify: $b %s" },
81 { "MSMSG_SET_PRIVATE", "$bPrivate: $b %s" },
82 { "MSMSG_SET_LIMIT", "$bLimit: $b %d" },
83 { "MSMSG_SET_OPTIONS", "$bMessaging Options$b" },
84 { "MSMSG_SET_OPTIONS_END", "-------------End of Options-------------" },
86 { "MSMSG_LIST_END", "--------------End of Memos--------------" },
87 { "MSMSG_BAR", "----------------------------------------"},
93 struct memo_account
*recipient
;
94 struct memo_account
*sender
;
97 unsigned int is_read
: 1;
100 DECLARE_LIST(memoList
, struct memo
*);
101 DEFINE_LIST(memoList
, struct memo
*);
103 /* memo_account.flags fields */
104 #define MEMO_NOTIFY_NEW 1
105 #define MEMO_NOTIFY_LOGIN 2
106 #define MEMO_DENY_NONCHANNEL 4
108 struct memo_account
{
109 struct handle_info
*handle
;
112 struct memoList sent
;
113 struct memoList recvd
;
117 struct userNode
*bot
;
122 extern struct string_list
*autojoin_channels
;
123 const char *memoserv_module_deps
[] = { NULL
};
124 static struct module *memoserv_module
;
125 static struct log_type
*MS_LOG
;
126 static unsigned long memosSent
, memosExpired
;
127 static struct dict
*memos
; /* memo_account->handle->handle -> memo_account */
128 static dict_t memoserv_opt_dict
; /* contains option_func_t* */
130 #define OPTION_FUNC(NAME) int NAME(struct userNode *user, UNUSED_ARG(struct handle_info *hi), UNUSED_ARG(unsigned int override), unsigned int argc, char *argv[])
131 typedef OPTION_FUNC(option_func_t
);
133 static struct memo_account
*
134 memoserv_get_account(struct handle_info
*hi
)
136 struct memo_account
*ma
;
139 ma
= dict_find(memos
, hi
->handle
, NULL
);
142 ma
= calloc(1, sizeof(*ma
));
146 ma
->flags
= MEMO_NOTIFY_NEW
| MEMO_NOTIFY_LOGIN
;
147 dict_insert(memos
, ma
->handle
->handle
, ma
);
152 delete_memo(struct memo
*memo
)
154 memoList_remove(&memo
->recipient
->recvd
, memo
);
155 memoList_remove(&memo
->sender
->sent
, memo
);
161 delete_memo_account(void *data
)
163 struct memo_account
*ma
= data
;
165 while (ma
->recvd
.used
)
166 delete_memo(ma
->recvd
.list
[0]);
167 while (ma
->sent
.used
)
168 delete_memo(ma
->sent
.list
[0]);
169 memoList_clean(&ma
->recvd
);
170 memoList_clean(&ma
->sent
);
178 for (it
= dict_first(memos
); it
; it
= iter_next(it
)) {
179 struct memo_account
*acct
= iter_data(it
);
181 for (ii
= 0; ii
< acct
->sent
.used
; ++ii
) {
182 struct memo
*memo
= acct
->sent
.list
[ii
];
183 if ((now
- memo
->sent
) > memoserv_conf
.message_expiry
) {
193 expire_memos(UNUSED_ARG(void *data
))
195 if (memoserv_conf
.message_expiry
) {
197 timeq_add(now
+ memoserv_conf
.message_expiry
, expire_memos
, NULL
);
202 add_memo(time_t sent
, struct memo_account
*recipient
, struct memo_account
*sender
, char *message
)
206 memo
= calloc(1, sizeof(*memo
));
210 memo
->recipient
= recipient
;
211 memoList_append(&recipient
->recvd
, memo
);
212 memo
->sender
= sender
;
213 memoList_append(&sender
->sent
, memo
);
215 memo
->message
= strdup(message
);
221 memoserv_can_send(struct userNode
*bot
, struct userNode
*user
, struct memo_account
*acct
)
223 extern struct userData
*_GetChannelUser(struct chanData
*channel
, struct handle_info
*handle
, int override
, int allow_suspended
);
224 struct userData
*dest
;
226 if (!user
->handle_info
)
228 if (!(acct
->flags
& MEMO_DENY_NONCHANNEL
))
230 for (dest
= acct
->handle
->channels
; dest
; dest
= dest
->u_next
)
231 if (_GetChannelUser(dest
->channel
, user
->handle_info
, 1, 0))
233 send_message(user
, bot
, "MSMSG_CANNOT_SEND", acct
->handle
->handle
);
237 static struct memo
*find_memo(struct userNode
*user
, struct svccmd
*cmd
, struct memo_account
*ma
, const char *msgid
, unsigned int *id
)
240 if (!isdigit(msgid
[0])) {
242 reply("MSMSG_BAD_MESSAGE_ID", msgid
, ma
->recvd
.used
- 1);
244 reply("MSMSG_NO_MESSAGES");
247 memoid
= atoi(msgid
);
248 if (memoid
>= ma
->recvd
.used
) {
249 reply("MSMSG_NO_SUCH_MEMO");
252 return ma
->recvd
.list
[*id
= memoid
];
255 static MODCMD_FUNC(cmd_send
)
258 struct handle_info
*hi
;
259 struct memo_account
*ma
, *sender
;
261 if (!(hi
= modcmd_get_handle_info(user
, argv
[1])))
263 if (!(sender
= memoserv_get_account(user
->handle_info
))
264 || !(ma
= memoserv_get_account(hi
))) {
265 reply("MSG_INTERNAL_FAILURE");
268 if (!(memoserv_can_send(cmd
->parent
->bot
, user
, ma
)))
270 message
= unsplit_string(argv
+ 2, argc
- 2, NULL
);
271 add_memo(now
, ma
, sender
, message
);
272 if (ma
->flags
& MEMO_NOTIFY_NEW
) {
273 struct userNode
*other
;
274 for (other
= ma
->handle
->users
; other
; other
= other
->next_authed
)
275 send_message(other
, cmd
->parent
->bot
, "MSMSG_NEW_MESSAGE", user
->nick
);
277 reply("MSMSG_MEMO_SENT", ma
->handle
->handle
);
281 static MODCMD_FUNC(cmd_list
)
283 struct memo_account
*ma
;
289 if (!(ma
= memoserv_get_account(user
->handle_info
)))
292 reply("MSMSG_LIST_HEAD");
294 if(user
->handle_info
&& user
->handle_info
->userlist_style
!= HI_STYLE_CLEAN
)
297 for (ii
= 0; (ii
< ma
->recvd
.used
) && (ii
< 15); ++ii
) {
298 memo
= ma
->recvd
.list
[ii
];
299 localtime_r(&memo
->sent
, &tm
);
300 strftime(posted
, sizeof(posted
), "%I:%M %p, %m/%d/%Y", &tm
);
301 reply("MSMSG_LIST_FORMAT", ii
, memo
->sender
->handle
->handle
, posted
);
306 reply("MSMSG_CLEAN_INBOX", ii
);
308 reply("MSMSG_MEMOS_FOUND", ii
);
310 reply("MSMSG_LIST_END");
315 static MODCMD_FUNC(cmd_read
)
317 struct memo_account
*ma
;
323 if (!(ma
= memoserv_get_account(user
->handle_info
)))
325 if (!(memo
= find_memo(user
, cmd
, ma
, argv
[1], &memoid
)))
327 localtime_r(&memo
->sent
, &tm
);
328 strftime(posted
, sizeof(posted
), "%I:%M %p, %m/%d/%Y", &tm
);
329 reply("MSMSG_MEMO_HEAD", memoid
, memo
->sender
->handle
->handle
, posted
);
330 send_message_type(4, user
, cmd
->parent
->bot
, "%s", memo
->message
);
335 static MODCMD_FUNC(cmd_delete
)
337 struct memo_account
*ma
;
341 if (!(ma
= memoserv_get_account(user
->handle_info
)))
343 if (!irccasecmp(argv
[1], "*") || !irccasecmp(argv
[1], "all")) {
344 if ((argc
< 3) || irccasecmp(argv
[2], "confirm")) {
345 reply("MSMSG_USE_CONFIRM");
348 while (ma
->recvd
.used
)
349 delete_memo(ma
->recvd
.list
[0]);
350 reply("MSMSG_DELETED_ALL");
354 if (!(memo
= find_memo(user
, cmd
, ma
, argv
[1], &memoid
)))
357 reply("MSMSG_MEMO_DELETED", memoid
);
361 static MODCMD_FUNC(cmd_expire
)
363 unsigned long old_expired
= memosExpired
;
365 reply("MSMSG_MESSAGES_EXPIRED", memosExpired
- old_expired
);
369 static MODCMD_FUNC(cmd_expiry
)
371 char interval
[INTERVALLEN
];
373 if (!memoserv_conf
.message_expiry
) {
374 reply("MSMSG_EXPIRY_OFF");
378 intervalString(interval
, memoserv_conf
.message_expiry
, user
->handle_info
);
379 reply("MSMSG_EXPIRY", interval
, memoserv_conf
.message_expiry
);
385 set_list(struct userNode
*user
, struct handle_info
*hi
, int override
)
389 char *set_display
[] = {"AUTHNOTIFY", "NOTIFY", "PRIVATE", "LIMIT"};
391 send_message(user
, memoserv_conf
.bot
, "MSMSG_SET_OPTIONS");
393 if(user
->handle_info
&& user
->handle_info
->userlist_style
!= HI_STYLE_CLEAN
)
394 send_message(user
, memoserv_conf
.bot
, "MSMSG_BAR");
396 /* Do this so options are presented in a consistent order. */
397 while(i
< ArrayLength(set_display
))
399 if((opt
= dict_find(memoserv_opt_dict
, set_display
[i
++], NULL
)))
401 opt(user
, hi
, override
, 0, NULL
);
405 send_message(user
, memoserv_conf
.bot
, "MSMSG_SET_OPTIONS_END");
408 static MODCMD_FUNC(cmd_set
)
410 struct handle_info
*hi
;
413 hi
= user
->handle_info
;
417 set_list(user
, hi
, 0);
421 if (!(opt
= dict_find(memoserv_opt_dict
, argv
[1], NULL
)))
423 reply("MSMSG_INVALID_OPTION", argv
[1]);
426 return opt(user
, hi
, 0, argc
-1, argv
+1);
429 static MODCMD_FUNC(cmd_oset
)
431 struct handle_info
*hi
;
434 if (!(hi
= get_victim_oper(user
, argv
[1]))) return 0;
438 set_list(user
, hi
, 0);
442 if (!(opt
= dict_find(memoserv_opt_dict
, argv
[2], NULL
)))
444 reply("MSMSG_INVALID_OPTION", argv
[2]);
448 return opt(user
, hi
, 1, argc
-2, argv
+2);
451 static OPTION_FUNC(opt_notify
)
453 struct memo_account
*ma
;
456 if (!(ma
= memoserv_get_account(user
->handle_info
)))
460 if (enabled_string(choice
)) {
461 ma
->flags
|= MEMO_NOTIFY_NEW
;
462 } else if (disabled_string(choice
)) {
463 ma
->flags
&= ~MEMO_NOTIFY_NEW
;
465 send_message(user
, memoserv_conf
.bot
, "MSMSG_INVALID_BINARY", choice
);
470 choice
= (ma
->flags
& MEMO_NOTIFY_NEW
) ? "on" : "off";
471 send_message(user
, memoserv_conf
.bot
, "MSMSG_SET_NOTIFY", choice
);
475 static MODCMD_FUNC(opt_authnotify
)
477 struct memo_account
*ma
;
480 if (!(ma
= memoserv_get_account(user
->handle_info
)))
484 if (enabled_string(choice
)) {
485 ma
->flags
|= MEMO_NOTIFY_LOGIN
;
486 } else if (disabled_string(choice
)) {
487 ma
->flags
&= ~MEMO_NOTIFY_LOGIN
;
489 send_message(user
, memoserv_conf
.bot
, "MSMSG_INVALID_BINARY", choice
);
494 choice
= (ma
->flags
& MEMO_NOTIFY_LOGIN
) ? "on" : "off";
495 send_message(user
, memoserv_conf
.bot
, "MSMSG_SET_AUTHNOTIFY", choice
);
499 static MODCMD_FUNC(opt_private
)
501 struct memo_account
*ma
;
504 if (!(ma
= memoserv_get_account(user
->handle_info
)))
508 if (enabled_string(choice
)) {
509 ma
->flags
|= MEMO_DENY_NONCHANNEL
;
510 } else if (disabled_string(choice
)) {
511 ma
->flags
&= ~MEMO_DENY_NONCHANNEL
;
513 send_message(user
, memoserv_conf
.bot
, "MSMSG_INVALID_BINARY", choice
);
518 choice
= (ma
->flags
& MEMO_DENY_NONCHANNEL
) ? "on" : "off";
519 send_message(user
, memoserv_conf
.bot
, "MSMSG_SET_PRIVATE", choice
);
523 static MODCMD_FUNC(opt_limit
)
525 struct memo_account
*ma
;
528 if (!(ma
= memoserv_get_account(user
->handle_info
)))
531 choice
= atoi(argv
[1]);
532 if (choice
> memoserv_conf
.limit
)
533 choice
= memoserv_conf
.limit
;
538 send_message(user
, memoserv_conf
.bot
, "MSMSG_SET_LIMIT", choice
);
542 static MODCMD_FUNC(cmd_status
)
544 reply("MSMSG_STATUS_TOTAL", dict_size(memos
));
545 reply("MSMSG_STATUS_EXPIRED", memosExpired
);
546 reply("MSMSG_STATUS_SENT", memosSent
);
551 memoserv_conf_read(void)
556 str
= "modules/memoserv";
557 if (!(conf_node
= conf_get_data(str
, RECDB_OBJECT
))) {
558 log_module(MS_LOG
, LOG_ERROR
, "config node `%s' is missing or has wrong type.", str
);
562 str
= database_get_data(conf_node
, "message_expiry", RECDB_QSTRING
);
563 memoserv_conf
.message_expiry
= str
? ParseInterval(str
) : 60*24*30;
567 memoserv_saxdb_read(struct dict
*db
)
570 struct handle_info
*sender
, *recipient
;
571 struct record_data
*hir
;
576 for (it
= dict_first(db
); it
; it
= iter_next(it
)) {
578 if (hir
->type
!= RECDB_OBJECT
) {
579 log_module(MS_LOG
, LOG_WARNING
, "Unexpected rectype %d for %s.", hir
->type
, iter_key(it
));
583 if (!(str
= database_get_data(hir
->d
.object
, KEY_SENT
, RECDB_QSTRING
))) {
584 log_module(MS_LOG
, LOG_ERROR
, "Date sent not present in memo %s; skipping", iter_key(it
));
589 if (!(str
= database_get_data(hir
->d
.object
, KEY_RECIPIENT
, RECDB_QSTRING
))) {
590 log_module(MS_LOG
, LOG_ERROR
, "Recipient not present in memo %s; skipping", iter_key(it
));
592 } else if (!(recipient
= get_handle_info(str
))) {
593 log_module(MS_LOG
, LOG_ERROR
, "Invalid recipient %s in memo %s; skipping", str
, iter_key(it
));
597 if (!(str
= database_get_data(hir
->d
.object
, KEY_FROM
, RECDB_QSTRING
))) {
598 log_module(MS_LOG
, LOG_ERROR
, "Sender not present in memo %s; skipping", iter_key(it
));
600 } else if (!(sender
= get_handle_info(str
))) {
601 log_module(MS_LOG
, LOG_ERROR
, "Invalid sender %s in memo %s; skipping", str
, iter_key(it
));
605 if (!(str
= database_get_data(hir
->d
.object
, KEY_MESSAGE
, RECDB_QSTRING
))) {
606 log_module(MS_LOG
, LOG_ERROR
, "Message not present in memo %s; skipping", iter_key(it
));
610 memo
= add_memo(sent
, memoserv_get_account(recipient
), memoserv_get_account(sender
), str
);
611 if ((str
= database_get_data(hir
->d
.object
, KEY_READ
, RECDB_QSTRING
)))
618 memoserv_saxdb_write(struct saxdb_context
*ctx
)
621 struct memo_account
*ma
;
624 unsigned int id
= 0, ii
;
626 for (it
= dict_first(memos
); it
; it
= iter_next(it
)) {
628 for (ii
= 0; ii
< ma
->recvd
.used
; ++ii
) {
629 memo
= ma
->recvd
.list
[ii
];
630 saxdb_start_record(ctx
, inttobase64(str
, id
++, sizeof(str
)), 0);
631 saxdb_write_int(ctx
, KEY_SENT
, memo
->sent
);
632 saxdb_write_string(ctx
, KEY_RECIPIENT
, memo
->recipient
->handle
->handle
);
633 saxdb_write_string(ctx
, KEY_FROM
, memo
->sender
->handle
->handle
);
634 saxdb_write_string(ctx
, KEY_MESSAGE
, memo
->message
);
636 saxdb_write_int(ctx
, KEY_READ
, 1);
637 saxdb_end_record(ctx
);
644 memoserv_cleanup(void)
650 memoserv_check_messages(struct userNode
*user
, UNUSED_ARG(struct handle_info
*old_handle
))
652 unsigned int ii
, unseen
;
653 struct memo_account
*ma
;
656 if (!user
->uplink
->burst
) {
657 if (!(ma
= memoserv_get_account(user
->handle_info
))
658 || !(ma
->flags
& MEMO_NOTIFY_LOGIN
))
660 for (ii
= unseen
= 0; ii
< ma
->recvd
.used
; ++ii
) {
661 memo
= ma
->recvd
.list
[ii
];
665 if (ma
->recvd
.used
&& memoserv_conf
.bot
)
666 if(unseen
) send_message(user
, memoserv_conf
.bot
, "MSMSG_MEMOS_INBOX", unseen
, ma
->recvd
.used
- unseen
);
671 memoserv_rename_account(struct handle_info
*hi
, const char *old_handle
)
673 struct memo_account
*ma
;
674 if (!(ma
= dict_find(memos
, old_handle
, NULL
)))
676 dict_remove2(memos
, old_handle
, 1);
677 dict_insert(memos
, hi
->handle
, ma
);
681 memoserv_unreg_account(UNUSED_ARG(struct userNode
*user
), struct handle_info
*handle
)
683 dict_remove(memos
, handle
->handle
);
689 MS_LOG
= log_register_type("MemoServ", "file:memoserv.log");
691 dict_set_free_data(memos
, delete_memo_account
);
692 reg_auth_func(memoserv_check_messages
);
693 reg_handle_rename_func(memoserv_rename_account
);
694 reg_unreg_func(memoserv_unreg_account
);
695 conf_register_reload(memoserv_conf_read
);
696 reg_exit_func(memoserv_cleanup
);
697 saxdb_register("MemoServ", memoserv_saxdb_read
, memoserv_saxdb_write
);
699 memoserv_module
= module_register("MemoServ", MS_LOG
, "mod-memoserv.help", NULL
);
700 modcmd_register(memoserv_module
, "send", cmd_send
, 3, MODCMD_REQUIRE_AUTHED
, NULL
);
701 modcmd_register(memoserv_module
, "list", cmd_list
, 1, MODCMD_REQUIRE_AUTHED
, NULL
);
702 modcmd_register(memoserv_module
, "read", cmd_read
, 2, MODCMD_REQUIRE_AUTHED
, NULL
);
703 modcmd_register(memoserv_module
, "delete", cmd_delete
, 2, MODCMD_REQUIRE_AUTHED
, NULL
);
704 modcmd_register(memoserv_module
, "expire", cmd_expire
, 1, MODCMD_REQUIRE_AUTHED
, "flags", "+oper", NULL
);
705 modcmd_register(memoserv_module
, "expiry", cmd_expiry
, 1, 0, NULL
);
706 modcmd_register(memoserv_module
, "status", cmd_status
, 1, 0, NULL
);
707 modcmd_register(memoserv_module
, "set", cmd_set
, 1, MODCMD_REQUIRE_AUTHED
, NULL
);
708 modcmd_register(memoserv_module
, "oset", cmd_oset
, 1, MODCMD_REQUIRE_AUTHED
, "flags", "+helping", NULL
);
710 memoserv_opt_dict
= dict_new();
711 dict_insert(memoserv_opt_dict
, "AUTHNOTIFY", opt_authnotify
);
712 dict_insert(memoserv_opt_dict
, "NOTIFY", opt_notify
);
713 dict_insert(memoserv_opt_dict
, "PRIVATE", opt_private
);
714 /* dict_insert(memoserv_opt_dict, "LIMIT", opt_limit); */
716 message_register_table(msgtab
);
718 if (memoserv_conf
.message_expiry
)
719 timeq_add(now
+ memoserv_conf
.message_expiry
, expire_memos
, NULL
);
725 memoserv_finalize(void) {
726 struct chanNode
*chan
;
731 str
= "modules/memoserv";
732 if (!(conf_node
= conf_get_data(str
, RECDB_OBJECT
))) {
733 log_module(MS_LOG
, LOG_ERROR
, "config node `%s' is missing or has wrong type.", str
);
737 str
= database_get_data(conf_node
, "bot", RECDB_QSTRING
);
739 memoserv_conf
.bot
= GetUserH(str
);
741 if (autojoin_channels
&& memoserv_conf
.bot
) {
742 for (i
= 0; i
< autojoin_channels
->used
; i
++) {
743 chan
= AddChannel(autojoin_channels
->list
[i
], now
, "+nt", NULL
, NULL
);
744 AddChannelUser(memoserv_conf
.bot
, chan
)->modes
|= MODE_CHANOP
;