1
0
mirror of https://github.com/anope/anope.git synced 2026-07-04 20:33:12 +02:00

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)

git-svn-id: svn://svn.anope.org/anope/trunk@76 31f1291d-b8d6-0310-a050-a5561fc1590b


git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@52 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b
2004-04-29 10:53:23 +00:00
parent 297b6d5a20
commit cd24c74e8d
6 changed files with 92 additions and 1 deletions
+1
View File
@@ -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)
+5
View File
@@ -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
+16
View File
@@ -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
+5
View File
@@ -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
+59
View File
@@ -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;
}
/*************************************************************************/
+6 -1
View File
@@ -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 :)