mirror of
https://github.com/anope/anope.git
synced 2026-07-03 13:03:14 +02:00
Various fixes for compiling under Windows.
Also updated ms_* modules to use std::vector Memo struct from earlier commit. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1797 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -3,7 +3,7 @@ include ../../Makefile.inc.win32
|
||||
SRCS=bs_act.c bs_assign.c bs_badwords.c bs_bot.c bs_botlist.c bs_fantasy.c bs_fantasy_kick.c bs_fantasy_kickban.c bs_fantasy_owner.c bs_fantasy_seen.c bs_help.c bs_info.c bs_kick.c bs_say.c bs_set.c bs_unassign.c cs_access.c cs_akick.c cs_ban.c cs_clear.c cs_drop.c cs_forbid.c cs_getkey.c cs_getpass.c cs_help.c cs_identify.c cs_info.c cs_invite.c cs_kick.c cs_list.c cs_logout.c cs_modes.c cs_register.c cs_sendpass.c cs_set.c cs_status.c cs_suspend.c cs_topic.c cs_xop.c enc_none.c enc_md5.c enc_old.c he_help.c hs_del.c hs_delall.c hs_group.c hs_help.c hs_list.c hs_off.c hs_on.c hs_set.c hs_setall.c ms_cancel.c ms_check.c ms_del.c ms_help.c ms_info.c ms_list.c ms_read.c ms_rsend.c ms_send.c ms_sendall.c ms_set.c ms_staff.c ns_access.c ns_alist.c ns_drop.c ns_forbid.c ns_getemail.c ns_getpass.c ns_ghost.c ns_group.c ns_help.c ns_identify.c ns_info.c ns_list.c ns_logout.c ns_recover.c ns_register.c ns_release.c ns_sendpass.c ns_set.c ns_saset.c ns_status.c ns_suspend.c ns_update.c os_admin.c os_akill.c os_chankill.c os_chanlist.c os_clearmodes.c os_defcon.c os_global.c os_help.c os_ignore.c os_jupe.c os_kick.c os_logonnews.c os_mode.c os_modinfo.c os_modlist.c os_modload.c os_modunload.c os_noop.c os_oline.c os_oper.c os_opernews.c os_quit.c os_randomnews.c os_raw.c os_reload.c os_restart.c os_session.c os_set.c os_sgline.c os_shutdown.c os_sqline.c os_staff.c os_stats.c os_svsnick.c os_szline.c os_umode.c os_update.c os_userlist.c
|
||||
OBJECTS= $(SRCS:.c=.dll)
|
||||
CFLAGS=/LD /MD /D MODULE_COMPILE $(CFLAGS) /I"../../include"
|
||||
LFLAGS=/link ../anope.lib wsock32.lib $(LIBS) $(LFLAGS) $(MYSQL_LIB_PATH) /export:AnopeInit /export:AnopeFini /VERSION:$(VERSION)
|
||||
LFLAGS=/link ../anope.lib wsock32.lib $(LIBS) $(LFLAGS) $(MYSQL_LIB_PATH) /export:init_module /export:destroy_module /VERSION:$(VERSION)
|
||||
|
||||
all: $(OBJECTS)
|
||||
|
||||
|
||||
@@ -76,11 +76,11 @@ int do_cancel(User * u)
|
||||
} else {
|
||||
int i;
|
||||
|
||||
for (i = mi->memocount - 1; i >= 0; i--) {
|
||||
if ((mi->memos[i].flags & MF_UNREAD)
|
||||
&& !stricmp(mi->memos[i].sender, u->na->nc->display)
|
||||
&& (!(mi->memos[i].flags & MF_NOTIFYS))) {
|
||||
delmemo(mi, mi->memos[i].number);
|
||||
for (i = mi->memos.size() - 1; i >= 0; i--) {
|
||||
if ((mi->memos[i]->flags & MF_UNREAD)
|
||||
&& !stricmp(mi->memos[i]->sender, u->na->nc->display)
|
||||
&& (!(mi->memos[i]->flags & MF_NOTIFYS))) {
|
||||
delmemo(mi, mi->memos[i]->number);
|
||||
notice_lang(s_MemoServ, u, MEMO_CANCELLED, name);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
+4
-4
@@ -80,15 +80,15 @@ int do_memocheck(User * u)
|
||||
/* 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->na->nc->display)) {
|
||||
for (i = (mi->memos.size() - 1); i >= 0; i--) {
|
||||
if (!stricmp(mi->memos[i]->sender, u->na->nc->display)) {
|
||||
found = 1; /* Yes, we've found the memo */
|
||||
|
||||
tm = localtime(&mi->memos[i].time);
|
||||
tm = localtime(&mi->memos[i]->time);
|
||||
strftime_lang(timebuf, sizeof(timebuf), u,
|
||||
STRFTIME_DATE_TIME_FORMAT, tm);
|
||||
|
||||
if (mi->memos[i].flags & MF_UNREAD)
|
||||
if (mi->memos[i]->flags & MF_UNREAD)
|
||||
notice_lang(s_MemoServ, u, MEMO_CHECK_NOT_READ, na->nick,
|
||||
timebuf);
|
||||
else
|
||||
|
||||
+9
-10
@@ -88,7 +88,7 @@ int do_del(User * u)
|
||||
|| (!isdigit(*numstr) && stricmp(numstr, "ALL") != 0
|
||||
&& stricmp(numstr, "LAST") != 0)) {
|
||||
syntax_error(s_MemoServ, u, "DEL", MEMO_DEL_SYNTAX);
|
||||
} else if (mi->memocount == 0) {
|
||||
} else if (mi->memos.size() == 0) {
|
||||
if (chan)
|
||||
notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan);
|
||||
else
|
||||
@@ -128,18 +128,17 @@ int do_del(User * u)
|
||||
}
|
||||
} else if (stricmp(numstr, "LAST") == 0) {
|
||||
/* Delete last memo. */
|
||||
for (i = 0; i < mi->memocount; i++)
|
||||
last = mi->memos[i].number;
|
||||
for (i = 0; i < mi->memos.size(); i++)
|
||||
last = mi->memos[i]->number;
|
||||
delmemo(mi, last);
|
||||
notice_lang(s_MemoServ, u, MEMO_DELETED_ONE, last);
|
||||
} else {
|
||||
/* Delete all memos. */
|
||||
for (i = 0; i < mi->memocount; i++) {
|
||||
delete [] mi->memos[i].text;
|
||||
for (i = 0; i < mi->memos.size(); i++) {
|
||||
delete [] mi->memos[i]->text;
|
||||
delete mi->memos[i];
|
||||
}
|
||||
free(mi->memos);
|
||||
mi->memos = NULL;
|
||||
mi->memocount = 0;
|
||||
mi->memos.clear();
|
||||
if (chan)
|
||||
notice_lang(s_MemoServ, u, MEMO_CHAN_DELETED_ALL, chan);
|
||||
else
|
||||
@@ -147,8 +146,8 @@ int do_del(User * u)
|
||||
}
|
||||
|
||||
/* Reset the order */
|
||||
for (i = 0; i < mi->memocount; i++)
|
||||
mi->memos[i].number = i + 1;
|
||||
for (i = 0; i < mi->memos.size(); i++)
|
||||
mi->memos[i]->number = i + 1;
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
+18
-18
@@ -98,31 +98,31 @@ int do_info(User * u)
|
||||
|
||||
if (name && (ci || na->nc != u->na->nc)) {
|
||||
|
||||
if (!mi->memocount) {
|
||||
if (mi->memos.empty()) {
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_X_NO_MEMOS, name);
|
||||
} else if (mi->memocount == 1) {
|
||||
if (mi->memos[0].flags & MF_UNREAD)
|
||||
} else if (mi->memos.size() == 1) {
|
||||
if (mi->memos[0]->flags & MF_UNREAD)
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMO_UNREAD, name);
|
||||
else
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMO, name);
|
||||
} else {
|
||||
int count = 0, i;
|
||||
for (i = 0; i < mi->memocount; i++) {
|
||||
if (mi->memos[i].flags & MF_UNREAD)
|
||||
for (i = 0; i < mi->memos.size(); i++) {
|
||||
if (mi->memos[i]->flags & MF_UNREAD)
|
||||
count++;
|
||||
}
|
||||
if (count == mi->memocount)
|
||||
if (count == mi->memos.size())
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMOS_ALL_UNREAD,
|
||||
name, count);
|
||||
else if (count == 0)
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMOS, name,
|
||||
mi->memocount);
|
||||
mi->memos.size());
|
||||
else if (count == 1)
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMOS_ONE_UNREAD,
|
||||
name, mi->memocount);
|
||||
name, mi->memos.size());
|
||||
else
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMOS_SOME_UNREAD,
|
||||
name, mi->memocount, count);
|
||||
name, mi->memos.size(), count);
|
||||
}
|
||||
if (mi->memomax == 0) {
|
||||
if (hardmax)
|
||||
@@ -161,30 +161,30 @@ int do_info(User * u)
|
||||
|
||||
} else { /* !name || (!ci || na->nc == u->na->nc) */
|
||||
|
||||
if (!mi->memocount) {
|
||||
if (mi->memos.empty()) {
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_NO_MEMOS);
|
||||
} else if (mi->memocount == 1) {
|
||||
if (mi->memos[0].flags & MF_UNREAD)
|
||||
} else if (mi->memos.size() == 1) {
|
||||
if (mi->memos[0]->flags & MF_UNREAD)
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_MEMO_UNREAD);
|
||||
else
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_MEMO);
|
||||
} else {
|
||||
int count = 0, i;
|
||||
for (i = 0; i < mi->memocount; i++) {
|
||||
if (mi->memos[i].flags & MF_UNREAD)
|
||||
for (i = 0; i < mi->memos.size(); i++) {
|
||||
if (mi->memos[i]->flags & MF_UNREAD)
|
||||
count++;
|
||||
}
|
||||
if (count == mi->memocount)
|
||||
if (count == mi->memos.size())
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_MEMOS_ALL_UNREAD,
|
||||
count);
|
||||
else if (count == 0)
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_MEMOS, mi->memocount);
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_MEMOS, mi->memos.size());
|
||||
else if (count == 1)
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_MEMOS_ONE_UNREAD,
|
||||
mi->memocount);
|
||||
mi->memos.size());
|
||||
else
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_MEMOS_SOME_UNREAD,
|
||||
mi->memocount, count);
|
||||
mi->memos.size(), count);
|
||||
}
|
||||
|
||||
if (mi->memomax == 0) {
|
||||
|
||||
+10
-10
@@ -83,7 +83,7 @@ int do_list(User * u)
|
||||
}
|
||||
if (param && !isdigit(*param) && stricmp(param, "NEW") != 0) {
|
||||
syntax_error(s_MemoServ, u, "LIST", MEMO_LIST_SYNTAX);
|
||||
} else if (mi->memocount == 0) {
|
||||
} else if (mi->memos.size() == 0) {
|
||||
if (chan)
|
||||
notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan);
|
||||
else
|
||||
@@ -95,11 +95,11 @@ int do_list(User * u)
|
||||
mi, &sent_header, chan);
|
||||
} else {
|
||||
if (param) {
|
||||
for (i = 0, m = mi->memos; i < mi->memocount; i++, m++) {
|
||||
if (m->flags & MF_UNREAD)
|
||||
for (i = 0; i < mi->memos.size(); i++) {
|
||||
if (mi->memos[i]->flags & MF_UNREAD)
|
||||
break;
|
||||
}
|
||||
if (i == mi->memocount) {
|
||||
if (i == mi->memos.size()) {
|
||||
if (chan)
|
||||
notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_NEW_MEMOS,
|
||||
chan);
|
||||
@@ -108,8 +108,8 @@ int do_list(User * u)
|
||||
return MOD_CONT;
|
||||
}
|
||||
}
|
||||
for (i = 0, m = mi->memos; i < mi->memocount; i++, m++) {
|
||||
if (param && !(m->flags & MF_UNREAD))
|
||||
for (i = 0; i < mi->memos.size(); i++) {
|
||||
if (param && !(mi->memos[i]->flags & MF_UNREAD))
|
||||
continue;
|
||||
list_memo(u, i, mi, &sent_header, param != NULL, chan);
|
||||
}
|
||||
@@ -132,8 +132,8 @@ int list_memo_callback(User * u, int num, va_list args)
|
||||
const char *chan = va_arg(args, const char *);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mi->memocount; i++) {
|
||||
if (mi->memos[i].number == num)
|
||||
for (i = 0; i < mi->memos.size(); i++) {
|
||||
if (mi->memos[i]->number == num)
|
||||
break;
|
||||
}
|
||||
/* Range checking done by list_memo() */
|
||||
@@ -156,7 +156,7 @@ int list_memo(User * u, int index, MemoInfo * mi, int *sent_header, int newi, co
|
||||
char timebuf[64];
|
||||
struct tm tm;
|
||||
|
||||
if (index < 0 || index >= mi->memocount)
|
||||
if (index < 0 || index >= mi->memos.size())
|
||||
return 0;
|
||||
if (!*sent_header) {
|
||||
if (chan) {
|
||||
@@ -171,7 +171,7 @@ int list_memo(User * u, int index, MemoInfo * mi, int *sent_header, int newi, co
|
||||
notice_lang(s_MemoServ, u, MEMO_LIST_HEADER);
|
||||
*sent_header = 1;
|
||||
}
|
||||
m = &mi->memos[index];
|
||||
m = mi->memos[index];
|
||||
tm = *localtime(&m->time);
|
||||
strftime_lang(timebuf, sizeof(timebuf),
|
||||
u, STRFTIME_DATE_TIME_FORMAT, &tm);
|
||||
|
||||
+8
-8
@@ -88,7 +88,7 @@ int do_read(User * u)
|
||||
&& num <= 0)) {
|
||||
syntax_error(s_MemoServ, u, "READ", MEMO_READ_SYNTAX);
|
||||
|
||||
} else if (mi->memocount == 0) {
|
||||
} else if (mi->memos.empty()) {
|
||||
if (chan)
|
||||
notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan);
|
||||
else
|
||||
@@ -99,8 +99,8 @@ int do_read(User * u)
|
||||
|
||||
if (stricmp(numstr, "NEW") == 0) {
|
||||
int readcount = 0;
|
||||
for (i = 0; i < mi->memocount; i++) {
|
||||
if (mi->memos[i].flags & MF_UNREAD) {
|
||||
for (i = 0; i < mi->memos.size(); i++) {
|
||||
if (mi->memos[i]->flags & MF_UNREAD) {
|
||||
read_memo(u, i, mi, chan);
|
||||
readcount++;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ int do_read(User * u)
|
||||
notice_lang(s_MemoServ, u, MEMO_HAVE_NO_NEW_MEMOS);
|
||||
}
|
||||
} else if (stricmp(numstr, "LAST") == 0) {
|
||||
for (i = 0; i < mi->memocount - 1; i++);
|
||||
for (i = 0; i < mi->memos.size() - 1; i++);
|
||||
read_memo(u, i, mi, chan);
|
||||
} else { /* number[s] */
|
||||
if (!process_numlist(numstr, &count, read_memo_callback, u,
|
||||
@@ -143,8 +143,8 @@ int read_memo_callback(User * u, int num, va_list args)
|
||||
const char *chan = va_arg(args, const char *);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mi->memocount; i++) {
|
||||
if (mi->memos[i].number == num)
|
||||
for (i = 0; i < mi->memos.size(); i++) {
|
||||
if (mi->memos[i]->number == num)
|
||||
break;
|
||||
}
|
||||
/* Range check done in read_memo */
|
||||
@@ -165,9 +165,9 @@ int read_memo(User * u, int index, MemoInfo * mi, const char *chan)
|
||||
char timebuf[64];
|
||||
struct tm tm;
|
||||
|
||||
if (index < 0 || index >= mi->memocount)
|
||||
if (index < 0 || index >= mi->memos.size())
|
||||
return 0;
|
||||
m = &mi->memos[index];
|
||||
m = mi->memos[index];
|
||||
tm = *localtime(&m->time);
|
||||
strftime_lang(timebuf, sizeof(timebuf),
|
||||
u, STRFTIME_DATE_TIME_FORMAT, &tm);
|
||||
|
||||
Reference in New Issue
Block a user