linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05532
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2905: remove User::BOT - use Identity methods instead
------------------------------------------------------------
revno: 2905
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2012-04-17 19:59:40 +0200
message:
remove User::BOT - use Identity methods instead
modified:
changelog.txt
dcpp/AdcHub.cpp
dcpp/NmdcHub.cpp
dcpp/User.h
win32/HubFrame.cpp
win32/PrivateFrame.cpp
win32/PrivateFrame.h
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2012-04-17 17:32:56 +0000
+++ changelog.txt 2012-04-17 17:59:40 +0000
@@ -28,6 +28,7 @@
* Format chat links (poy)
* Improve threaded file list loading (poy)
* [L#981733] Prevent the keyboard language from switching
+* [L#966339] Fix bot detection in NMDC hubs
-- 0.791 2012-01-14 --
* Update translations
=== modified file 'dcpp/AdcHub.cpp'
--- dcpp/AdcHub.cpp 2012-03-03 19:33:45 +0000
+++ dcpp/AdcHub.cpp 2012-04-17 17:59:40 +0000
@@ -180,12 +180,6 @@
u->getIdentity().set(i.c_str(), i.substr(2));
}
- if(u->getIdentity().isBot()) {
- u->getUser()->setFlag(User::BOT);
- } else {
- u->getUser()->unsetFlag(User::BOT);
- }
-
if(u->getIdentity().supports(ADCS_FEATURE)) {
u->getUser()->setFlag(User::TLS);
}
=== modified file 'dcpp/NmdcHub.cpp'
--- dcpp/NmdcHub.cpp 2012-03-03 19:33:45 +0000
+++ dcpp/NmdcHub.cpp 2012-04-17 17:59:40 +0000
@@ -372,15 +372,8 @@
return;
string connection = param.substr(i, j-i-1);
- 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().setBot(connection.empty()); // No connection = bot...
u.getIdentity().setHub(false);
u.getIdentity().set("CO", connection);
=== modified file 'dcpp/User.h'
--- dcpp/User.h 2012-01-13 20:55:20 +0000
+++ dcpp/User.h 2012-04-17 17:59:40 +0000
@@ -36,7 +36,6 @@
ONLINE_BIT,
PASSIVE_BIT,
NMDC_BIT,
- BOT_BIT,
TLS_BIT,
OLD_CLIENT_BIT,
NO_ADC_1_0_PROTOCOL_BIT,
@@ -48,7 +47,6 @@
ONLINE = 1<<ONLINE_BIT,
PASSIVE = 1<<PASSIVE_BIT,
NMDC = 1<<NMDC_BIT,
- BOT = 1<<BOT_BIT,
TLS = 1<<TLS_BIT, //< Client supports TLS
OLD_CLIENT = 1<<OLD_CLIENT_BIT, //< Can't download - old client
NO_ADC_1_0_PROTOCOL = 1<<NO_ADC_1_0_PROTOCOL_BIT, //< Doesn't support "ADC/1.0" (dc++ <=0.703)
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2012-04-15 22:19:38 +0000
+++ win32/HubFrame.cpp 2012-04-17 17:59:40 +0000
@@ -659,7 +659,7 @@
addStatus(str(TF_("Ignored message: %1%") % Text::toT(message.message)), false);
} else {
- if(window && !PrivateFrame::gotMessage(getParent(), message.from, message.to, message.replyTo, message, url)) {
+ if(window && !PrivateFrame::gotMessage(getParent(), message.from, message.to, message.replyTo, message, url, fromBot)) {
window = false;
addStatus(T_("Failed to create a new PM window; check the \"Max PM windows\" value in Settings > Experts only"));
}
=== modified file 'win32/PrivateFrame.cpp'
--- win32/PrivateFrame.cpp 2012-04-15 22:19:38 +0000
+++ win32/PrivateFrame.cpp 2012-04-17 17:59:40 +0000
@@ -57,7 +57,7 @@
}
bool PrivateFrame::gotMessage(TabViewPtr parent, const UserPtr& from, const UserPtr& to, const UserPtr& replyTo,
- const ChatMessage& message, const string& hubHint)
+ const ChatMessage& message, const string& hubHint, bool fromBot)
{
const UserPtr& user = (replyTo == ClientManager::getInstance()->getMe()) ? to : replyTo;
auto i = frames.find(user);
@@ -74,7 +74,7 @@
p->addChat(message);
- if(Util::getAway() && !(BOOLSETTING(NO_AWAYMSG_TO_BOTS) && user->isSet(User::BOT))) {
+ if(Util::getAway() && !(BOOLSETTING(NO_AWAYMSG_TO_BOTS) && fromBot)) {
auto awayMessage = Util::getAwayMessage();
if(!awayMessage.empty()) {
p->sendMessage(Text::toT(awayMessage));
=== modified file 'win32/PrivateFrame.h'
--- win32/PrivateFrame.h 2012-02-04 17:40:35 +0000
+++ win32/PrivateFrame.h 2012-04-17 17:59:40 +0000
@@ -57,7 +57,7 @@
/// @return whether a new window can be opened (wrt the "Max PM windows" setting).
static bool gotMessage(TabViewPtr parent, const UserPtr& from, const UserPtr& to, const UserPtr& replyTo,
- const ChatMessage& message, const string& hubHint);
+ const ChatMessage& message, const string& hubHint, bool fromBot);
static void openWindow(TabViewPtr parent, const HintedUser& replyTo, const tstring& msg = Util::emptyStringT,
const string& logPath = Util::emptyString, bool activate = true);
static void activateWindow(const UserPtr& u);