diff options
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | Changes.lang | 5 | ||||
-rw-r--r-- | lang/en_us.l | 16 | ||||
-rw-r--r-- | lang/index | 5 | ||||
-rw-r--r-- | memoserv.c | 59 | ||||
-rw-r--r-- | version.log | 7 |
6 files changed, 92 insertions, 1 deletions
@@ -1,6 +1,7 @@ Anope Version 1.7.x (will be renamed when next release is produced) ------------------- Provided by Anope Dev. <dev@anope.org> +2004/04/29 Added new MemoServ command CHECK to check whether a memo has been read or not. 2004/04/26 Added module data ability, currently only added to User struct 2004/04/23 Added new MemoServ command RSEND to send a memo requesting a receipt memo once the recipient reads it. 2004/04/22 Fixed ALIST bug when being invoked by systems admins (Bug #20) diff --git a/Changes.lang b/Changes.lang index 9c289adbb..e27ddd25e 100644 --- a/Changes.lang +++ b/Changes.lang @@ -9,6 +9,11 @@ MEMO_RSEND_NICK_MEMO_TEXT MEMO_RSEND_CHAN_MEMO_TEXT MEMO_RSEND_USER_NOTIFICATION MEMO_HELP_RSEND +MEMO_CHECK_SYNTAX +MEMO_CHECK_NOT_READ +MEMO_CHECK_READ +MEMO_CHECK_NO_MEMO +MEMO_HELP_CHECK *** Mod Strings: MEMO_HELP diff --git a/lang/en_us.l b/lang/en_us.l index 11021b7a2..b9af306c6 100644 --- a/lang/en_us.l +++ b/lang/en_us.l @@ -1726,6 +1726,16 @@ MEMO_RSEND_USER_NOTIFICATION A notification memo has been sent to %s informing him/her you have read his/her memo. +# CHECK responses +MEMO_CHECK_SYNTAX + CHECK nickname +MEMO_CHECK_NOT_READ + The last memo you sent to %s (sent on %s) has not yet been read. +MEMO_CHECK_READ + The last memo you sent to %s (sent on %s) has been read. +MEMO_CHECK_NO_MEMO + Nick %s doesn't have a memo from you. + ########################################################################### # # BotServ messages @@ -4831,6 +4841,12 @@ MEMO_HELP_RSEND memo will be sent to the sender informing him/her that the memo has been read. +MEMO_HELP_CHECK + Syntax: CHECK nick + + Checks whether the _last_ memo you sent to nick has been read + or not. Note that this does only work with nicks, not with chans. + ########################################################################### # # OperServ help messages diff --git a/lang/index b/lang/index index d14b844c3..9214475c6 100644 --- a/lang/index +++ b/lang/index @@ -671,6 +671,10 @@ MEMO_RSEND_SYNTAX MEMO_RSEND_NICK_MEMO_TEXT MEMO_RSEND_CHAN_MEMO_TEXT MEMO_RSEND_USER_NOTIFICATION +MEMO_CHECK_SYNTAX +MEMO_CHECK_NOT_READ +MEMO_CHECK_READ +MEMO_CHECK_NO_MEMO BOT_DOES_NOT_EXIST BOT_NOT_ASSIGNED BOT_NOT_ON_CHANNEL @@ -1314,6 +1318,7 @@ MEMO_SERVADMIN_HELP_INFO MEMO_HELP_STAFF MEMO_HELP_SENDALL MEMO_HELP_RSEND +MEMO_HELP_CHECK OPER_HELP OPER_HELP_OPER_CMD OPER_HELP_ADMIN_CMD diff --git a/memoserv.c b/memoserv.c index 2e39f4425..5508347b4 100644 --- a/memoserv.c +++ b/memoserv.c @@ -36,6 +36,7 @@ static int do_sendall(User *u); void moduleAddMemoServCmds(void); static void new_memo_mail(NickCore *nc, Memo *m); static int do_rsend(User *u); +static int do_memocheck(User *u); void rsend_notify(User *u, Memo *m, const char *chan); /*************************************************************************/ @@ -54,6 +55,7 @@ void moduleAddMemoServCmds(void) { c = createCommand("INFO", do_info, NULL, -1,MEMO_HELP_INFO, MEMO_SERVADMIN_HELP_INFO,MEMO_SERVADMIN_HELP_INFO, MEMO_SERVADMIN_HELP_INFO); addCoreCommand(MEMOSERV,c); c = createCommand("SENDALL", do_sendall, is_services_admin, MEMO_HELP_SENDALL, -1,-1,-1,-1); addCoreCommand(MEMOSERV,c); c = createCommand("RSEND", do_rsend, NULL, MEMO_HELP_RSEND, -1,-1,-1,-1); addCoreCommand(MEMOSERV,c); + c = createCommand("CHECK", do_memocheck, NULL, MEMO_HELP_CHECK, -1,-1,-1,-1); addCoreCommand(MEMOSERV,c); } /*************************************************************************/ @@ -1312,4 +1314,61 @@ void rsend_notify(User * u, Memo * m, const char *chan) return; } + + +/*************************************************************************/ +/* This function checks whether the last memo you sent to person X has been read + or not. Note that this function does only work with nicks, NOT with chans. */ + +static int do_memocheck(User * u) +{ + NickAlias *na = NULL; + MemoInfo *mi = NULL; + int i, found = 0; + char *stime = NULL; + char *recipient = strtok(NULL, ""); + + if (!recipient) { + syntax_error(s_MemoServ, u, "CHECK", MEMO_CHECK_SYNTAX); + return MOD_CONT; + } else if (!nick_recognized(u)) { + notice_lang(s_MemoServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ); + return MOD_CONT; + } else if (!(na = findnick(recipient))) { + notice_lang(s_MemoServ, u, NICK_X_NOT_REGISTERED, recipient); + return MOD_CONT; + } + + mi = &na->nc->memos; + +/* Okay, I know this looks strange but we wanna get the LAST memo, so we + have to loop backwards */ + + for (i = (mi->memocount - 1); i >= 0; i--) { + if (!stricmp(mi->memos[i].sender, u->nick)) { + found = 1; /* Yes, we've found the memo */ + + stime = strdup(ctime(&mi->memos[i].time)); + *(stime + strlen(stime) - 1) = ' '; /* cut the f*cking \0 terminator and replace it with a single space */ + + if (mi->memos[i].flags & MF_UNREAD) + notice_lang(s_MemoServ, u, MEMO_CHECK_NOT_READ, na->nick, + stime); + else + notice_lang(s_MemoServ, u, MEMO_CHECK_READ, na->nick, + stime); + break; + } + } + + if (!found) + notice_lang(s_MemoServ, u, MEMO_CHECK_NO_MEMO, na->nick); + + if (stime) + free(stime); + + return MOD_CONT; +} + + /*************************************************************************/ diff --git a/version.log b/version.log index 4122cc829..09b8c1157 100644 --- a/version.log +++ b/version.log @@ -8,11 +8,16 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="2" -VERSION_BUILD="75" +VERSION_BUILD="76" VERSION_EXTRA="" # $Log$ # +# BUILD : 1.7.2 (76) +# BUGS : +# NOTES : Added memoserv function to check whether the last memo you sent to a nick has been read or not. new cmd: /MS CHECK +# <nick> (I rule! :P) +# # BUILD : 1.7.2 (75) # BUGS : N/A # NOTES : Been right through modules.c, every - yes EVERY function is now commented in a doxy-gen style mannor, detailing what it does, along with all the params and return codes - be affraid! - oh and jsut by-the-by when people are working on functions/new features/bug fixs in other parts of anope, we really should be adding these comments :) |