summaryrefslogtreecommitdiff
path: root/src/message.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-09 10:04:58 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-09 10:04:58 +0000
commite964e2286d78ab691078db40e402f685561ef0ca (patch)
tree867b2a013238ef4aa0d4757ce949b15ad84f1393 /src/message.cpp
parentd91d734257619e26918b4da8153af42cd4f316de (diff)
common_channels -> userrec::SharesChannelWith()
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4805 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/message.cpp')
-rw-r--r--src/message.cpp35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/message.cpp b/src/message.cpp
index a786c60cb..9b56cc8ca 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -48,41 +48,6 @@ extern std::vector<ircd_module*> factory;
extern time_t TIME;
extern ServerConfig* Config;
-/* return 0 or 1 depending if users u and u2 share one or more common channels
- * (used by QUIT, NICK etc which arent channel specific notices)
- *
- * The old algorithm in 1.0 for this was relatively inefficient, iterating over
- * the first users channels then the second users channels within the outer loop,
- * therefore it was a maximum of x*y iterations (upon returning 0 and checking
- * all possible iterations). However this new function instead checks against the
- * channel's userlist in the inner loop which is a std::map<userrec*,userrec*>
- * and saves us time as we already know what pointer value we are after.
- * Don't quote me on the maths as i am not a mathematician or computer scientist,
- * but i believe this algorithm is now x+(log y) maximum iterations instead.
- */
-int common_channels(userrec *u, userrec *u2)
-{
- if ((!u) || (!u2) || (u->registered != REG_ALL) || (u2->registered != REG_ALL))
- return 0;
-
- /* Outer loop */
- for (std::vector<ucrec*>::const_iterator i = u->chans.begin(); i != u->chans.end(); i++)
- {
- /* Fetch the channel from the user */
- ucrec* user_channel = *i;
-
- if (user_channel->channel)
- {
- /* Eliminate the inner loop (which used to be ~equal in size to the outer loop)
- * by replacing it with a map::find which *should* be more efficient
- */
- if (user_channel->channel->HasUser(u2))
- return 1;
- }
- }
- return 0;
-}
-
void Blocking(int s)
{
int flags = fcntl(s, F_GETFL, 0);