diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands.cpp | 8 | ||||
-rw-r--r-- | src/connection.cpp | 5 | ||||
-rw-r--r-- | src/inspircd.cpp | 41 | ||||
-rw-r--r-- | src/users.cpp | 1 |
4 files changed, 42 insertions, 13 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index 05e0a951c..d66c21125 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1876,9 +1876,13 @@ void handle_V(char token,char* params,serverrec* source,serverrec* reply, char* if (user) { // notice all - only issuable by a server - if (!strcmp(dest,"*")) + if (!strcmp(dest,"*")) + { + NoticeAll(user,true,"%s",text); + } + if (!strcmp(dest,"@*")) { - NoticeAll(user,true,"%s",text); + NoticeAllOpers(user,true,"%s",text); } else { diff --git a/src/connection.cpp b/src/connection.cpp index 5cdd83f7f..debd3144f 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -546,8 +546,3 @@ bool connection::RecvPacket(std::deque<std::string> &messages, char* recvhost) return false; } -long connection::GenKey() -{ - return (random()*time(NULL)); -} - diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 2671de21b..2a15f265c 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -197,10 +197,6 @@ int portCount = 0, UDPportCount = 0, ports[MAXSOCKS]; int defaultRoute = 0; char ModPath[MAXBUF]; -connection C; - -long MyKey = C.GenKey(); - /* prototypes */ int has_channel(userrec *u, chanrec *c); @@ -947,6 +943,41 @@ void WriteOpers(char* text, ...) } } +void NoticeAllOpers(userrec *source, bool local_only, char* text, ...) +{ + if ((!text) || (!source)) + { + log(DEFAULT,"*** BUG *** NoticeAllOpers was given an invalid parameter"); + return; + } + + char textbuffer[MAXBUF]; + va_list argsPtr; + va_start (argsPtr, text); + vsnprintf(textbuffer, MAXBUF, text, argsPtr); + va_end(argsPtr); + + for (std::vector<userrec*>::iterator i = all_opers.begin(); i != all_opers.end(); i++) + { + userrec* a = *i; + if ((a) && (a->fd != FD_MAGIC_NUMBER)) + { + if (strchr(a->modes,'s')) + { + // send server notices to all with +s + WriteServ(a->fd,"NOTICE %s :*** Notice From %s: %s",a->nick,source->nick,textbuffer); + } + } + } + + if (!local_only) + { + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"V %s @* :%s",source->nick,textbuffer); + NetSendToAll(buffer); + } +} + // returns TRUE of any users on channel C occupy server 'servername'. bool ChanAnyOnThisServer(chanrec *c,char* servername) @@ -1181,7 +1212,7 @@ void NoticeAll(userrec *source, bool local_only, char* text, ...) { if ((!text) || (!source)) { - log(DEFAULT,"*** BUG *** WriteOpers was given an invalid parameter"); + log(DEFAULT,"*** BUG *** NoticeAll was given an invalid parameter"); return; } diff --git a/src/users.cpp b/src/users.cpp index 0d305a3b7..7348c6db3 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -202,7 +202,6 @@ void userrec::ClearBuffer() std::string userrec::GetBuffer() { - log(DEBUG,"GetBuffer\n%s\n",recvq.c_str()); char* line = (char*)recvq.c_str(); std::string ret = ""; while ((*line != '\n') && (strlen(line))) |