mirror of
https://github.com/anope/anope.git
synced 2026-06-28 12:36:39 +02:00
Replaced notice() with direct call to SendMessage() in IRCDProto class.
Added SendNoticeInternal() function to IRCDProto class, now SendNotice() is a stub to handle varargs. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1336 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -1110,8 +1110,6 @@ E int db_mysql_load_news(void);
|
||||
E unsigned int mysql_rand(void);
|
||||
#endif
|
||||
|
||||
E void notice(char *source, const char *dest, const char *fmt, ...);
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
E void anope_cmd_capab(); /* CAPAB */
|
||||
|
||||
+15
-3
@@ -1239,7 +1239,11 @@ class IRCDProto {
|
||||
if (NSDefFlags & NI_MSG)
|
||||
SendPrivmsgInternal(bi, dest, buf);
|
||||
else
|
||||
SendNotice(bi, dest, buf);
|
||||
SendNoticeInternal(bi, dest, buf);
|
||||
}
|
||||
virtual void SendNoticeInternal(BotInfo *bi, const char *dest, const char *msg)
|
||||
{
|
||||
send_cmd(UseTS6 ? bi->uid : bi->nick, "NOTICE %s :%s", dest, msg);
|
||||
}
|
||||
virtual void SendPrivmsgInternal(BotInfo *bi, const char *dest, const char *buf)
|
||||
{
|
||||
@@ -1310,9 +1314,17 @@ class IRCDProto {
|
||||
BotInfo *bi = findbot(source);
|
||||
SendMessageInternal(bi, dest, buf);
|
||||
}
|
||||
virtual void SendNotice(BotInfo *bi, const char *dest, const char *msg)
|
||||
virtual void SendNotice(const char *source, const char *dest, const char *fmt, ...)
|
||||
{
|
||||
send_cmd(UseTS6 ? bi->uid : bi->nick, "NOTICE %s :%s", dest, msg);
|
||||
va_list args;
|
||||
char buf[BUFSIZE] = "";
|
||||
if (fmt) {
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buf, BUFSIZE - 1, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
BotInfo *bi = findbot(source);
|
||||
SendNoticeInternal(bi, dest, buf);
|
||||
}
|
||||
virtual void SendPrivmsg(const char *source, const char *dest, const char *fmt, ...)
|
||||
{
|
||||
|
||||
+2
-2
@@ -341,7 +341,7 @@ int do_util(User * u, CSModeUtil * util)
|
||||
chan_set_modes(s_ChanServ, uc->chan, 2, av, 2);
|
||||
|
||||
if (util->notice && ci->flags & util->notice)
|
||||
notice(whosends(ci), uc->chan->name,
|
||||
ircdproto->SendMessage(whosends(ci), uc->chan->name,
|
||||
"%s command used for %s by %s", util->name,
|
||||
u->nick, u->nick);
|
||||
}
|
||||
@@ -381,7 +381,7 @@ int do_util(User * u, CSModeUtil * util)
|
||||
chan_set_modes(s_ChanServ, c, 2, av, 2);
|
||||
|
||||
if (util->notice && ci->flags & util->notice)
|
||||
notice(whosends(ci), c->name, "%s command used for %s by %s",
|
||||
ircdproto->SendMessage(whosends(ci), c->name, "%s command used for %s by %s",
|
||||
util->name, u2->nick, u->nick);
|
||||
}
|
||||
return MOD_CONT;
|
||||
|
||||
@@ -92,7 +92,7 @@ void my_cs_help(User * u)
|
||||
int my_cs_help_appendtopic(User * u)
|
||||
{
|
||||
moduleNoticeLang(s_ChanServ, u, LNG_APPENDTOPIC_SYNTAX);
|
||||
notice(s_ChanServ, u->nick, " ");
|
||||
ircdproto->SendMessage(s_ChanServ, u->nick, " ");
|
||||
moduleNoticeLang(s_ChanServ, u, LNG_CHAN_HELP_APPENDTOPIC);
|
||||
return MOD_STOP;
|
||||
}
|
||||
|
||||
@@ -254,9 +254,9 @@ void my_cs_help(User * u)
|
||||
int my_cs_help_enforce(User * u)
|
||||
{
|
||||
moduleNoticeLang(s_ChanServ, u, LNG_ENFORCE_SYNTAX);
|
||||
notice(s_ChanServ, u->nick, " ");
|
||||
ircdproto->SendMessage(s_ChanServ, u->nick, " ");
|
||||
moduleNoticeLang(s_ChanServ, u, LNG_CHAN_HELP_ENFORCE);
|
||||
notice(s_ChanServ, u->nick, " ");
|
||||
ircdproto->SendMessage(s_ChanServ, u->nick, " ");
|
||||
if (cbmodes['R'].flag != 0)
|
||||
moduleNoticeLang(s_ChanServ, u, LNG_CHAN_HELP_ENFORCE_R_ENABLED);
|
||||
else
|
||||
|
||||
@@ -79,7 +79,7 @@ void myFullHelpSyntax(User * u)
|
||||
int myFullHelp(User * u)
|
||||
{
|
||||
myFullHelpSyntax(u);
|
||||
notice(s_ChanServ, u->nick, "");
|
||||
ircdproto->SendMessage(s_ChanServ, u->nick, " ");
|
||||
moduleNoticeLang(s_ChanServ, u, TBAN_HELP_DETAIL);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ void show_list(User * u)
|
||||
int hs_help_request(User * u)
|
||||
{
|
||||
moduleNoticeLang(s_HostServ, u, LNG_REQUEST_SYNTAX);
|
||||
notice(s_HostServ, u->nick, " ");
|
||||
ircdproto->SendMessage(s_HostServ, u->nick, " ");
|
||||
moduleNoticeLang(s_HostServ, u, LNG_HELP_REQUEST);
|
||||
|
||||
return MOD_CONT;
|
||||
@@ -539,7 +539,7 @@ int hs_help_activate(User * u)
|
||||
{
|
||||
if (is_host_setter(u)) {
|
||||
moduleNoticeLang(s_HostServ, u, LNG_ACTIVATE_SYNTAX);
|
||||
notice(s_HostServ, u->nick, " ");
|
||||
ircdproto->SendMessage(s_HostServ, u->nick, " ");
|
||||
moduleNoticeLang(s_HostServ, u, LNG_HELP_ACTIVATE);
|
||||
if (HSRequestMemoUser)
|
||||
moduleNoticeLang(s_HostServ, u, LNG_HELP_ACTIVATE_MEMO);
|
||||
@@ -554,7 +554,7 @@ int hs_help_reject(User * u)
|
||||
{
|
||||
if (is_host_setter(u)) {
|
||||
moduleNoticeLang(s_HostServ, u, LNG_REJECT_SYNTAX);
|
||||
notice(s_HostServ, u->nick, " ");
|
||||
ircdproto->SendMessage(s_HostServ, u->nick, " ");
|
||||
moduleNoticeLang(s_HostServ, u, LNG_HELP_REJECT);
|
||||
if (HSRequestMemoUser)
|
||||
moduleNoticeLang(s_HostServ, u, LNG_HELP_REJECT_MEMO);
|
||||
@@ -569,7 +569,7 @@ int hs_help_waiting(User * u)
|
||||
{
|
||||
if (is_host_setter(u)) {
|
||||
moduleNoticeLang(s_HostServ, u, LNG_WAITING_SYNTAX);
|
||||
notice(s_HostServ, u->nick, " ");
|
||||
ircdproto->SendMessage(s_HostServ, u->nick, " ");
|
||||
moduleNoticeLang(s_HostServ, u, LNG_HELP_WAITING);
|
||||
} else {
|
||||
notice_lang(s_HostServ, u, NO_HELP_AVAILABLE, "WAITING");
|
||||
@@ -692,7 +692,7 @@ int hsreqevt_db_backup(int argc, char **argv)
|
||||
else
|
||||
ModuleDatabaseBackup(HSREQ_DEFAULT_DBNAME);
|
||||
}
|
||||
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
|
||||
-29
@@ -265,32 +265,3 @@ void notice_help(const char *source, User * dest, int message, ...)
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Send a NOTICE from the given source to the given nick.
|
||||
* @param source Orgin of the Message
|
||||
* @param dest Destination of the Message
|
||||
* @param fmt Format of the Message
|
||||
* @param ... any number of parameters
|
||||
* @return void
|
||||
*/
|
||||
void notice(char *source, const char *dest, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[BUFSIZE];
|
||||
*buf = '\0';
|
||||
|
||||
if (fmt) {
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buf, BUFSIZE - 1, fmt, args);
|
||||
|
||||
if (NSDefFlags & NI_MSG) {
|
||||
ircdproto->SendPrivmsg(source, dest, buf);
|
||||
} else {
|
||||
ircdproto->SendNotice(source, dest, buf);
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -223,9 +223,9 @@ int add_session(const char *nick, const char *host, char *hostip)
|
||||
|
||||
if (sessionlimit != 0 && session->count >= sessionlimit) {
|
||||
if (SessionLimitExceeded)
|
||||
notice(s_OperServ, nick, SessionLimitExceeded, host);
|
||||
ircdproto->SendMessage(s_OperServ, nick, SessionLimitExceeded, host);
|
||||
if (SessionLimitDetailsLoc)
|
||||
notice(s_OperServ, nick, "%s", SessionLimitDetailsLoc);
|
||||
ircdproto->SendMessage(s_OperServ, nick, "%s", SessionLimitDetailsLoc);
|
||||
|
||||
/* We don't use kill_user() because a user stucture has not yet
|
||||
* been created. Simply kill the user. -TheShadow
|
||||
|
||||
+6
-6
@@ -6,9 +6,9 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
* $Id$
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -27,13 +27,13 @@ int send_timeout_list(User * u)
|
||||
{
|
||||
Timeout *to, *last;
|
||||
|
||||
notice(s_OperServ, u->nick, "Now: %ld", (long int) time(NULL));
|
||||
ircdproto->SendMessage(s_OperServ, u->nick, "Now: %ld", (long int) time(NULL));
|
||||
for (to = timeouts, last = NULL; to; last = to, to = to->next) {
|
||||
notice(s_OperServ, u->nick, "0x%p: %ld: 0x%p (0x%p)",
|
||||
ircdproto->SendMessage(s_OperServ, u->nick, "0x%p: %ld: 0x%p (0x%p)",
|
||||
(void *) to, (long int) to->timeout, (void *) to->code,
|
||||
(void *) to->data);
|
||||
if (to->prev != last)
|
||||
notice(s_OperServ, u->nick,
|
||||
ircdproto->SendMessage(s_OperServ, u->nick,
|
||||
" to->prev incorrect! expected=0x%p seen=0x%p",
|
||||
(void *) last, (void *) to->prev);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user