Saving a pointer in a map seems like a bad idea and means we have to delete all
the contained stuff by hand when the channel is destroyed. This requires us to
loop through the channel which is slow. A map is meant as a container, so use it
as one and directly save the stuff we want it to save in there.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2175 726aef4b-f618-498e-8847-2d620e286838
While a user is connecting to an IRC server, the CUser instance didn't know
about the CIRCSock instance (due to historic reasons). This meant that we needed
to use FindSockByName() when we had to check if there is any CIRCSock associated
with this user. However, this is a bad idea since FindSockByName() is O(n) on
the number of sockets that the socket manager is managing.
Instead, we now already set CUser::m_pIRCSock when the CIRCSock is created so
that checking for an irc socket becomes O(1).
This was inspired by the results of profiling a znc instance with 900 users.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2171 726aef4b-f618-498e-8847-2d620e286838
The following sequence triggered this bug:
/mode <chan> +ov-o <you> <you> <you>
The deop called CNick::RemPerm('@') which removed the '@' from the list of
perms via std::string::erase(<positiong of '@' in that string>). The bug was
that erase() by default erases till the end of the string, but we only wanted
to remove a single character. The fix is easy, just pass in '1' as a second
parameter. :)
Thanks to sp219 for finding and reporting this bug.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1547 726aef4b-f618-498e-8847-2d620e286838
CNick::GetPermStr() segfaulted if called on e.g. the CNick from OnChanMsg().
Thanks to stebi3 for the bug report via the sf.net bug tracker.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1491 726aef4b-f618-498e-8847-2d620e286838
This removes some not-so-important cache and uses a CString instead of a
set<unsigned char> for saving the flags this nick has (op, voice, ...).
set is huge!
Before the virtual removal (r1300), CNick had 144 bytes, without the virtuals
it only took 112 bytes. Now after this commit it is down to 40 bytes. (amd64)
Happy Christmas tomaw ;)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1302 726aef4b-f618-498e-8847-2d620e286838
If you were kicked from a channel and rejoined, you lost all your permissions
(op, voice...), but ZNC still cached the old one you had internally. This
wasn't noticed before, because this caches is not used much.
This was found via autoop which thought it had op in a channel and so tried to
give op to others.
Call chain is like this:
Receive KICK message -> pChan->SetIsOn(false) -> pChan->Reset()
CChan::Reset() now properly clears the cache.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1236 726aef4b-f618-498e-8847-2d620e286838
All the headers are now self-contained (g++ Header.h -o /dev/null).
Some system headers where moved to the .cpp they are actually needed in,
some of our own headers are includes less. (Especially MD5.h)
Headers are sorted alphabetically while in e.g. FileUtils.cpp FileUtils.h
is the first file included.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@915 726aef4b-f618-498e-8847-2d620e286838