From: <arn...@us...> - 2008-02-13 22:06:36
|
Revision: 1007 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1007&view=rev Author: arnetheduck Date: 2008-02-13 14:06:33 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Bugfixes Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/ClientListener.h dcplusplus/trunk/dcpp/NmdcHub.cpp dcplusplus/trunk/dcpp/ShareManager.cpp dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/HubFrame.h dcplusplus/trunk/win32/QueueFrame.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/changelog.txt 2008-02-13 22:06:33 UTC (rev 1007) @@ -28,8 +28,9 @@ * [ADC] Added /me handling (thanks poy) * Fixed issues with scrolling (thanks poy) * Fixed re-add sources showing wrong sources (thanks poy) -* Partially fixed kick message filtering (thanks mikejj) +* Fixed kick message filtering (thanks mikejj) * version.xml now use Coral (ullner) +* [ADC] Number of files counts unique files when sending stats to hub -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2008-02-13 22:06:33 UTC (rev 1007) @@ -136,8 +136,8 @@ if(!c.getParam("NI", 0, nick)) { nick = "[nick unknown]"; } - fire(ClientListener::StatusMessage(), this, u->getIdentity().getNick() + " (" + u->getIdentity().getSIDString() + - ") has same CID {" + cid + "} as " + nick + " (" + AdcCommand::fromSID(c.getFrom()) + "), ignoring."); + fire(ClientListener::StatusMessage(), this, str(F_("%1% (%2%) has same CID {%3%} as %4% (%5%), ignoring") + % u->getIdentity().getNick() % u->getIdentity().getSIDString() % cid % nick % AdcCommand::fromSID(c.getFrom()))); return; } } else { @@ -203,13 +203,13 @@ } if(!baseOk) { - fire(ClientListener::StatusMessage(), this, "Failed to negotiate base protocol"); // @todo internationalize + fire(ClientListener::StatusMessage(), this, _("Failed to negotiate base protocol")); socket->disconnect(false); return; } else if(!tigrOk) { oldPassword = true; // Some hubs fake BASE support without TIGR support =/ - fire(ClientListener::StatusMessage(), this, "Hub probably uses an old version of ADC, please encourage the owner to upgrade"); + fire(ClientListener::StatusMessage(), this, _("Hub probably uses an old version of ADC, please encourage the owner to upgrade")); } } @@ -263,13 +263,35 @@ void AdcHub::handle(AdcCommand::QUI, AdcCommand& c) throw() { uint32_t s = AdcCommand::toSID(c.getParam(0)); - putUser(s); // @todo: use the DI flag - + + OnlineUser* victim = findUser(s); + if(!victim) { + return; + } + string tmp; if(c.getParam("MS", 1, tmp)) { - fire(ClientListener::StatusMessage(), this, tmp); + OnlineUser* source = 0; + string tmp2; + if(c.getParam("ID", 1, tmp2)) { + source = findUser(AdcCommand::toSID(tmp2)); + } + + if(source) { + tmp = str(F_("%1% was kicked by %2%: %3%") % victim->getIdentity().getNick() % + source->getIdentity().getNick() % tmp); + } else { + tmp = str(F_("%1% was kicked: %2%") % victim->getIdentity().getNick() % tmp); + } + fire(ClientListener::StatusMessage(), this, tmp, ClientListener::FLAG_IS_SPAM); } + + if(c.hasFlag("DI", 1)) { + ConnectionManager::getInstance()->disconnect(victim->getUser(), false); + } + putUser(s); + if(s == sid) { if(c.getParam("TL", 1, tmp)) { if(tmp == "-1") { Modified: dcplusplus/trunk/dcpp/ClientListener.h =================================================================== --- dcplusplus/trunk/dcpp/ClientListener.h 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/dcpp/ClientListener.h 2008-02-13 22:06:33 UTC (rev 1007) @@ -29,6 +29,11 @@ typedef X<17> SearchFlood; typedef X<18> NmdcSearch; typedef X<19> AdcSearch; + + enum StatusFlags { + FLAG_NORMAL = 0x00, + FLAG_IS_SPAM = 0x01 + }; virtual void on(Connecting, Client*) throw() { } virtual void on(Connected, Client*) throw() { } @@ -40,7 +45,7 @@ virtual void on(GetPassword, Client*) throw() { } virtual void on(HubUpdated, Client*) throw() { } virtual void on(Message, Client*, const OnlineUser&, const string&, bool = false) throw() { } - virtual void on(StatusMessage, Client*, const string&) throw() { } + virtual void on(StatusMessage, Client*, const string&, int = FLAG_NORMAL) throw() { } virtual void on(PrivateMessage, Client*, const OnlineUser&, const OnlineUser&, const OnlineUser&, const string&, bool = false) throw() { } virtual void on(HubUserCommand, Client*, int, int, const string&, const string&) throw() { } virtual void on(HubFull, Client*) throw() { } Modified: dcplusplus/trunk/dcpp/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-02-13 22:06:33 UTC (rev 1007) @@ -198,6 +198,14 @@ return; } + if((line.find("Hub-Security") != string::npos) && (line.find("was kicked by") != string::npos)) { + fire(ClientListener::StatusMessage(), this, unescape(line), ClientListener::FLAG_IS_SPAM); + return; + } else if((line.find("is kicking") != string::npos) && (line.find("because:") != string::npos)) { + fire(ClientListener::StatusMessage(), this, unescape(line), ClientListener::FLAG_IS_SPAM); + return; + } + OnlineUser* ou = findUser(nick); if(ou) { fire(ClientListener::Message(), this, *ou, unescape(message)); Modified: dcplusplus/trunk/dcpp/ShareManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.cpp 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/dcpp/ShareManager.cpp 2008-02-13 22:06:33 UTC (rev 1007) @@ -507,11 +507,7 @@ size_t ShareManager::getSharedFiles() const throw() { Lock l(cs); - size_t tmp = 0; - for(Directory::Map::const_iterator i = directories.begin(); i != directories.end(); ++i) { - tmp += i->second->countFiles(); - } - return tmp; + return tthIndex.size(); } class FileFindIter { Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-13 22:06:33 UTC (rev 1007) @@ -877,23 +877,17 @@ } void HubFrame::on(Message, Client*, const OnlineUser& from, const string& msg, bool thirdPerson) throw() { - if(SETTING(FILTER_MESSAGES)) { - if((msg.find("Hub-Security") != string::npos) && (msg.find("was kicked by") != string::npos)) { - // Do nothing... - } else if((msg.find("is kicking") != string::npos) && (msg.find("because:") != string::npos)) { - speak(ADD_SILENT_STATUS_LINE, msg); - } else { - speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson)); - } + speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson)); +} + +void HubFrame::on(StatusMessage, Client*, const string& line, int statusFlags) throw() { + if(SETTING(FILTER_MESSAGES) && (statusFlags & ClientListener::FLAG_IS_SPAM)) { + speak(ADD_SILENT_STATUS_LINE, line); } else { - speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson)); + speak(ADD_STATUS_LINE, line); } } -void HubFrame::on(StatusMessage, Client*, const string& line) throw() { - speak(ADD_CHAT_LINE, line); -} - void HubFrame::on(PrivateMessage, Client*, const OnlineUser& from, const OnlineUser& to, const OnlineUser& replyTo, const string& line, bool thirdPerson) throw() { speak(from, to, replyTo, Util::formatMessage(from.getIdentity().getNick(), line, thirdPerson)); } Modified: dcplusplus/trunk/win32/HubFrame.h =================================================================== --- dcplusplus/trunk/win32/HubFrame.h 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/win32/HubFrame.h 2008-02-13 22:06:33 UTC (rev 1007) @@ -275,7 +275,7 @@ virtual void on(GetPassword, Client*) throw(); virtual void on(HubUpdated, Client*) throw(); virtual void on(Message, Client*, const OnlineUser&, const string&, bool = false) throw(); - virtual void on(StatusMessage, Client*, const string&) throw(); + virtual void on(StatusMessage, Client*, const string&, int = ClientListener::FLAG_NORMAL) throw(); virtual void on(PrivateMessage, Client*, const OnlineUser&, const OnlineUser&, const OnlineUser&, const string&, bool = false) throw(); virtual void on(NickTaken, Client*) throw(); virtual void on(SearchFlood, Client*, const string&) throw(); Modified: dcplusplus/trunk/win32/QueueFrame.cpp =================================================================== --- dcplusplus/trunk/win32/QueueFrame.cpp 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/win32/QueueFrame.cpp 2008-02-13 22:06:33 UTC (rev 1007) @@ -811,7 +811,7 @@ QueueItemInfo* ii = files->getSelectedData(); if(!user) { - for(QueueItem::SourceIter si = ii->getSources().begin(); si != ii->getSources().end(); ) { + for(QueueItem::SourceIter si = ii->getSources().begin(); si != ii->getSources().end(); ++si) { QueueManager::getInstance()->removeSource(ii->getTarget(), si->getUser(), QueueItem::Source::FLAG_REMOVED); } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |