diff options
-rw-r--r-- | plugins/DbEditorPP/src/main.cpp | 12 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/main_window.cpp | 2 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/stdafx.h | 1 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/utils.cpp | 65 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/version.h | 2 | ||||
-rw-r--r-- | src/mir_app/src/modules.cpp | 2 |
6 files changed, 8 insertions, 76 deletions
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index d13c44bf7a..1df7685049 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -7,7 +7,6 @@ bool g_bServiceMode = false; bool g_bUsePopups;
CMPlugin g_plugin;
-uint8_t nameOrder[NAMEORDERCOUNT];
HGENMENU hUserMenu;
MCONTACT hRestore;
@@ -185,17 +184,6 @@ int CMPlugin::Load() icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx(&icex);
-
- // Load the name order
- for (int i = 0; i < NAMEORDERCOUNT; i++)
- nameOrder[i] = i;
-
- DBVARIANT dbv = {};
- if (!db_get_s(0, "Contact", "NameOrder", &dbv, DBVT_BLOB)) {
- memcpy(nameOrder, dbv.pbVal, dbv.cpbVal);
- db_free(&dbv);
- }
-
return 0;
}
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index a83e35c4a8..1553cbc8ea 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -197,7 +197,7 @@ bool CMainDlg::OnInitDialog() mir_subclassWindow(m_modules.GetHwnd(), ModuleTreeSubclassProc);
m_modules.SetImageList(hImg, TVSIL_NORMAL);
- //setting list
+ // setting list
mir_subclassWindow(m_settings.GetHwnd(), SettingListSubclassProc);
m_settings.SetExtendedListViewStyle(32 | LVS_EX_SUBITEMIMAGES | LVS_EX_LABELTIP); //LVS_EX_GRIDLINES
loadListSettings(m_settings.GetHwnd(), csSettingList);
diff --git a/plugins/DbEditorPP/src/stdafx.h b/plugins/DbEditorPP/src/stdafx.h index 9ce98b774e..79e875b3b9 100644 --- a/plugins/DbEditorPP/src/stdafx.h +++ b/plugins/DbEditorPP/src/stdafx.h @@ -17,6 +17,7 @@ #include <newpluginapi.h>
#include <m_clist.h>
+#include <m_contacts.h>
#include <m_database.h>
#include <m_db_int.h>
#include <m_gui.h>
diff --git a/plugins/DbEditorPP/src/utils.cpp b/plugins/DbEditorPP/src/utils.cpp index 6662ba4f83..63be5c2a86 100644 --- a/plugins/DbEditorPP/src/utils.cpp +++ b/plugins/DbEditorPP/src/utils.cpp @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-extern uint8_t nameOrder[NAMEORDERCOUNT];
-
/////////////////////////////////////////////////////////////////////////////////////////
int ListView_GetItemTextA(HWND hwndLV, int i, int iSubItem, char *pszText, int cchTextMax)
@@ -248,75 +246,20 @@ int GetContactName(MCONTACT hContact, const char *proto, wchar_t *value, int max char *szProto = (char*)proto;
char tmp[FLD_SIZE];
- wchar_t name[NAME_SIZE]; name[0] = 0;
if (hContact && (!proto || !proto[0]))
if (!db_get_static(hContact, "Protocol", "p", tmp, _countof(tmp)))
szProto = tmp;
- for (int i = 0; i < NAMEORDERCOUNT - 1; i++) {
- switch (nameOrder[i]) {
- case 0: // custom name
- GetValueW(hContact, "CList", "MyHandle", name, _countof(name));
- break;
-
- case 1: // nick
- if (!szProto) break;
- GetValueW(hContact, szProto, "Nick", name, _countof(name));
- break;
-
- case 2: // First Name
- // if (!szProto) break;
- // GetValueW(hContact, szProto, "FirstName", name, _countof(name));
- break;
-
- case 3: // E-mail
- if (!szProto) break;
- GetValueW(hContact, szProto, "e-mail", name, _countof(name));
- break;
-
- case 4: // Last Name
- // GetValueW(hContact, szProto, "LastName", name, _countof(name));
- break;
-
- case 5: // Unique id
- if (szProto) {
- // protocol must define a PFLAG_UNIQUEIDSETTING
- const char *uid = Proto_GetUniqueId(szProto);
- if (uid)
- GetValueW(hContact, szProto, uid, name, _countof(name));
- }
- break;
-
- case 6: // first + last name
- if (szProto) {
- GetValueW(hContact, szProto, "FirstName", name, _countof(name));
-
- int len = (int)mir_wstrlen(name);
- if (len + 2 < _countof(name)) {
- if (len)
- mir_wstrncat(name, L" ", _countof(name));
- len++;
- GetValueW(hContact, szProto, "LastName", &name[len], _countof(name) - len);
- }
- }
- break;
- }
-
- if (name[0])
- break;
- }
-
- if (!name[0])
- mir_wstrncpy(name, TranslateT("<UNKNOWN>"), _countof(name));
+ ptrW pwszNick(Contact::GetInfo(CNF_DISPLAY, hContact, szProto));
if (szProto && szProto[0]) {
if (g_Order)
- mir_snwprintf(value, maxlen, L"(%S) %s", szProto, name);
+ mir_snwprintf(value, maxlen, L"(%S) %s", szProto, pwszNick.get());
else
- mir_snwprintf(value, maxlen, L"%s (%S)", name, szProto);
+ mir_snwprintf(value, maxlen, L"%s (%S)", pwszNick.get(), szProto);
}
- else mir_wstrncpy(value, name, maxlen);
+ else mir_wstrncpy(value, pwszNick, maxlen);
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (!pa->IsEnabled()) {
diff --git a/plugins/DbEditorPP/src/version.h b/plugins/DbEditorPP/src/version.h index 082cc92b36..555e890442 100644 --- a/plugins/DbEditorPP/src/version.h +++ b/plugins/DbEditorPP/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 4
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 3
+#define __BUILD_NUM 4
#include <stdver.h>
diff --git a/src/mir_app/src/modules.cpp b/src/mir_app/src/modules.cpp index ff0b6682f2..0db467d25f 100644 --- a/src/mir_app/src/modules.cpp +++ b/src/mir_app/src/modules.cpp @@ -98,6 +98,7 @@ int LoadDefaultModules(void) if (LoadButtonModule()) return 1;
if (LoadIcoLibModule()) return 1;
if (LoadSkinIcons()) return 1;
+ if (LoadContactsModule()) return 1;
// check if a service plugin is scheduled to execution
if (plugin_service != nullptr) {
@@ -130,7 +131,6 @@ int LoadDefaultModules(void) if (LoadProtocolsModule()) return 1;
LoadDbAccounts(); // retrieves the account array from a database
- if (LoadContactsModule()) return 1;
if (LoadMetacontacts()) return 1;
if (LoadNewPluginsModule()) return 1; // will call Load(void) on everything, clist will load first
|