From: <arn...@us...> - 2006-07-12 10:19:44
|
Revision: 638 Author: arnetheduck Date: 2006-07-12 03:19:01 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/dcplusplus/?rev=638&view=rev Log Message: ----------- PM fixes, autodisconnect fixes Modified Paths: -------------- dcplusplus/trunk/Example.xml dcplusplus/trunk/changelog.txt dcplusplus/trunk/client/NmdcHub.cpp dcplusplus/trunk/client/SettingsManager.cpp dcplusplus/trunk/client/SettingsManager.h dcplusplus/trunk/client/StringDefs.cpp dcplusplus/trunk/client/StringDefs.h dcplusplus/trunk/client/UploadManager.cpp dcplusplus/trunk/client/UploadManager.h dcplusplus/trunk/client/User.h dcplusplus/trunk/help/changelog.html dcplusplus/trunk/windows/HubFrame.cpp dcplusplus/trunk/windows/HubFrame.h dcplusplus/trunk/windows/WindowsPage.cpp Modified: dcplusplus/trunk/Example.xml =================================================================== --- dcplusplus/trunk/Example.xml 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/Example.xml 2006-07-12 10:19:01 UTC (rev 638) @@ -438,7 +438,8 @@ <String Name="SettingsGeneral">Personal information</String> <String Name="SettingsGetUserCountry">Guess user country from IP</String> <String Name="SettingsHubUserCommands">Accept custom user commands from hub</String> - <String Name="SettingsIgnoreOffline">Ignore private messages from offline users</String> + <String Name="SettingsIgnoreHubPms">Ignore private messages from the hub</String> + <String Name="SettingsIgnoreBotPms">Ignore private messages from bots</String> <String Name="SettingsIncoming">Incoming connection settings (see Help/FAQ if unsure)</String> <String Name="SettingsKeepLists">Don't delete file lists when exiting</String> <String Name="SettingsLanguageFile">Language file</String> @@ -475,7 +476,8 @@ <String Name="SettingsPmHistory">PM history</String> <String Name="SettingsPopunderFilelist">Open new file list windows in the background</String> <String Name="SettingsPopunderPm">Open new private message windows in the background</String> - <String Name="SettingsPopupOffline">Open private messages from offline users in their own window</String> + <String Name="SettingsPopupBotPms">Open private messages from the hub in their own window</String> + <String Name="SettingsPopupHubPms">Open private messages from bots in their own window</String> <String Name="SettingsPopupPms">Open private messages in their own window</String> <String Name="SettingsPorts">Ports</String> <String Name="SettingsPromptPassword">Popup box to input password for hubs</String> Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/changelog.txt 2006-07-12 10:19:01 UTC (rev 638) @@ -1,4 +1,10 @@ --- 0.694 2006-07-10 -- +-- -- +* PM popup/ignore options updated, in nmdc a hub is any nick which hasn't sent a hello or myinfo, and a bot is a nick with myinfo + without connection type +* [bug 125] Fixed out-of-order PM/quit +* [bug 224] Slots are no longer granted to disconnected users, instead disconnection is delayed a minute + +-- 0.694 2006-07-10 -- * Fixed crash in certificates page * [bug 1005] Fixed linux compile issue (thanks tpo) * [bug 1004] Fixed browse file list on self Modified: dcplusplus/trunk/client/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/client/NmdcHub.cpp 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/client/NmdcHub.cpp 2006-07-12 10:19:01 UTC (rev 638) @@ -206,7 +206,13 @@ if(ou) { fire(ClientListener::Message(), this, *ou, unescape(line.substr(i+1))); } else { - fire(ClientListener::StatusMessage(), this, unescape(line)); + OnlineUser& o = getUser(nick); + // Assume that messages from unknown users come from the hub + o.getIdentity().setHub(true); + o.getIdentity().setHidden(true); + fire(ClientListener::UserUpdated(), this, o); + + fire(ClientListener::Message(), this, o, unescape(line.substr(i+1))); } return; } @@ -354,10 +360,14 @@ if(connection.empty()) { // No connection = bot... u.getUser()->setFlag(User::BOT); + u.getIdentity().setHub(false); } else { u.getUser()->unsetFlag(User::BOT); + u.getIdentity().setBot(false); } + u.getIdentity().setHub(false); + u.getIdentity().setConnection(connection); i = j + 1; j = param.find('$', i); @@ -663,16 +673,33 @@ if(fromNick.empty()) return; - OnlineUser* replyTo = findUser(rtNick); + OnlineUser* replyTo = findUser(rtNick); OnlineUser* from = findUser(fromNick); - OnlineUser* to = findUser(getMyNick()); + OnlineUser& to = getUser(getMyNick()); - if(replyTo == NULL || from == NULL || to == NULL) { - fire(ClientListener::StatusMessage(), this, unescape(param.substr(i))); - } else { - string msg = param.substr(j + 2); - fire(ClientListener::PrivateMessage(), this, *from, *to, *replyTo, unescape(param.substr(j + 2))); - } + string msg = param.substr(j + 2); + if(replyTo == NULL || from == NULL) { + if(replyTo == 0) { + // Assume it's from the hub + replyTo = &getUser(rtNick); + replyTo->getIdentity().setHub(true); + replyTo->getIdentity().setHidden(true); + fire(ClientListener::UserUpdated(), this, *replyTo); + } + if(from == 0) { + // Assume it's from the hub + from = &getUser(rtNick); + from->getIdentity().setHub(true); + from->getIdentity().setHidden(true); + fire(ClientListener::UserUpdated(), this, *from); + } + + // Update pointers just in case they've been invalidated + replyTo = findUser(rtNick); + from = findUser(fromNick); + + } + fire(ClientListener::PrivateMessage(), this, *from, to, *replyTo, unescape(msg)); } else if(cmd == "$GetPass") { OnlineUser& ou = getUser(getMyNick()); ou.getIdentity().set("RG", "1"); Modified: dcplusplus/trunk/client/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/client/SettingsManager.cpp 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/client/SettingsManager.cpp 2006-07-12 10:19:01 UTC (rev 638) @@ -49,7 +49,7 @@ // Ints "IncomingConnections", "InPort", "Slots", "Rollback", "AutoFollow", "ClearSearch", "BackgroundColor", "TextColor", "UseOemMonoFont", "ShareHidden", "FilterMessages", "MinimizeToTray", - "AutoSearch", "TimeStamps", "ConfirmExit", "IgnoreOffline", "PopupOffline", + "AutoSearch", "TimeStamps", "ConfirmExit", "PopupHubPms", "PopupBotPms", "IgnoreHubPms", "IgnoreBotPms", "ListDuplicates", "BufferSize", "DownloadSlots", "MaxDownloadSpeed", "LogMainChat", "LogPrivateChat", "LogDownloads", "LogUploads", "StatusInChat", "ShowJoins", "PrivateMessageBeep", "PrivateMessageBeepOpen", "UseSystemIcons", "PopupPMs", "MinUploadSpeed", "GetUserInfo", "UrlHandler", "MainWindowState", @@ -128,8 +128,10 @@ setDefault(AUTO_SEARCH, false); setDefault(TIME_STAMPS, false); setDefault(CONFIRM_EXIT, true); - setDefault(IGNORE_OFFLINE, false); - setDefault(POPUP_OFFLINE, false); + setDefault(POPUP_HUB_PMS, true); + setDefault(POPUP_BOT_PMS, true); + setDefault(IGNORE_HUB_PMS, false); + setDefault(IGNORE_BOT_PMS, false); setDefault(LIST_DUPES, true); setDefault(BUFFER_SIZE, 64); setDefault(HUBLIST_SERVERS, "http://www.hublist.org/PublicHubList.xml.bz2;http://dc.selwerd.nl/hublist.xml.bz2"); Modified: dcplusplus/trunk/client/SettingsManager.h =================================================================== --- dcplusplus/trunk/client/SettingsManager.h 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/client/SettingsManager.h 2006-07-12 10:19:01 UTC (rev 638) @@ -65,7 +65,7 @@ enum IntSetting { INT_FIRST = STR_LAST + 1, INCOMING_CONNECTIONS = INT_FIRST, TCP_PORT, SLOTS, ROLLBACK, AUTO_FOLLOW, CLEAR_SEARCH, BACKGROUND_COLOR, TEXT_COLOR, USE_OEM_MONOFONT, SHARE_HIDDEN, FILTER_MESSAGES, MINIMIZE_TRAY, - AUTO_SEARCH, TIME_STAMPS, CONFIRM_EXIT, IGNORE_OFFLINE, POPUP_OFFLINE, + AUTO_SEARCH, TIME_STAMPS, CONFIRM_EXIT, POPUP_HUB_PMS, POPUP_BOT_PMS, IGNORE_HUB_PMS, IGNORE_BOT_PMS, LIST_DUPES, BUFFER_SIZE, DOWNLOAD_SLOTS, MAX_DOWNLOAD_SPEED, LOG_MAIN_CHAT, LOG_PRIVATE_CHAT, LOG_DOWNLOADS, LOG_UPLOADS, STATUS_IN_CHAT, SHOW_JOINS, PRIVATE_MESSAGE_BEEP, PRIVATE_MESSAGE_BEEP_OPEN, USE_SYSTEM_ICONS, POPUP_PMS, MIN_UPLOAD_SPEED, GET_USER_INFO, URL_HANDLER, MAIN_WINDOW_STATE, Modified: dcplusplus/trunk/client/StringDefs.cpp =================================================================== --- dcplusplus/trunk/client/StringDefs.cpp 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/client/StringDefs.cpp 2006-07-12 10:19:01 UTC (rev 638) @@ -439,7 +439,8 @@ "Personal information", "Guess user country from IP", "Accept custom user commands from hub", -"Ignore private messages from offline users", +"Ignore private messages from the hub", +"Ignore private messages from bots", "Incoming connection settings (see Help/FAQ if unsure)", "Don't delete file lists when exiting", "Language file", @@ -476,7 +477,8 @@ "PM history", "Open new file list windows in the background", "Open new private message windows in the background", -"Open private messages from offline users in their own window", +"Open private messages from the hub in their own window", +"Open private messages from bots in their own window", "Open private messages in their own window", "Ports", "Popup box to input password for hubs", @@ -1061,7 +1063,8 @@ "SettingsGeneral", "SettingsGetUserCountry", "SettingsHubUserCommands", -"SettingsIgnoreOffline", +"SettingsIgnoreHubPms", +"SettingsIgnoreBotPms", "SettingsIncoming", "SettingsKeepLists", "SettingsLanguageFile", @@ -1098,7 +1101,8 @@ "SettingsPmHistory", "SettingsPopunderFilelist", "SettingsPopunderPm", -"SettingsPopupOffline", +"SettingsPopupBotPms", +"SettingsPopupHubPms", "SettingsPopupPms", "SettingsPorts", "SettingsPromptPassword", Modified: dcplusplus/trunk/client/StringDefs.h =================================================================== --- dcplusplus/trunk/client/StringDefs.h 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/client/StringDefs.h 2006-07-12 10:19:01 UTC (rev 638) @@ -442,7 +442,8 @@ SETTINGS_GENERAL, // "Personal information" SETTINGS_GET_USER_COUNTRY, // "Guess user country from IP" SETTINGS_HUB_USER_COMMANDS, // "Accept custom user commands from hub" - SETTINGS_IGNORE_OFFLINE, // "Ignore private messages from offline users" + SETTINGS_IGNORE_HUB_PMS, // "Ignore private messages from the hub" + SETTINGS_IGNORE_BOT_PMS, // "Ignore private messages from bots" SETTINGS_INCOMING, // "Incoming connection settings (see Help/FAQ if unsure)" SETTINGS_KEEP_LISTS, // "Don't delete file lists when exiting" SETTINGS_LANGUAGE_FILE, // "Language file" @@ -479,7 +480,8 @@ SETTINGS_PM_HISTORY, // "PM history" SETTINGS_POPUNDER_FILELIST, // "Open new file list windows in the background" SETTINGS_POPUNDER_PM, // "Open new private message windows in the background" - SETTINGS_POPUP_OFFLINE, // "Open private messages from offline users in their own window" + SETTINGS_POPUP_BOT_PMS, // "Open private messages from the hub in their own window" + SETTINGS_POPUP_HUB_PMS, // "Open private messages from bots in their own window" SETTINGS_POPUP_PMS, // "Open private messages in their own window" SETTINGS_PORTS, // "Ports" SETTINGS_PROMPT_PASSWORD, // "Popup box to input password for hubs" Modified: dcplusplus/trunk/client/UploadManager.cpp =================================================================== --- dcplusplus/trunk/client/UploadManager.cpp 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/client/UploadManager.cpp 2006-07-12 10:19:01 UTC (rev 638) @@ -406,6 +406,28 @@ } waitingUsers.erase(i, waitingUsers.end()); + + if( BOOLSETTING(AUTO_KICK) ) { + for(Upload::Iter i = uploads.begin(); i != uploads.end(); ++i) { + Upload* u = *i; + if(u->getUser()->isOnline()) { + u->unsetFlag(Upload::FLAG_PENDING_KICK); + continue; + } + + if(u->isSet(Upload::FLAG_PENDING_KICK)) { + u->getUserConnection()->disconnect(true); + LogManager::getInstance()->message(STRING(DISCONNECTED_USER) + Util::toString(ClientManager::getInstance()->getNicks(u->getUser()->getCID()))); + } + + if(BOOLSETTING(AUTO_KICK_NO_FAVS) && FavoriteManager::getInstance()->isFavoriteUser(u->getUser())) { + continue; + } + + u->setFlag(Upload::FLAG_PENDING_KICK); + } + } + } void UploadManager::on(GetListLength, UserConnection* conn) throw() { @@ -490,25 +512,6 @@ } void UploadManager::on(ClientManagerListener::UserDisconnected, const User::Ptr& aUser) throw() { - - /// @todo Don't kick when /me disconnects - if( BOOLSETTING(AUTO_KICK) && !(BOOLSETTING(AUTO_KICK_NO_FAVS) && FavoriteManager::getInstance()->isFavoriteUser(aUser)) ) { - - Lock l(cs); - for(Upload::Iter i = uploads.begin(); i != uploads.end(); ++i) { - Upload* u = *i; - if(u->getUser() == aUser) { - // Oops...adios... - u->getUserConnection()->disconnect(true); - // But let's grant him/her a free slot just in case... - if (!u->getUserConnection()->isSet(UserConnection::FLAG_HASEXTRASLOT)) - reserveSlot(aUser); - LogManager::getInstance()->message(STRING(DISCONNECTED_USER) + Util::toString(ClientManager::getInstance()->getNicks(aUser->getCID()))); - } - } - } - - //Remove references to them. if(!aUser->isOnline()) { clearUserFiles(aUser); } Modified: dcplusplus/trunk/client/UploadManager.h =================================================================== --- dcplusplus/trunk/client/UploadManager.h 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/client/UploadManager.h 2006-07-12 10:19:01 UTC (rev 638) @@ -37,7 +37,8 @@ FLAG_USER_LIST = 0x01, FLAG_TTH_LEAVES = 0x02, FLAG_ZUPLOAD = 0x04, - FLAG_PARTIAL_LIST = 0x08 + FLAG_PARTIAL_LIST = 0x08, + FLAG_PENDING_KICK = 0x10 }; typedef Upload* Ptr; @@ -175,8 +176,8 @@ virtual void on(ClientManagerListener::UserDisconnected, const User::Ptr& aUser) throw(); // TimerManagerListener - virtual void on(TimerManagerListener::Second, u_int32_t aTick) throw(); - virtual void on(TimerManagerListener::Minute, u_int32_t aTick) throw(); + virtual void on(Second, u_int32_t aTick) throw(); + virtual void on(Minute, u_int32_t aTick) throw(); // UserConnectionListener virtual void on(BytesSent, UserConnection*, size_t, size_t) throw(); Modified: dcplusplus/trunk/client/User.h =================================================================== --- dcplusplus/trunk/client/User.h 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/client/User.h 2006-07-12 10:19:01 UTC (rev 638) @@ -38,7 +38,6 @@ PASSIVE_BIT, NMDC_BIT, BOT_BIT, - HUB_BIT, TTH_GET_BIT, SAVE_NICK_BIT, TLS_BIT @@ -51,7 +50,6 @@ PASSIVE = 1<<PASSIVE_BIT, NMDC = 1<<NMDC_BIT, BOT = 1<<BOT_BIT, - HUB = 1<<HUB_BIT, TTH_GET = 1<<TTH_GET_BIT, //< User supports getting files by tth -> don't have path in queue... SAVE_NICK = 1<<SAVE_NICK_BIT, //< Save cid->nick association TLS = 1<<TLS_BIT //< Client supports SSL @@ -114,6 +112,9 @@ int64_t getBytesShared() const { return Util::toInt64(get("SS")); } void setOp(bool op) { set("OP", op ? "1" : Util::emptyString); } + void setHub(bool hub) { set("HU", hub ? "1" : Util::emptyString); } + void setBot(bool bot) { set("BO", bot ? "1" : Util::emptyString); } + void setHidden(bool hidden) { set("HI", hidden ? "1" : Util::emptyString); } string getTag() const { if(!get("TA").empty()) Modified: dcplusplus/trunk/help/changelog.html =================================================================== --- dcplusplus/trunk/help/changelog.html 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/help/changelog.html 2006-07-12 10:19:01 UTC (rev 638) @@ -13,6 +13,14 @@ <h1>DC++ Changelog</h1> See the version history of DC++ below. +<h2>0.694 <span style="color: gray;">(2006-07-10)</span></h2> +<ul> + <li>Fixed crash in certificates page</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=1005">[bug 1005]</a> Fixed linux compile issue (thanks tpo)</li> + <li><a href="http://dcpp.net/bugzilla/show_bug.cgi?id=1004">[bug 1004]</a> Fixed browse file list on self</li> + <li>Both .crt and .pem files are read as trusted certificates</li> +</ul> + <h2>0.693 <span style="color: gray;">(2006-07-09)</span></h2> <ul> <li>Fixed crash bug</li> Modified: dcplusplus/trunk/windows/HubFrame.cpp =================================================================== --- dcplusplus/trunk/windows/HubFrame.cpp 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/windows/HubFrame.cpp 2006-07-12 10:19:01 UTC (rev 638) @@ -539,20 +539,28 @@ } } else if(task->speaker == PRIVATE_MESSAGE) { PMTask& pm = *static_cast<PMTask*>(task); - if(pm.replyTo->isOnline()) { - if(BOOLSETTING(POPUP_PMS) || PrivateFrame::isOpen(pm.replyTo)) { + if(pm.hub) { + if(BOOLSETTING(IGNORE_HUB_PMS)) { + addClientLine(TSTRING(IGNORED_MESSAGE) + pm.msg, false); + } else if(BOOLSETTING(POPUP_HUB_PMS) || PrivateFrame::isOpen(pm.replyTo)) { PrivateFrame::gotMessage(pm.from, pm.to, pm.replyTo, pm.msg); } else { addLine(TSTRING(PRIVATE_MESSAGE_FROM) + getNick(pm.from) + _T(": ") + pm.msg); } - } else { - if(BOOLSETTING(IGNORE_OFFLINE)) { + } else if(pm.bot) { + if(BOOLSETTING(IGNORE_BOT_PMS)) { addClientLine(TSTRING(IGNORED_MESSAGE) + pm.msg, false); - } else if(BOOLSETTING(POPUP_OFFLINE)) { + } else if(BOOLSETTING(POPUP_BOT_PMS) || PrivateFrame::isOpen(pm.replyTo)) { PrivateFrame::gotMessage(pm.from, pm.to, pm.replyTo, pm.msg); } else { addLine(TSTRING(PRIVATE_MESSAGE_FROM) + getNick(pm.from) + _T(": ") + pm.msg); } + } else { + if(BOOLSETTING(POPUP_PMS) || PrivateFrame::isOpen(pm.replyTo)) { + PrivateFrame::gotMessage(pm.from, pm.to, pm.replyTo, pm.msg); + } else { + addLine(TSTRING(PRIVATE_MESSAGE_FROM) + getNick(pm.from) + _T(": ") + pm.msg); + } } } Modified: dcplusplus/trunk/windows/HubFrame.h =================================================================== --- dcplusplus/trunk/windows/HubFrame.h 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/windows/HubFrame.h 2006-07-12 10:19:01 UTC (rev 638) @@ -209,10 +209,15 @@ }; struct PMTask : public StringTask { - PMTask(const User::Ptr& from_, const User::Ptr& to_, const User::Ptr& replyTo_, const tstring& m) : StringTask(PRIVATE_MESSAGE, m), from(from_), to(to_), replyTo(replyTo_) { } + PMTask(const OnlineUser& from_, const OnlineUser& to_, const OnlineUser& replyTo_, const tstring& m) : StringTask(PRIVATE_MESSAGE, m), + from(from_.getUser()), to(to_.getUser()), replyTo(replyTo_.getUser()), hub(replyTo_.getIdentity().isHub()), bot(replyTo_.getIdentity().isBot()) { } + User::Ptr from; User::Ptr to; User::Ptr replyTo; + + bool hub; + bool bot; }; friend struct CompareItems; Modified: dcplusplus/trunk/windows/WindowsPage.cpp =================================================================== --- dcplusplus/trunk/windows/WindowsPage.cpp 2006-07-10 20:44:32 UTC (rev 637) +++ dcplusplus/trunk/windows/WindowsPage.cpp 2006-07-12 10:19:01 UTC (rev 638) @@ -52,11 +52,13 @@ WindowsPage::ListItem WindowsPage::optionItems[] = { { SettingsManager::POPUP_PMS, ResourceManager::SETTINGS_POPUP_PMS }, - { SettingsManager::POPUP_OFFLINE, ResourceManager::SETTINGS_POPUP_OFFLINE }, + { SettingsManager::POPUP_HUB_PMS, ResourceManager::SETTINGS_POPUP_HUB_PMS }, + { SettingsManager::POPUP_BOT_PMS, ResourceManager::SETTINGS_POPUP_BOT_PMS }, { SettingsManager::POPUNDER_FILELIST, ResourceManager::SETTINGS_POPUNDER_FILELIST }, { SettingsManager::POPUNDER_PM, ResourceManager::SETTINGS_POPUNDER_PM }, { SettingsManager::JOIN_OPEN_NEW_WINDOW, ResourceManager::SETTINGS_OPEN_NEW_WINDOW }, - { SettingsManager::IGNORE_OFFLINE, ResourceManager::SETTINGS_IGNORE_OFFLINE }, + { SettingsManager::IGNORE_HUB_PMS, ResourceManager::SETTINGS_IGNORE_HUB_PMS }, + { SettingsManager::IGNORE_BOT_PMS, ResourceManager::SETTINGS_IGNORE_BOT_PMS }, { SettingsManager::TOGGLE_ACTIVE_WINDOW, ResourceManager::SETTINGS_TOGGLE_ACTIVE_WINDOW }, { SettingsManager::PROMPT_PASSWORD, ResourceManager::SETTINGS_PROMPT_PASSWORD }, { 0, ResourceManager::SETTINGS_AUTO_AWAY } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |