jkollss
Member-
Content count
9 -
Joined
-
Last visited
Posts posted by jkollss
-
-
has already been fixed in the beta so no need to post about or post link to a leech clientI dunno about leech that client or not. I don't care. I just take useful idea and adapted it to Apex. I have no relations to flylink group. I pointed to their website only it because I took some code from their client. That's it.
So, please get your paranoia back and just look at the code.
Thanks.
-
This feature will reduce the search performance a lot. It has to be experts only configurable in my opinion.
-
OK guys, I just want to get our favorite client better =)
-
I don't know what the mess about the subject.
Here is the source patch to enable "short" human readable magnet links in the chat.
Part of the code was taken from FlyLinDC++. It's distributed with source and I found nothing about copyright restrictions, in particular they based on ApexDC++ code. And there is nothing hard to implement such feature anyway.
diff --git a/client/Util.h b/client/Util.h index 71bce1e..1181ece 100644 --- a/client/Util.h +++ b/client/Util.h @@ -544,6 +544,24 @@ struct noCaseStringEq { } }; +template<typename T> +class AutoArray { + typedef T* TPtr; +public: + explicit AutoArray(TPtr t) : p(t) { } + explicit AutoArray(size_t size) : p(new T[size]) { } + ~AutoArray() { delete[] p; } + operator TPtr() { return p; } + TPtr get() { return p; } + AutoArray& operator=(TPtr t) { delete[] p; p = t; return *this; } +private: + AutoArray(const AutoArray&); + AutoArray& operator=(const AutoArray&); + + TPtr p; +}; + + } // namespace dcpp #endif // !defined(UTIL_H) diff --git a/windows/ChatCtrl.cpp b/windows/ChatCtrl.cpp index fb8cb15..6284423 100644 --- a/windows/ChatCtrl.cpp +++ b/windows/ChatCtrl.cpp @@ -59,8 +59,19 @@ ChatCtrl::~ChatCtrl() { void ChatCtrl::AdjustTextSize() { if(GetWindowTextLength() > SETTING(CHATBUFFERSIZE)) { - // After 25000 charecters, w95 becomes sad... + // After 25000 characters, w95 becomes sad... SetRedraw(FALSE); + // [jkollss] + int g = LineIndex(LineFromChar(2000)); + for (TURLMap::iterator i = lURLMap.begin(); i != lURLMap.end();) + { + i->first -= g; + if (i->first < 0) + lURLMap.erase(i++); + else + i++; + } + // SetSel(0, LineIndex(LineFromChar(2000))); ReplaceSel(_T("")); SetRedraw(TRUE); @@ -267,6 +278,7 @@ void ChatCtrl::AppendTextOnly(const tstring& sMyNick, const TCHAR* sText, CHARFO // Zvyrazneni vsech URL a nastaveni "klikatelnosti" long lSearchFrom = 0; + tstring ls; for(size_t i = 0; i < (sizeof(Links) / sizeof(Links[0])); i++) { long linkStart = sMsgLower.Find(Links[i], lSearchFrom); while(linkStart > 0) { @@ -281,6 +293,32 @@ void ChatCtrl::AppendTextOnly(const tstring& sMyNick, const TCHAR* sText, CHARFO linkEnd = _tcslen(sMsgLower); } SetSel(lSelBegin + linkStart, lSelBegin + linkEnd); + // [jkolls] Shorten magnet link + AutoArray<TCHAR> cURL(linkEnd - linkStart + 1); + GetTextRange(lSelBegin + linkStart, lSelBegin + linkEnd, cURL); + ls = cURL; + if (_strnicmp(Text::fromT(cURL.get()).c_str(), "magnet:?", 8) == 0) + { + string sFileName = Text::fromT(cURL.get()); + int dn = sFileName.find("dn="); + if (dn == string::npos) + sFileName = "Unnamed magnet-link"; + else + sFileName = sFileName.substr(dn + 3); + sFileName = Util::encodeURI(sFileName, true); + tstring sFileSize = cURL; + int64_t filesize = Util::toInt64(Text::fromT(sFileSize.substr(sFileSize.find(_T("xl=")) + 3, sFileSize.find(_T("&")) - sFileSize.find(_T("xl="))))); + ls = Text::toT(sFileName) + _T(" (") + Util::formatBytesW(filesize) + _T(")"); + ReplaceSel(ls.c_str()); + tstring tmp = sMsgLower.Left(linkStart); + tmp += ls; + tmp += sMsgLower.Mid(linkEnd); + sMsgLower = tmp.c_str(); + linkEnd = linkStart + ls.length(); + SetSel(lSelBegin + linkStart, lSelBegin + linkEnd); + lURLMap.push_back(make_pair(lSelBegin + linkStart, cURL.get())); + } + // SetSelectionCharFormat(WinUtil::m_TextStyleURL); linkStart = sMsgLower.Find(Links[i], linkEnd); } diff --git a/windows/ChatCtrl.h b/windows/ChatCtrl.h index 14951ad..680b2f8 100644 --- a/windows/ChatCtrl.h +++ b/windows/ChatCtrl.h @@ -34,6 +34,7 @@ #endif class UserInfo; +typedef list<pair<int, tstring>> TURLMap; class ChatCtrl: public CRichEditCtrl, public CMessageMap, public UCHandler<ChatCtrl> { @@ -129,6 +130,22 @@ public: // We wanna control the scrolling... } + // [jkollss] + TURLMap lURLMap; + tstring get_URL(ENLINK* p_EL) const + { + const long lBegin = p_EL->chrg.cpMin, lEnd = p_EL->chrg.cpMax; + for (TURLMap::const_iterator i = lURLMap.begin(); i != lURLMap.end(); ++i) + if (i->first == lBegin) + return i->second; + AutoArray<TCHAR> sURLTemp(lEnd - lBegin+1); + sURLTemp[0] = 0; + GetTextRange(lBegin, lEnd, sURLTemp); + return tstring(sURLTemp); + } + // + static tstring sSelectedURL; + private: bool HitNick(const POINT& p, tstring& sNick, int& iBegin , int& iEnd); bool HitIP(const POINT& p, tstring& sIP, int& iBegin, int& iEnd); @@ -147,7 +164,6 @@ private: static tstring sSelectedLine; static tstring sSelectedIP; static tstring sSelectedUser; - static tstring sSelectedURL; }; diff --git a/windows/HubFrame.cpp b/windows/HubFrame.cpp index 449ad9c..b8d8960 100644 --- a/windows/HubFrame.cpp +++ b/windows/HubFrame.cpp @@ -55,6 +55,7 @@ ResourceManager::Strings HubFrame::columnNames[] = { ResourceManager::NICK, Reso ResourceManager::VERSION, ResourceManager::MODE, ResourceManager::HUBS, ResourceManager::SLOTS }; extern CAGEmotionSetup* g_pEmotionsSetup; +//tstring sSelectedURL = Util::emptyStringT; LRESULT HubFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { @@ -2438,6 +2439,57 @@ LRESULT HubFrame::onEmoPackChange(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl return 0; } +// [jkollss] +LRESULT HubFrame::onClientEnLink(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) +{ + ENLINK* pEL = (ENLINK*)pnmh; + + if (pEL->msg == WM_LBUTTONUP) + { + tstring sURL = ctrlClient.get_URL(pEL); + WinUtil::openLink(sURL); + } + else if(pEL->msg == WM_RBUTTONUP) + { + ctrlClient.sSelectedURL = ctrlClient.get_URL(pEL); + ctrlClient.SetSel(pEL->chrg.cpMin, pEL->chrg.cpMax); + ctrlClient.InvalidateRect(NULL); + return 0; + } + return 0; +} + +LRESULT HubFrame::onMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) +{ + RECT rc; + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; // location of mouse click + // Get the bounding rectangle of the client area. + ctrlClient.GetClientRect(&rc); + ctrlClient.ScreenToClient(&pt); + if (PtInRect(&rc, pt)) + { + ctrlClient.sSelectedURL = _T(""); + return TRUE; + } + return 1; +} + +LRESULT HubFrame::onRButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) +{ + RECT rc; + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; // location of mouse click + + // Get the bounding rectangle of the client area. + ctrlClient.GetClientRect(&rc); + ctrlClient.ScreenToClient(&pt); + if (PtInRect(&rc, pt)) + { + ctrlClient.sSelectedURL = _T(""); + } + return 1; +} + + /** * @file * $Id: HubFrame.cpp 382 2008-03-09 10:40:22Z BigMuscle $ diff --git a/windows/HubFrame.h b/windows/HubFrame.h index 7da4749..be816f3 100644 --- a/windows/HubFrame.h +++ b/windows/HubFrame.h @@ -136,7 +136,9 @@ public: LRESULT onSelChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT onCtlColor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/); LRESULT onFileReconnect(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT onClientEnLink(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) { return ctrlClient.onClientEnLink(idCtrl, pnmh, bHandled); } + LRESULT onRButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled); + LRESULT onMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled); + LRESULT onClientEnLink(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); // [jkollss] { return ctrlClient.onClientEnLink(idCtrl, pnmh, bHandled); } LRESULT onSelectUser(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT onPrivateMessage(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT onPublicMessage(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); diff --git a/windows/PrivateFrame.cpp b/windows/PrivateFrame.cpp index 2dfaa29..f78a7cd 100644 --- a/windows/PrivateFrame.cpp +++ b/windows/PrivateFrame.cpp @@ -809,6 +809,24 @@ LRESULT PrivateFrame::onEmoticons(WORD /*wNotifyCode*/, WORD /*wID*/, HWND hWndC return 0; } +LRESULT PrivateFrame::onClientEnLink(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) +{ + //return ctrlClient.onClientEnLink(idCtrl, pnmh, bHandled); + ENLINK* pEL = (ENLINK*)pnmh; + + if ( pEL->msg == WM_LBUTTONUP ) { + tstring sURL = ctrlClient.get_URL(pEL); + WinUtil::openLink(sURL); + + } else if(pEL->msg == WM_RBUTTONUP) { + pSelectedURL = ctrlClient.get_URL(pEL); + ctrlClient.SetSel(pEL->chrg.cpMin, pEL->chrg.cpMax); + ctrlClient.InvalidateRect(NULL); + return 0; + } + return 0; +} + /** * @file * $Id: PrivateFrame.cpp 382 2008-03-09 10:40:22Z BigMuscle $ diff --git a/windows/PrivateFrame.h b/windows/PrivateFrame.h index 57635f8..6fc98aa 100644 --- a/windows/PrivateFrame.h +++ b/windows/PrivateFrame.h @@ -98,7 +98,7 @@ public: LRESULT onAddToFavorites(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT onTabContextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/); LRESULT onContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - LRESULT onClientEnLink(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) { return ctrlClient.onClientEnLink(idCtrl, pnmh, bHandled); } + LRESULT onClientEnLink(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);// { return ctrlClient.onClientEnLink(idCtrl, pnmh, bHandled); } LRESULT onOpenUserLog(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT onEmoPackChange(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT onEmoticons(WORD /*wNotifyCode*/, WORD /*wID*/, HWND hWndCtl, BOOL& bHandled);
-
Sorry, maybe I put this to wrong topic, please move this to the proper one. Thanks.
Here is a git patch which adds a feature to save user list column sort order between the sessions:
I wrote it and found quite useful.
diff --git a/client/SettingsManager.cpp b/client/SettingsManager.cpp index f77f72f..f5af4f7 100644 --- a/client/SettingsManager.cpp +++ b/client/SettingsManager.cpp @@ -143,7 +143,7 @@ const string SettingsManager::settingTags[] = "ShowQSearch", "SearchDetectHash", "ZionTabs", "NonHubsFront", "GlobalMiniTabs", "BlendOffline", "MaxResizeLines", "CheckClientBeforeFileList", "MaxTestSURs", "MaxFileLists", "CheckDelay", "SleepTime", "DelayedRawSending", "NatSort", "DontShareEmptyDirs", "OnlyShareFullDirs", "UseCustomListBackground", "ProtectedColour", "UseFavNames", - "EnableIpGuard", "DefaultPolicy", + "EnableIpGuard", "DefaultPolicy", "UserlistSortColumn", "UserlistSortAscending", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -536,6 +536,8 @@ SettingsManager::SettingsManager() setDefault(USE_FAV_NAMES, false); setDefault(ENABLE_IPGUARD, false); setDefault(DEFAULT_POLICY, false); + setDefault(USERLIST_SORTCOLUMN, -1); + setDefault(USERLIST_SORTASCENDING, true); setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); setDefault(MAIN_WINDOW_SIZE_X, CW_USEDEFAULT); diff --git a/client/SettingsManager.h b/client/SettingsManager.h index 13e5879..f1fd25d 100644 --- a/client/SettingsManager.h +++ b/client/SettingsManager.h @@ -154,7 +154,7 @@ public: SHOW_QUICK_SEARCH, SEARCH_DETECT_TTH, ZION_TABS, NON_HUBS_FRONT, GLOBAL_MINI_TABS, BLEND_OFFLINE_SEARCH, MAX_RESIZE_LINES, CHECK_CLIENT_BEFORE_FILELIST, MAX_TESTSURS, MAX_FILELISTS, CHECK_DELAY, SLEEP_TIME, DELAYED_RAW_SENDING, NAT_SORT, DONT_SHARE_EMPTY_DIRS, ONLY_SHARE_FULL_DIRS, USE_CUSTOM_LIST_BACKGROUND, PROTECTED_COLOUR, USE_FAV_NAMES, - ENABLE_IPGUARD, DEFAULT_POLICY, + ENABLE_IPGUARD, DEFAULT_POLICY, USERLIST_SORTCOLUMN, USERLIST_SORTASCENDING, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, diff --git a/windows/HubFrame.cpp b/windows/HubFrame.cpp index b8d8960..f68101d 100644 --- a/windows/HubFrame.cpp +++ b/windows/HubFrame.cpp @@ -151,7 +151,14 @@ LRESULT HubFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, ctrlUsers.setFlickerFree(WinUtil::bgBrush); ctrlClient.SetBackgroundColor(WinUtil::bgColor); - ctrlUsers.setSortColumn(OnlineUser::COLUMN_NICK); + bool bSortAsc = SETTING(USERLIST_SORTASCENDING); + ctrlUsers.setAscending(bSortAsc); + int nSortColumn = SETTING(USERLIST_SORTCOLUMN); + if (nSortColumn >= OnlineUser::COLUMN_FIRST && nSortColumn < OnlineUser::COLUMN_LAST) + ctrlUsers.setSortColumn(nSortColumn); + else + ctrlUsers.setSortColumn(OnlineUser::COLUMN_NICK); + ctrlUsers.SetImageList(WinUtil::userImages, LVSIL_SMALL); @@ -936,6 +943,11 @@ LRESULT HubFrame::onClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, B clearUserList(); clearTaskList(); + int nSortColumn = ctrlUsers.getSortColumn(); + SettingsManager::getInstance()->set(SettingsManager::USERLIST_SORTCOLUMN, nSortColumn); + bool bAscend = ctrlUsers.isAscending(); + SettingsManager::getInstance()->set(SettingsManager::USERLIST_SORTASCENDING, bAscend); + string tmp, tmp2, tmp3; ctrlUsers.saveHeaderOrder(tmp, tmp2, tmp3);
With best regards,
Sergey.
-
Hi, It is me again
Plugin has no access to specific Apex classes. For example: I want to overlap the ::onChat event and the parameters in that evens are in UTF8 format. So the rich edit control understands only plain ascii format, so I have to convert UTF8 to ansi. But I cannot, because the text.h and text.cpp are depending of too much of sources to include into plugin.
getCallBack()->.. function aren't provide UTF-ansi conversion.
And even more - the callback onChat(ClientInterface *client, string& text) - will provide the limited functionality. Why you don't provide the full chat callback with the timestamp and so other maybe in some special function like onCompleteChat( or whatever.
Thanks, for your attention, With best regards,
Sergey
-
The plugin api is still in itäs infant stage, I'll gladly take any suggestions (or patches... ) about improving it.Regarding the documentation, it is just as incomplete as the plugin api, but it is there, I guess forum permissions are incorrect somewhere....
I understand any risks, and I tried plugin IP in spite of there was no docs, just looking for source. The Idea is very great! Nobody has sush feature in the their own clone based on Apex
I very liked Apex project and I can help the project for example, to develop some plugins.
I'm a Russian, so I already have a lot of plugins features specially to Russian users, and not only related to them.
So it because I very interested in good plugin API.
Of course I can give you some free help to improve it.
Thanks for your attention!
-
I have tryed plugins new feature. What can I say.
1) Plugin documentation is absent, at least I tried to follow the link on the page http://www.apexdc.net/changelog/ - it is Feature: Plugin API (view documentation) (view documentation - points to nowhere) Or maybe points to the forum topic which is unavailable to me.
2) Plugin API is very RAW. For instance, I wants to develop a plugin which will be sows me some last chat messages, and be on the top always. I have wrote such plugin, but that was not so easy. Because there is no any interface to the existing features of Apex, there is no interface to some utilites, such of convertion from UTF or into to UTF etc.
So. currently the plugin API is complete unusaable, in my point of view. But it is very high step forward? anyway.
Looking for more improvement plugin API.
With best regads,
Sergey.
Change tray icon if the new chat message appears [patch solution]
in Feature Requests
Posted
Note to this patch: You have to create some NewChatMessage.ico file in the res\ directory. I did this just painted the standard Apex icon to the red. You can create that icon as you wish.
Also, this patch is quick and can be optimized to prevent copy-paste of the code. Take this just as an idea. And setup settings also maybe has to be implemented about that feature.
I used this on my own not so active hub, and found it very usable.