summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-04 17:16:22 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-04 17:16:22 +0000
commit4b7c157f63daae9c59170c8947c1caea48384cf3 (patch)
treefe978781296218a361c84600ea846a3be6fc2c2a /src
parent4ff0001c260adb74d5259de0f3b43334bdc7683b (diff)
Added notice-to-servermask
Added ability to output 'is an oper but i dont know what type' in WHOIS git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2152 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/commands.cpp42
-rw-r--r--src/helperfuncs.cpp40
-rw-r--r--src/modules/m_spanningtree.cpp2
3 files changed, 76 insertions, 8 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index c8aae6dfa..6c5998979 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -583,7 +583,18 @@ void handle_privmsg(char **parameters, int pcnt, userrec *user)
if (loop_call(handle_privmsg,parameters,pcnt,user,0,pcnt-2,0))
return;
- if (parameters[0][0] == '#')
+ if (parameters[0][0] == '$')
+ {
+ // notice to server mask
+ char* servermask = parameters[0];
+ servermask++;
+ if (match(ServerName,servermask))
+ {
+ ServerPrivmsgAll(parameters[1]);
+ }
+ return;
+ }
+ else if (parameters[0][0] == '#')
{
chan = FindChan(parameters[0]);
if (chan)
@@ -670,7 +681,18 @@ void handle_notice(char **parameters, int pcnt, userrec *user)
if (loop_call(handle_notice,parameters,pcnt,user,0,pcnt-2,0))
return;
- if (parameters[0][0] == '#')
+ if (parameters[0][0] == '$')
+ {
+ // notice to server mask
+ char* servermask = parameters[0];
+ servermask++;
+ if (match(ServerName,servermask))
+ {
+ ServerNoticeAll(parameters[1]);
+ }
+ return;
+ }
+ else if (parameters[0][0] == '#')
{
chan = FindChan(parameters[0]);
if (chan)
@@ -814,19 +836,25 @@ void handle_whois(char **parameters, int pcnt, userrec *user)
WriteServ(user->fd,"378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, dest->ip);
}
char* cl = chlist(dest,user);
- if (strcmp(cl,""))
+ if (*cl)
{
WriteServ(user->fd,"319 %s %s :%s",user->nick, dest->nick, cl);
}
WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, dest->server, GetServerDescription(dest->server).c_str());
- if (strcmp(dest->awaymsg,""))
+ if (*dest->awaymsg)
{
WriteServ(user->fd,"301 %s %s :%s",user->nick, dest->nick, dest->awaymsg);
}
- if ((strchr(dest->modes,'o')) && (strcmp(dest->oper,"")))
+ if (strchr(dest->modes,'o'))
{
- WriteServ(user->fd,"313 %s %s :is %s %s on %s",user->nick, dest->nick,
- (strchr("aeiou",dest->oper[0]) ? "an" : "a"),dest->oper, Network);
+ if (*dest->oper)
+ {
+ WriteServ(user->fd,"313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("aeiou",dest->oper[0]) ? "an" : "a"),dest->oper, Network);
+ }
+ else
+ {
+ WriteServ(user->fd,"313 %s %s :is opered but has an unknown type",user->nick, dest->nick);
+ }
}
FOREACH_MOD OnWhois(user,dest);
if (!strcasecmp(user->server,dest->server))
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index ea7b1f9dc..205121edd 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -516,6 +516,46 @@ void WriteOpers(char* text, ...)
}
}
+void ServerNoticeAll(char* text, ...)
+{
+ if (!text)
+ return;
+
+ char textbuffer[MAXBUF];
+ va_list argsPtr;
+ va_start (argsPtr, text);
+ vsnprintf(textbuffer, MAXBUF, text, argsPtr);
+ va_end(argsPtr);
+
+ for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++)
+ {
+ if ((i->second) && (i->second->fd != FD_MAGIC_NUMBER))
+ {
+ WriteServ(i->second->fd,"NOTICE $%s :%s",ServerName,textbuffer);
+ }
+ }
+}
+
+void ServerPrivmsgAll(char* text, ...)
+{
+ if (!text)
+ return;
+
+ char textbuffer[MAXBUF];
+ va_list argsPtr;
+ va_start (argsPtr, text);
+ vsnprintf(textbuffer, MAXBUF, text, argsPtr);
+ va_end(argsPtr);
+
+ for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++)
+ {
+ if ((i->second) && (i->second->fd != FD_MAGIC_NUMBER))
+ {
+ WriteServ(i->second->fd,"PRIVMSG $%s :%s",ServerName,textbuffer);
+ }
+ }
+}
+
void NoticeAllOpers(userrec *source, bool local_only, char* text, ...)
{
if ((!text) || (!source))
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 115264e84..d3f1c8229 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -1266,7 +1266,7 @@ bool DoOneToAllButSenderRaw(std::string data,std::string omit,std::string prefix
TreeServer* omitroute = BestRouteTo(omit);
if ((command == "NOTICE") || (command == "PRIVMSG"))
{
- if (params.size() >= 2)
+ if ((params.size() >= 2) && (*(params[0].c_str()) != '$'))
{
if (*(params[0].c_str()) != '#')
{