summaryrefslogtreecommitdiff
path: root/src/helperfuncs.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-03 00:25:28 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-03 00:25:28 +0000
commit38d7b5b0d9206e85dcf531036b863a0864c35f93 (patch)
tree076cb0083bfe6c2d58364c0a1c74f89e61fbfea3 /src/helperfuncs.cpp
parentc266d3e4b8201929a3b1c5c358fffb748b2b6c47 (diff)
*EXPERIMENTAL* <options:hidesplits> ircu-style quit munging for netsplits
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3031 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/helperfuncs.cpp')
-rw-r--r--src/helperfuncs.cpp39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 922d2b7f6..c6396705c 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -637,7 +637,6 @@ void WriteCommon_NoFormat(userrec *u, const char* text)
}
-
/* write a formatted string to all users who share at least one common
* channel, NOT including the source user e.g. for use in QUIT */
@@ -655,11 +654,34 @@ void WriteCommonExcept(userrec *u, char* text, ...)
}
char textbuffer[MAXBUF];
+ char oper_quit[MAXBUF];
+ bool quit_munge = false;
+
va_list argsPtr;
va_start (argsPtr, text);
- vsnprintf(textbuffer, MAXBUF, text, argsPtr);
+ int total = vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
+ if ((Config->HideSplits) && (total > 6))
+ {
+ /* Yeah yeah, this is ugly. But its fast, live with it. */
+ char* check = textbuffer;
+ if ((*check++ == 'Q') && (*check++ == 'U') && (*check++ == 'I') && (*check++ == 'T') && (*check++ == ' ') && (*check++ == ':'))
+ {
+ std::stringstream split(check);
+ std::string server_one;
+ std::string server_two;
+ split >> server_one;
+ split >> server_two;
+ if ((FindServerName(server_one)) && (FindServerName(server_two)))
+ {
+ strlcpy(oper_quit,textbuffer,MAXBUF);
+ strlcpy(check,"*.net *.split",MAXQUIT);
+ quit_munge = true;
+ }
+ }
+ }
+
memset(&already_sent,0,MAX_DESCRIPTORS);
unsigned int y = u->chans.size();
@@ -677,7 +699,18 @@ void WriteCommonExcept(userrec *u, char* text, ...)
if ((otheruser->fd > -1) && (!already_sent[otheruser->fd]))
{
already_sent[otheruser->fd] = 1;
- WriteFrom_NoFormat(otheruser->fd,u,textbuffer);
+ if (quit_munge)
+ {
+ if (*otheruser->oper)
+ {
+ WriteFrom_NoFormat(otheruser->fd,u,oper_quit);
+ }
+ else
+ {
+ WriteFrom_NoFormat(otheruser->fd,u,textbuffer);
+ }
+ }
+ else WriteFrom_NoFormat(otheruser->fd,u,textbuffer);
}
}
}