|
From: <arn...@us...> - 2008-02-09 20:51:56
|
Revision: 998
http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=998&view=rev
Author: arnetheduck
Date: 2008-02-09 12:51:52 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
Patches
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/dcpp/AdcHub.cpp
dcplusplus/trunk/dcpp/AdcHub.h
dcplusplus/trunk/dcpp/Client.h
dcplusplus/trunk/dcpp/ClientManager.cpp
dcplusplus/trunk/dcpp/ClientManager.h
dcplusplus/trunk/dcpp/NmdcHub.cpp
dcplusplus/trunk/dcpp/NmdcHub.h
dcplusplus/trunk/dcpp/Text.cpp
dcplusplus/trunk/dcpp/Text.h
dcplusplus/trunk/win32/AppearancePage.cpp
dcplusplus/trunk/win32/HubFrame.cpp
dcplusplus/trunk/win32/MainWindow.cpp
dcplusplus/trunk/win32/MainWindow.h
dcplusplus/trunk/win32/PrivateFrame.cpp
dcplusplus/trunk/win32/PrivateFrame.h
dcplusplus/trunk/win32/QueueFrame.cpp
dcplusplus/trunk/win32/QueueFrame.h
dcplusplus/trunk/win32/SystemFrame.cpp
dcplusplus/trunk/win32/WinUtil.cpp
dcplusplus/trunk/win32/WinUtil.h
dcplusplus/trunk/win32/resource.h
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/changelog.txt 2008-02-09 20:51:52 UTC (rev 998)
@@ -24,7 +24,12 @@
* Fixed crash when copying identity
* Fixed potential timer race condition (thanks bigmuscle)
* The good parts of partially downloaded segments are now added to queue (thanks bigmuscle)
-
+* Fancy menus (thanks poy)
+* [ADC] Added /me handling (thanks poy)
+* Fixed issues with scrolling (thanks poy)
+* Fixed re-add sources showing wrong sources (thanks poy)
+* Partially fixed
+
-- 0.704 2007-12-14 --
* Hub lists added to utilize Coral's distributed network (ullner)
* Use system header arrows on common controls 6+ (thanks poy)
Modified: dcplusplus/trunk/dcpp/AdcHub.cpp
===================================================================
--- dcplusplus/trunk/dcpp/AdcHub.cpp 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/dcpp/AdcHub.cpp 2008-02-09 20:51:52 UTC (rev 998)
@@ -560,16 +560,25 @@
}
}
-void AdcHub::hubMessage(const string& aMessage) {
+void AdcHub::hubMessage(const string& aMessage, bool thirdPerson) {
if(state != STATE_NORMAL)
return;
- send(AdcCommand(AdcCommand::CMD_MSG, AdcCommand::TYPE_BROADCAST).addParam(aMessage));
+ AdcCommand c(AdcCommand::CMD_MSG, AdcCommand::TYPE_BROADCAST);
+ c.addParam(aMessage);
+ if(thirdPerson)
+ c.addParam("ME", "1");
+ send(c);
}
-void AdcHub::privateMessage(const OnlineUser& user, const string& aMessage) {
+void AdcHub::privateMessage(const OnlineUser& user, const string& aMessage, bool thirdPerson) {
if(state != STATE_NORMAL)
return;
- send(AdcCommand(AdcCommand::CMD_MSG, user.getIdentity().getSID(), AdcCommand::TYPE_ECHO).addParam(aMessage).addParam("PM", getMySID()));
+ AdcCommand c(AdcCommand::CMD_MSG, user.getIdentity().getSID(), AdcCommand::TYPE_ECHO);
+ c.addParam(aMessage);
+ if(thirdPerson)
+ c.addParam("ME", "1");
+ c.addParam("PM", getMySID());
+ send(c);
}
void AdcHub::search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken) {
Modified: dcplusplus/trunk/dcpp/AdcHub.h
===================================================================
--- dcplusplus/trunk/dcpp/AdcHub.h 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/dcpp/AdcHub.h 2008-02-09 20:51:52 UTC (rev 998)
@@ -36,8 +36,8 @@
virtual void connect(const OnlineUser& user, const string& token);
void connect(const OnlineUser& user, string const& token, bool secure);
- virtual void hubMessage(const string& aMessage);
- virtual void privateMessage(const OnlineUser& user, const string& aMessage);
+ virtual void hubMessage(const string& aMessage, bool thirdPerson = false);
+ virtual void privateMessage(const OnlineUser& user, const string& aMessage, bool thirdPerson = false);
virtual void sendUserCmd(const string& aUserCmd) { send(aUserCmd); }
virtual void search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken);
virtual void password(const string& pwd);
Modified: dcplusplus/trunk/dcpp/Client.h
===================================================================
--- dcplusplus/trunk/dcpp/Client.h 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/dcpp/Client.h 2008-02-09 20:51:52 UTC (rev 998)
@@ -38,8 +38,8 @@
virtual void disconnect(bool graceless);
virtual void connect(const OnlineUser& user, const string& token) = 0;
- virtual void hubMessage(const string& aMessage) = 0;
- virtual void privateMessage(const OnlineUser& user, const string& aMessage) = 0;
+ virtual void hubMessage(const string& aMessage, bool thirdPerson = false) = 0;
+ virtual void privateMessage(const OnlineUser& user, const string& aMessage, bool thirdPerson = false) = 0;
virtual void sendUserCmd(const string& aUserCmd) = 0;
virtual void search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken) = 0;
virtual void password(const string& pwd) = 0;
Modified: dcplusplus/trunk/dcpp/ClientManager.cpp
===================================================================
--- dcplusplus/trunk/dcpp/ClientManager.cpp 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/dcpp/ClientManager.cpp 2008-02-09 20:51:52 UTC (rev 998)
@@ -290,12 +290,12 @@
}
}
-void ClientManager::privateMessage(const UserPtr& p, const string& msg) {
+void ClientManager::privateMessage(const UserPtr& p, const string& msg, bool thirdPerson) {
Lock l(cs);
OnlineIter i = onlineUsers.find(p->getCID());
if(i != onlineUsers.end()) {
OnlineUser* u = i->second;
- u->getClient().privateMessage(*u, msg);
+ u->getClient().privateMessage(*u, msg, thirdPerson);
}
}
Modified: dcplusplus/trunk/dcpp/ClientManager.h
===================================================================
--- dcplusplus/trunk/dcpp/ClientManager.h 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/dcpp/ClientManager.h 2008-02-09 20:51:52 UTC (rev 998)
@@ -80,7 +80,7 @@
void connect(const UserPtr& p, const string& token);
void send(AdcCommand& c, const CID& to);
- void privateMessage(const UserPtr& p, const string& msg);
+ void privateMessage(const UserPtr& p, const string& msg, bool thirdPerson);
void userCommand(const UserPtr& p, const UserCommand& uc, StringMap& params, bool compatibility);
Modified: dcplusplus/trunk/dcpp/NmdcHub.cpp
===================================================================
--- dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-02-09 20:51:52 UTC (rev 998)
@@ -748,9 +748,9 @@
send("$RevConnectToMe " + fromUtf8(getMyNick()) + " " + fromUtf8(aUser.getIdentity().getNick()) + "|");
}
-void NmdcHub::hubMessage(const string& aMessage) {
+void NmdcHub::hubMessage(const string& aMessage, bool thirdPerson) {
checkstate();
- send(fromUtf8( "<" + getMyNick() + "> " + escape(aMessage) + "|" ) );
+ send(fromUtf8( "<" + getMyNick() + "> " + escape(thirdPerson ? "/me " + aMessage : aMessage) + "|" ) );
}
void NmdcHub::myInfo(bool alwaysSend) {
@@ -870,7 +870,7 @@
return tmp;
}
-void NmdcHub::privateMessage(const OnlineUser& aUser, const string& aMessage) {
+void NmdcHub::privateMessage(const OnlineUser& aUser, const string& aMessage, bool /*thirdPerson*/) {
checkstate();
send("$To: " + fromUtf8(aUser.getIdentity().getNick()) + " From: " + fromUtf8(getMyNick()) + " $" + fromUtf8(escape("<" + getMyNick() + "> " + aMessage)) + "|");
Modified: dcplusplus/trunk/dcpp/NmdcHub.h
===================================================================
--- dcplusplus/trunk/dcpp/NmdcHub.h 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/dcpp/NmdcHub.h 2008-02-09 20:51:52 UTC (rev 998)
@@ -39,8 +39,8 @@
virtual void connect(const OnlineUser& aUser, const string&);
- virtual void hubMessage(const string& aMessage);
- virtual void privateMessage(const OnlineUser& aUser, const string& aMessage);
+ virtual void hubMessage(const string& aMessage, bool /*thirdPerson*/ = false);
+ virtual void privateMessage(const OnlineUser& aUser, const string& aMessage, bool /*thirdPerson*/ = false);
virtual void sendUserCmd(const string& aUserCmd) throw() { send(fromUtf8(aUserCmd)); }
virtual void search(int aSizeType, int64_t aSize, int aFileType, const string& aString, const string& aToken);
virtual void password(const string& aPass) { send("$MyPass " + fromUtf8(aPass) + "|"); }
Modified: dcplusplus/trunk/dcpp/Text.cpp
===================================================================
--- dcplusplus/trunk/dcpp/Text.cpp 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/dcpp/Text.cpp 2008-02-09 20:51:52 UTC (rev 998)
@@ -417,4 +417,25 @@
return tmp;
}
+wstring Text::toDOS(wstring tmp) {
+ if(tmp.empty())
+ return Util::emptyStringW;
+
+ if(tmp[0] == L'\r' && (tmp.size() == 1 || tmp[1] != L'\n')) {
+ tmp.insert(1, L"\n");
+ }
+ for(string::size_type i = 1; i < tmp.size() - 1; ++i) {
+ if(tmp[i] == L'\r' && tmp[i+1] != L'\n') {
+ // Mac ending
+ tmp.insert(i+1, L"\n");
+ i++;
+ } else if(tmp[i] == L'\n' && tmp[i-1] != L'\r') {
+ // Unix encoding
+ tmp.insert(i, L"\r");
+ i++;
+ }
+ }
+ return tmp;
+}
+
} // namespace dcpp
Modified: dcplusplus/trunk/dcpp/Text.h
===================================================================
--- dcplusplus/trunk/dcpp/Text.h 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/dcpp/Text.h 2008-02-09 20:51:52 UTC (rev 998)
@@ -132,6 +132,7 @@
}
string toDOS(string tmp);
+ wstring toDOS(wstring tmp);
}
Modified: dcplusplus/trunk/win32/AppearancePage.cpp
===================================================================
--- dcplusplus/trunk/win32/AppearancePage.cpp 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/AppearancePage.cpp 2008-02-09 20:51:52 UTC (rev 998)
@@ -44,7 +44,7 @@
PropPage::ListItem AppearancePage::listItems[] = {
{ SettingsManager::ALT_SORT_ORDER, N_("Sort all downloads first") },
- { SettingsManager::FILTER_MESSAGES, N_("Filter kick and NMDC debug messages") },
+ { SettingsManager::FILTER_MESSAGES, N_("Filter kick messages") },
{ SettingsManager::MINIMIZE_TRAY, N_("Minimize to tray") },
{ SettingsManager::TIME_STAMPS, N_("Show timestamps in chat by default") },
{ SettingsManager::STATUS_IN_CHAT, N_("View status messages in main chat") },
Modified: dcplusplus/trunk/win32/HubFrame.cpp
===================================================================
--- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-09 20:51:52 UTC (rev 998)
@@ -277,9 +277,10 @@
tstring param;
tstring msg;
tstring status;
- if(WinUtil::checkCommand(cmd, param, msg, status)) {
+ bool thirdPerson = false;
+ if(WinUtil::checkCommand(cmd, param, msg, status, thirdPerson)) {
if(!msg.empty()) {
- client->hubMessage(Text::fromT(msg));
+ client->hubMessage(Text::fromT(msg), thirdPerson);
}
if(!status.empty()) {
addStatus(status);
@@ -412,26 +413,21 @@
} else {
line = _T("\r\n");
}
- line += aLine;
+ line += Text::toDOS(aLine);
- int limit = chat->getTextLimit();
- if(chat->length() + static_cast<int>(line.size()) > limit) {
- HoldRedraw hold(chat);
+ SCROLLINFO scrollInfo = { sizeof(SCROLLINFO), SIF_RANGE | SIF_PAGE | SIF_POS };
+ bool scroll = (
+ (::GetScrollInfo(chat->handle(), SB_VERT, &scrollInfo) == 0) || // on error, let's keep scrolling...
+ (scrollInfo.nPos == (scrollInfo.nMax - max(scrollInfo.nPage - 1, 0u))) // scroll only if the current scroll position is at the end
+ );
+ HoldRedraw hold(chat, !scroll);
+
+ size_t limit = chat->getTextLimit();
+ if(chat->length() + line.size() > limit) {
+ HoldRedraw hold2(chat, scroll);
chat->setSelection(0, chat->lineIndex(chat->lineFromChar(limit / 10)));
chat->replaceSelection(_T(""));
}
-#ifdef PORT_ME
- BOOL noscroll = TRUE;
- POINT p = ctrlClient.PosFromChar(ctrlClient.GetWindowTextLength() - 1);
- CRect r;
- ctrlClient.GetClientRect(r);
-
- if( r.PtInRect(p) || MDIGetActive() != m_hWnd)
- noscroll = FALSE;
- else {
- ctrlClient.SetRedraw(FALSE); // Strange!! This disables the scrolling...????
- }
-#endif
if(BOOLSETTING(LOG_MAIN_CHAT)) {
StringMap params;
params["message"] = Text::fromT(aLine);
@@ -441,11 +437,10 @@
LOG(LogManager::CHAT, params);
}
chat->addText(line);
-#ifdef PORT_ME
- if(noscroll) {
- ctrlClient.SetRedraw(TRUE);
- }
-#endif
+
+ if(scroll)
+ chat->sendMessage(WM_VSCROLL, SB_BOTTOM);
+
setDirty(SettingsManager::BOLD_HUB);
}
@@ -881,23 +876,23 @@
}
void HubFrame::on(Message, Client*, const OnlineUser& from, const string& msg, bool thirdPerson) throw() {
- speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson));
-}
-
-void HubFrame::on(StatusMessage, Client*, const string& line) throw() {
if(SETTING(FILTER_MESSAGES)) {
- if((line.find("Hub-Security") != string::npos) && (line.find("was kicked by") != string::npos)) {
+ if((msg.find("Hub-Security") != string::npos) && (msg.find("was kicked by") != string::npos)) {
// Do nothing...
- } else if((line.find("is kicking") != string::npos) && (line.find("because:") != string::npos)) {
- speak(ADD_SILENT_STATUS_LINE, Text::toDOS(line));
+ } else if((msg.find("is kicking") != string::npos) && (msg.find("because:") != string::npos)) {
+ speak(ADD_SILENT_STATUS_LINE, msg);
} else {
- speak(ADD_CHAT_LINE, Text::toDOS(line));
+ speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson));
}
} else {
- speak(ADD_CHAT_LINE, Text::toDOS(line));
+ speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson));
}
}
+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/MainWindow.cpp
===================================================================
--- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-09 20:51:52 UTC (rev 998)
@@ -69,13 +69,13 @@
links.homepage = _T("http://dcpp.net/");
links.downloads = links.homepage + _T("download/");
links.geoipfile = _T("http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip");
- links.translations = _T("http://sourceforge.net/tracker/?atid=460289&group_id=40287");
links.faq = links.homepage + _T("faq/");
links.help = links.homepage + _T("forum/");
links.discuss = links.homepage + _T("forum/");
links.features = links.homepage + _T("bugzilla/");
links.bugs = links.homepage + _T("bugzilla/");
-
+ links.donate = _T("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=arnetheduck%40gmail%2ecom&item_name=DCPlusPlus&no_shipping=1&return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cancel_return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cn=Greeting&tax=0¤cy_code=EUR&bn=PP%2dDonationsBF&charset=UTF%2d8");
+
initWindow();
initMenu();
initToolbar();
@@ -246,7 +246,6 @@
help->appendItem(IDC_HELP_HOMEPAGE, T_("DC++ Homepage"), std::tr1::bind(&MainWindow::handleLink, this, _1));
help->appendItem(IDC_HELP_DOWNLOADS, T_("Downloads"), std::tr1::bind(&MainWindow::handleLink, this, _1));
help->appendItem(IDC_HELP_GEOIPFILE, T_("GeoIP database update"), std::tr1::bind(&MainWindow::handleLink, this, _1));
- help->appendItem(IDC_HELP_TRANSLATIONS, T_("Translations"), std::tr1::bind(&MainWindow::handleLink, this, _1));
help->appendItem(IDC_HELP_FAQ, T_("Frequently asked questions"), std::tr1::bind(&MainWindow::handleLink, this, _1));
help->appendItem(IDC_HELP_FORUM, T_("Help forum"), std::tr1::bind(&MainWindow::handleLink, this, _1));
help->appendItem(IDC_HELP_DISCUSS, T_("DC++ discussion forum"), std::tr1::bind(&MainWindow::handleLink, this, _1));
@@ -880,10 +879,6 @@
links.geoipfile = Text::toT(xml.getChildData());
}
xml.resetCurrentChild();
- if(xml.findChild("Translations")) {
- links.translations = Text::toT(xml.getChildData());
- }
- xml.resetCurrentChild();
if(xml.findChild("Faq")) {
links.faq = Text::toT(xml.getChildData());
}
@@ -949,9 +944,6 @@
case IDC_HELP_GEOIPFILE:
site = links.geoipfile;
break;
- case IDC_HELP_TRANSLATIONS:
- site = links.translations;
- break;
case IDC_HELP_FAQ:
site = links.faq;
break;
@@ -968,8 +960,7 @@
site = links.bugs;
break;
case IDC_HELP_DONATE:
- site
- = Text::toT("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=arnetheduck%40gmail%2ecom&item_name=DCPlusPlus&no_shipping=1&return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cancel_return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cn=Greeting&tax=0¤cy_code=EUR&bn=PP%2dDonationsBF&charset=UTF%2d8");
+ site = links.donate;
break;
default:
dcassert(0);
Modified: dcplusplus/trunk/win32/MainWindow.h
===================================================================
--- dcplusplus/trunk/win32/MainWindow.h 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/MainWindow.h 2008-02-09 20:51:52 UTC (rev 998)
@@ -94,12 +94,12 @@
tstring homepage;
tstring downloads;
tstring geoipfile;
- tstring translations;
tstring faq;
tstring help;
tstring discuss;
tstring features;
tstring bugs;
+ tstring donate;
} links;
WidgetHPanedPtr paned;
Modified: dcplusplus/trunk/win32/PrivateFrame.cpp
===================================================================
--- dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-09 20:51:52 UTC (rev 998)
@@ -144,9 +144,16 @@
}
line += aLine;
+ SCROLLINFO scrollInfo = { sizeof(SCROLLINFO), SIF_RANGE | SIF_PAGE | SIF_POS };
+ bool scroll = (
+ (::GetScrollInfo(chat->handle(), SB_VERT, &scrollInfo) == 0) || // on error, let's keep scrolling...
+ (scrollInfo.nPos == (scrollInfo.nMax - max(scrollInfo.nPage - 1, 0u))) // scroll only if the current scroll position is at the end
+ );
+ HoldRedraw hold(chat, !scroll);
+
size_t limit = chat->getTextLimit();
if(chat->length() + line.size() > limit) {
- HoldRedraw hold(chat);
+ HoldRedraw hold2(chat, scroll);
chat->setSelection(0, chat->lineIndex(chat->lineFromChar(limit / 10)));
chat->replaceSelection(_T(""));
}
@@ -160,8 +167,11 @@
params["myCID"] = ClientManager::getInstance()->getMe()->getCID().toBase32();
LOG(LogManager::PM, params);
}
+ chat->addText(line);
- chat->addText(line);
+ if(scroll)
+ chat->sendMessage(WM_VSCROLL, SB_BOTTOM);
+
setDirty(SettingsManager::BOLD_PM);
}
@@ -268,29 +278,31 @@
bool send = false;
// Process special commands
if(s[0] == '/') {
+ tstring cmd = s;
tstring param;
tstring message;
tstring status;
- if(WinUtil::checkCommand(s, param, message, status)) {
+ bool thirdPerson = false;
+ if(WinUtil::checkCommand(cmd, param, message, status, thirdPerson)) {
if(!message.empty()) {
- sendMessage(message);
+ sendMessage(message, thirdPerson);
}
if(!status.empty()) {
addStatus(status);
}
- } else if(Util::stricmp(s.c_str(), _T("clear")) == 0) {
+ } else if(Util::stricmp(cmd.c_str(), _T("clear")) == 0) {
chat->setText(Util::emptyStringT);
- } else if(Util::stricmp(s.c_str(), _T("grant")) == 0) {
+ } else if(Util::stricmp(cmd.c_str(), _T("grant")) == 0) {
UploadManager::getInstance()->reserveSlot(replyTo);
addStatus(T_("Slot granted"));
- } else if(Util::stricmp(s.c_str(), _T("close")) == 0) {
+ } else if(Util::stricmp(cmd.c_str(), _T("close")) == 0) {
postMessage(WM_CLOSE);
- } else if((Util::stricmp(s.c_str(), _T("favorite")) == 0) || (Util::stricmp(s.c_str(), _T("fav")) == 0)) {
+ } else if((Util::stricmp(cmd.c_str(), _T("favorite")) == 0) || (Util::stricmp(cmd.c_str(), _T("fav")) == 0)) {
FavoriteManager::getInstance()->addFavoriteUser(replyTo);
addStatus(T_("Favorite user added"));
- } else if(Util::stricmp(s.c_str(), _T("getlist")) == 0) {
+ } else if(Util::stricmp(cmd.c_str(), _T("getlist")) == 0) {
// TODO handleGetList();
- } else if(Util::stricmp(s.c_str(), _T("log")) == 0) {
+ } else if(Util::stricmp(cmd.c_str(), _T("log")) == 0) {
StringMap params;
params["hubNI"] = Util::toString(ClientManager::getInstance()->getHubNames(replyTo->getCID()));
@@ -299,7 +311,7 @@
params["userNI"] = ClientManager::getInstance()->getNicks(replyTo->getCID())[0];
params["myCID"] = ClientManager::getInstance()->getMe()->getCID().toBase32();
WinUtil::openFile(Text::toT(Util::validateFileName(SETTING(LOG_DIRECTORY) + Util::formatParams(SETTING(LOG_FILE_PRIVATE_CHAT), params, true))));
- } else if(Util::stricmp(s.c_str(), _T("help")) == 0) {
+ } else if(Util::stricmp(cmd.c_str(), _T("help")) == 0) {
addStatus(_T("*** ") + WinUtil::commands + _T(", /getlist, /clear, /grant, /close, /favorite, /log <system, downloads, uploads>"));
} else {
send = true;
@@ -323,8 +335,8 @@
}
-void PrivateFrame::sendMessage(const tstring& msg) {
- ClientManager::getInstance()->privateMessage(replyTo, Text::fromT(msg));
+void PrivateFrame::sendMessage(const tstring& msg, bool thirdPerson) {
+ ClientManager::getInstance()->privateMessage(replyTo, Text::fromT(msg), thirdPerson);
}
HRESULT PrivateFrame::handleSpeaker(WPARAM, LPARAM) {
Modified: dcplusplus/trunk/win32/PrivateFrame.h
===================================================================
--- dcplusplus/trunk/win32/PrivateFrame.h 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/PrivateFrame.h 2008-02-09 20:51:52 UTC (rev 998)
@@ -42,7 +42,7 @@
static void closeAll();
static void closeAllOffline();
- void sendMessage(const tstring& msg);
+ void sendMessage(const tstring& msg, bool thirdPerson = false);
private:
typedef MDIChildFrame<PrivateFrame> BaseType;
Modified: dcplusplus/trunk/win32/QueueFrame.cpp
===================================================================
--- dcplusplus/trunk/win32/QueueFrame.cpp 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/QueueFrame.cpp 2008-02-09 20:51:52 UTC (rev 998)
@@ -1004,7 +1004,7 @@
void QueueFrame::addBrowseMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii) {
unsigned int pos = parent->getCount();
WidgetMenuPtr menu = parent->appendPopup(T_("&Get file list"));
- if(addUsers(menu, IDC_BROWSELIST, &QueueFrame::handleBrowseList, qii, false) == 0) {
+ if(addUsers(menu, IDC_BROWSELIST, &QueueFrame::handleBrowseList, qii->getSources(), false) == 0) {
::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED);
}
}
@@ -1012,7 +1012,7 @@
void QueueFrame::addPMMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii) {
unsigned int pos = parent->getCount();
WidgetMenuPtr menu = parent->appendPopup(T_("&Send private message"));
- if(addUsers(menu, IDC_PM, &QueueFrame::handlePM, qii, false) == 0) {
+ if(addUsers(menu, IDC_PM, &QueueFrame::handlePM, qii->getSources(), false) == 0) {
::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED);
}
}
@@ -1023,7 +1023,7 @@
menu->appendItem(IDC_READD, T_("All"), std::tr1::bind(&QueueFrame::handleReadd, this, UserPtr()));
menu->appendSeparatorItem();
- if(addUsers(menu, IDC_READD + 1, &QueueFrame::handleReadd, qii, true) == 0) {
+ if(addUsers(menu, IDC_READD + 1, &QueueFrame::handleReadd, qii->getBadSources(), true) == 0) {
::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED);
}
}
@@ -1033,7 +1033,7 @@
WidgetMenuPtr menu = parent->appendPopup(T_("Remove source"));
menu->appendItem(IDC_REMOVE_SOURCE, T_("All"), std::tr1::bind(&QueueFrame::handleRemoveSource, this, UserPtr()));
menu->appendSeparatorItem();
- if(addUsers(menu, IDC_REMOVE_SOURCE + 1, &QueueFrame::handleRemoveSource, qii, true) == 0) {
+ if(addUsers(menu, IDC_REMOVE_SOURCE + 1, &QueueFrame::handleRemoveSource, qii->getSources(), true) == 0) {
::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED);
}
}
@@ -1041,15 +1041,15 @@
void QueueFrame::addRemoveAllMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii) {
unsigned int pos = parent->getCount();
WidgetMenuPtr menu = parent->appendPopup(T_("Remove user from queue"));
- if(addUsers(menu, IDC_REMOVE_SOURCES, &QueueFrame::handleRemoveSources, qii, true) == 0) {
+ if(addUsers(menu, IDC_REMOVE_SOURCES, &QueueFrame::handleRemoveSources, qii->getSources(), true) == 0) {
::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED);
}
}
-unsigned int QueueFrame::addUsers(const WidgetMenuPtr& menu, unsigned int startId, void (QueueFrame::*handler)(const UserPtr&), QueueItemInfo* qii, bool offline) {
+unsigned int QueueFrame::addUsers(const WidgetMenuPtr& menu, unsigned int startId, void (QueueFrame::*handler)(const UserPtr&), const QueueItem::SourceList& sources, bool offline) {
unsigned int id = startId;
- for(QueueItem::SourceIter i = qii->getSources().begin(); i != qii->getSources().end(); ++i) {
- QueueItem::Source& source = *i;
+ for(QueueItem::SourceConstIter i = sources.begin(); i != sources.end(); ++i) {
+ const QueueItem::Source& source = *i;
if(offline || source.getUser()->isOnline()) {
tstring nick = SmartUtil::escapeMenu(WinUtil::getNicks(source.getUser()));
menu->appendItem(id++, nick, reinterpret_cast<ULONG_PTR>(&source), (const WidgetMenu::SimpleDispatcher::F&)std::tr1::bind(handler, this, source.getUser()));
Modified: dcplusplus/trunk/win32/QueueFrame.h
===================================================================
--- dcplusplus/trunk/win32/QueueFrame.h 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/QueueFrame.h 2008-02-09 20:51:52 UTC (rev 998)
@@ -274,7 +274,7 @@
void addPMMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii);
void addPriorityMenu(const WidgetMenuPtr& parent);
void addReaddMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii);
- unsigned int addUsers(const WidgetMenuPtr& menu, unsigned int startId, void (QueueFrame::*handler)(const UserPtr&), QueueItemInfo* qii, bool offline);
+ unsigned int addUsers(const WidgetMenuPtr& menu, unsigned int startId, void (QueueFrame::*handler)(const UserPtr&), const QueueItem::SourceList& sources, bool offline);
void layout();
HRESULT handleSpeaker(WPARAM wParam, LPARAM lParam);
Modified: dcplusplus/trunk/win32/SystemFrame.cpp
===================================================================
--- dcplusplus/trunk/win32/SystemFrame.cpp 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/SystemFrame.cpp 2008-02-09 20:51:52 UTC (rev 998)
@@ -59,6 +59,7 @@
log->replaceSelection(_T(""));
}
log->addTextLines(Text::toT("\r\n[" + Util::getShortTimeString(t) + "] ") + msg);
+ log->sendMessage(WM_VSCROLL, SB_BOTTOM);
setDirty(SettingsManager::BOLD_SYSTEM_LOG);
}
Modified: dcplusplus/trunk/win32/WinUtil.cpp
===================================================================
--- dcplusplus/trunk/win32/WinUtil.cpp 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/WinUtil.cpp 2008-02-09 20:51:52 UTC (rev 998)
@@ -217,9 +217,9 @@
#define MSGS 16
-tstring WinUtil::commands = _T("/refresh, /slots #, /search <string>, /dc++, /away <msg>, /back, /g <searchstring>, /imdb <imdbquery>, /u <url>, /rebuild");
+tstring WinUtil::commands = _T("/refresh, /me <msg>, /slots #, /search <string>, /dc++, /away <msg>, /back, /g <searchstring>, /imdb <imdbquery>, /u <url>, /rebuild");
-bool WinUtil::checkCommand(tstring& cmd, tstring& param, tstring& message, tstring& status) {
+bool WinUtil::checkCommand(tstring& cmd, tstring& param, tstring& message, tstring& status, bool& thirdPerson) {
string::size_type i = cmd.find(' ');
if(i != string::npos) {
param = cmd.substr(i+1);
@@ -238,6 +238,9 @@
} else {
return false;
}
+ } else if(Util::stricmp(cmd.c_str(), _T("me")) == 0) {
+ message = param;
+ thirdPerson = true;
} else if(Util::stricmp(cmd.c_str(), _T("refresh"))==0) {
try {
ShareManager::getInstance()->setDirty();
Modified: dcplusplus/trunk/win32/WinUtil.h
===================================================================
--- dcplusplus/trunk/win32/WinUtil.h 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/WinUtil.h 2008-02-09 20:51:52 UTC (rev 998)
@@ -90,7 +90,7 @@
* @param status Message that should be shown in the status line.
* @return True if the command was processed, false otherwise.
*/
- static bool checkCommand(tstring& cmd, tstring& param, tstring& message, tstring& status);
+ static bool checkCommand(tstring& cmd, tstring& param, tstring& message, tstring& status, bool& thirdPerson);
static void openFile(const tstring& file);
static void openFolder(const tstring& file);
Modified: dcplusplus/trunk/win32/resource.h
===================================================================
--- dcplusplus/trunk/win32/resource.h 2008-02-09 12:12:59 UTC (rev 997)
+++ dcplusplus/trunk/win32/resource.h 2008-02-09 20:51:52 UTC (rev 998)
@@ -129,7 +129,6 @@
#define IDC_HELP_HOMEPAGE 1061
#define IDC_HELP_DOWNLOADS 1062
#define IDC_HELP_GEOIPFILE 1063
-#define IDC_HELP_TRANSLATIONS 1064
#define IDC_HELP_FORUM 1065
#define IDC_HELP_DISCUSS 1066
#define IDC_HELP_REQUEST_FEATURE 1067
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|