From 18f7e9261c885e953f220ba6836e8bca43a6fc88 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 15 Apr 2016 13:40:58 +0000 Subject: contact list groups: - finally database is not used anymore (only as a settings' storage); - MGROUP type introduced to replace HANDLE for group ids; - MS_CLIST_GROUP* services became Clist_Group* functions; - CLIST_INTERFACE members pfnGetGroupName & pfnRenameGroup also transformed into static Clist_Group* functions git-svn-id: http://svn.miranda-ng.org/main/trunk@16659 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AddContactPlus/src/addcontact.cpp | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 17 ++++++------ plugins/Clist_modern/src/modern_clcitems.cpp | 4 +-- plugins/Clist_modern/src/modern_viewmodebar.cpp | 2 +- plugins/Clist_nicer/src/clcitems.cpp | 2 +- plugins/Clist_nicer/src/clui.cpp | 2 +- plugins/Clist_nicer/src/contact.cpp | 2 +- plugins/Clist_nicer/src/viewmodes.cpp | 2 +- plugins/ContactsPlus/src/receive.cpp | 4 +-- plugins/DbEditorPP/src/exportimport.cpp | 13 +++------- plugins/FavContacts/src/menu.cpp | 2 +- plugins/Import/src/utils.cpp | 2 +- plugins/NewAwaySysMod/src/ContactList.cpp | 2 +- plugins/NewsAggregator/Src/ExportImport.cpp | 30 ++++++---------------- plugins/Non-IM Contact/src/contactinfo.cpp | 4 +-- plugins/Quotes/src/ImportExport.cpp | 2 +- plugins/SendScreenshotPlus/src/CSendDropbox.cpp | 1 - plugins/StopSpamMod/src/options.cpp | 8 +++--- plugins/StopSpamMod/src/utilities.cpp | 14 ++-------- plugins/StopSpamPlus/src/services.cpp | 8 +++--- plugins/StopSpamPlus/src/stopspam.cpp | 3 ++- .../src/ex_import/classExImContactBase.cpp | 11 ++------ plugins/Utils.pas/mirutils.pas | 2 +- 23 files changed, 51 insertions(+), 88 deletions(-) (limited to 'plugins') diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index 8255c97ac2..e4138f02ec 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -170,7 +170,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) HookEventMessage(ME_PROTO_ACCLISTCHANGED, hdlg, DM_ADDCONTACT_CHANGEACCLIST); { TCHAR *szGroup; - for (int i = 1; (szGroup = pcli->pfnGetGroupName(i, NULL)) != NULL; i++) { + for (int i = 1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) { int id = SendDlgItemMessage(hdlg, IDC_GROUP, CB_ADDSTRING, 0, (LPARAM)szGroup); SendDlgItemMessage(hdlg, IDC_GROUP, CB_SETITEMDATA, (WPARAM)id, (LPARAM)i); } diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 169089957b..99703afe5f 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -128,9 +128,7 @@ static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam) DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; if (hContact == NULL) { - if (!strcmp(cws->szModule, "CListGroups")) - pcli->pfnClcBroadcast(INTM_GROUPSCHANGED, hContact, lParam); - else if (!strcmp(cws->szSetting, "XStatusId") || !strcmp(cws->szSetting, "XStatusName")) + if (!strcmp(cws->szSetting, "XStatusId") || !strcmp(cws->szSetting, "XStatusName")) cliCluiProtocolStatusChanged(0, cws->szModule); else if (!strcmp(cws->szModule, "CList")) { if (!strcmp(cws->szSetting, "OnTop")) @@ -352,13 +350,13 @@ static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM if (contact->type == CLCIT_GROUP) { SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS); SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_USEGROUPS); - CallService(MS_CLIST_GROUPCREATE, contact->groupId, 0); + Clist_GroupCreate(contact->groupId, 0); } return 0; case POPUP_GROUPSHOWOFFLINE: if (contact->type == CLCIT_GROUP) { - CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, MAKELPARAM(CLCItems_IsShowOfflineGroup(contact->group) ? 0 : GROUPF_SHOWOFFLINE, GROUPF_SHOWOFFLINE)); + Clist_GroupSetFlags(contact->groupId, MAKELPARAM(CLCItems_IsShowOfflineGroup(contact->group) ? 0 : GROUPF_SHOWOFFLINE, GROUPF_SHOWOFFLINE)); pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); } return 0; @@ -1251,9 +1249,9 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, pcli->pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group); int i = pcli->pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup); if (i != -1 && group->groupId != destgroup->groupId) { - TCHAR *groupName = mir_tstrdup(pcli->pfnGetGroupName(contact->groupId, 0)); + TCHAR *groupName = mir_tstrdup(Clist_GroupGetName(contact->groupId, 0)); TCHAR *shortGroup = NULL; - TCHAR *sourceGrName = mir_tstrdup(pcli->pfnGetGroupName(destgroup->groupId, 0)); + TCHAR *sourceGrName = mir_tstrdup(Clist_GroupGetName(destgroup->groupId, 0)); if (groupName) { int len = (int)mir_tstrlen(groupName); do { len--; } while (len >= 0 && groupName[len] != '\\'); @@ -1272,10 +1270,11 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, mir_free(groupName); mir_free(sourceGrName); } - int newIndex = CallService(MS_CLIST_GROUPMOVEBEFORE, contact->groupId, (destcontact && i != -1) ? destcontact->groupId : 0); + + int newIndex = Clist_GroupMoveBefore(contact->groupId, (destcontact && i != -1) ? destcontact->groupId : 0); newIndex = newIndex ? newIndex : contact->groupId; if (NeedRename) - pcli->pfnRenameGroup(newIndex, newName); + Clist_GroupRename(newIndex, newName); } break; diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index d393cd87dc..14f8632f26 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -262,7 +262,7 @@ bool CLCItems_IsShowOfflineGroup(ClcGroup *group) if (group->hideOffline) return false; DWORD groupFlags = 0; - pcli->pfnGetGroupName(group->groupId, &groupFlags); + Clist_GroupGetName(group->groupId, &groupFlags); return (groupFlags & GROUPF_SHOWOFFLINE) != 0; } @@ -324,7 +324,7 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) for (int i = 1;; i++) { DWORD groupFlags; - TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags); //UNICODE + TCHAR *szGroupName = Clist_GroupGetName(i, &groupFlags); //UNICODE if (szGroupName == NULL) break; cli_AddGroup(hwnd, dat, szGroupName, groupFlags, i, 0); diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index ecb2d33ab8..130129bb4b 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -246,7 +246,7 @@ static int FillDialog(HWND hwnd) SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); TCHAR *szGroup; - for (int i = 1; (szGroup = pcli->pfnGetGroupName(i, NULL)) != NULL; i++) { + for (int i = 1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) { item.pszText = szGroup; SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); } diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 0cd08daeba..6f4324c90e 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -166,7 +166,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) { for (int i = 1;; i++) { DWORD groupFlags; - TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags); + TCHAR *szGroupName = Clist_GroupGetName(i, &groupFlags); if (szGroupName == NULL) break; pcli->pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0); diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index c4cd90451a..6fcc9a0b85 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -1497,7 +1497,7 @@ buttons_done: case POPUP_NEWGROUP: SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0); SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, 1, 0); - Clist_CreateGroup(NULL, NULL); + Clist_GroupCreate(NULL, NULL); break; case POPUP_HIDEOFFLINE: case IDC_TBHIDEOFFLINE: diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index 4f0b1046db..b5ff16c270 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -131,7 +131,7 @@ void LoadContactTree(void) CallService(MS_CLUI_LISTBEGINREBUILD, 0, 0); for (i = 1;; i++) { - if (pcli->pfnGetGroupName(i, NULL) == NULL) + if (Clist_GroupGetName(i, NULL) == NULL) break; CallService(MS_CLUI_GROUPADDED, i, 0); } diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 5ac4b928c0..c68cc5b022 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -200,7 +200,7 @@ static int FillDialog(HWND hwnd) SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); TCHAR *grpName; - for (i = 1; (grpName = pcli->pfnGetGroupName(i, NULL)) != NULL; i++) { + for (i = 1; (grpName = Clist_GroupGetName(i, NULL)) != NULL; i++) { item.pszText = grpName; SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); } diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index 6606c2fdbb..a04891ad58 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -103,7 +103,7 @@ static void EnableGroupCombo(HWND hwndDlg) static void RebuildGroupCombo(HWND hwndDlg) { - int bHasGroups = pcli->pfnGetGroupName(0, NULL) != 0; + int bHasGroups = Clist_GroupGetName(0, NULL) != 0; HWND hGroupsCombo = GetDlgItem(hwndDlg, IDC_GROUPS); if (bHasGroups) { @@ -120,7 +120,7 @@ static void RebuildGroupCombo(HWND hwndDlg) SendMessage(hGroupsCombo, CB_RESETCONTENT, 0, 0); TCHAR *szGroup; - for (int i=1; (szGroup = pcli->pfnGetGroupName(i, NULL)) != NULL; i++) { + for (int i=1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) { int nIndex = SendMessage(hGroupsCombo, CB_ADDSTRING, 0, (LPARAM)szGroup); SendMessage(hGroupsCombo, CB_SETITEMDATA, nIndex, i); } diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 18790a530c..a9f5d33b7f 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -356,18 +356,13 @@ void importSettings(MCONTACT hContact, char *utf8) // get the type type = *(end + 1); if (mir_strcmp(module, "CList") == 0 && mir_strcmp(setting, "Group") == 0) { - ptrA GroupName(mir_utf8decodeA(end + 2)); + ptrT GroupName(mir_utf8decodeT(end + 2)); if (!GroupName) continue; - HANDLE GroupHandle = (HANDLE)CallService(MS_CLIST_GROUPEXISTS, 0, LPARAM(GroupName)); - if (GroupHandle == 0) { - GroupHandle = (HANDLE)CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)GroupName); - if (GroupHandle) { - CallService(MS_CLUI_GROUPADDED, (WPARAM)GroupHandle, 0); - CallService(MS_CLIST_GROUPSETEXPANDED, (WPARAM)GroupHandle, 1); - } - } + MGROUP GroupHandle = Clist_GroupCreate(0, GroupName); + CallService(MS_CLUI_GROUPADDED, GroupHandle, 0); + Clist_GroupSetExpanded(GroupHandle, true); } switch (type) { diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp index ea979685fa..150145e693 100644 --- a/plugins/FavContacts/src/menu.cpp +++ b/plugins/FavContacts/src/menu.cpp @@ -35,7 +35,7 @@ static TCHAR* sttGetGroupName(int id) return TranslateT("Favorite Contacts"); } - return pcli->pfnGetGroupName(id - 1, NULL); + return Clist_GroupGetName(id - 1, NULL); } static BOOL sttMeasureItem_Group(LPMEASUREITEMSTRUCT lpmis, Options *options) diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index 25f856e5bb..05d4e1d0ad 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -42,7 +42,7 @@ int CreateGroup(const TCHAR *group, MCONTACT hContact) return 0; } - Clist_CreateGroup(NULL, group); + Clist_GroupCreate(NULL, group); if (hContact) db_set_ts(hContact, "CList", "Group", group); return 1; diff --git a/plugins/NewAwaySysMod/src/ContactList.cpp b/plugins/NewAwaySysMod/src/ContactList.cpp index 503eeb5a81..17f12f5f65 100644 --- a/plugins/NewAwaySysMod/src/ContactList.cpp +++ b/plugins/NewAwaySysMod/src/ContactList.cpp @@ -382,7 +382,7 @@ HTREEITEM CCList::AddGroup(TCString GroupName) if (GroupName == _T("")) return TVI_ROOT; - HANDLE hGroupId = Clist_GroupExists(GroupName); + MGROUP hGroupId = Clist_GroupExists(GroupName); if (hGroupId == NULL) return NULL; diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp index 45aac14986..7f2f403941 100644 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ b/plugins/NewsAggregator/Src/ExportImport.cpp @@ -139,12 +139,12 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM parent = xmlGetParent(parent); } - TCHAR *utfgroup = NULL; + TCHAR *ptszGroup = NULL; if (group) { - utfgroup = mir_utf8decodeT(_T2A(group)); - if ( !utfgroup) { + ptszGroup = mir_utf8decodeT(_T2A(group)); + if ( !ptszGroup) { isGroupUTF = false; - utfgroup = group; + ptszGroup = group; } else isGroupUTF = 1; } @@ -158,26 +158,12 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM db_set_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME); db_set_ts(hContact, MODULE, "MsgFormat", TAGSDEFAULT); db_set_w(hContact, MODULE, "Status", CallProtoService(MODULE, PS_GETSTATUS, 0, 0)); - if (utfgroup) { - db_set_ts(hContact, "CList", "Group", utfgroup); - int hGroup = 1; - char *group_name; - BYTE GroupExist = 0; - do { - group_name = (char *)CallService(MS_CLIST_GROUPGETNAME, (WPARAM)hGroup, 0); - if (group_name != NULL && !mir_strcmp(group_name, _T2A(utfgroup))) { - GroupExist = 1; - break; - } - hGroup++; - } - while (group_name); - - if(!GroupExist) - CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)utfgroup); + if (ptszGroup) { + db_set_ts(hContact, "CList", "Group", ptszGroup); + Clist_GroupCreate(0, ptszGroup); } if (isGroupUTF) - mir_free(utfgroup); + mir_free(ptszGroup); } if (isTextUTF) mir_free(text); diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index 095d04bc7d..7e4e27a535 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -132,7 +132,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP /* group*/ TCHAR *szGroup; - for (int i = 1; (szGroup = pcli->pfnGetGroupName(i, NULL)) != NULL; i++) + for (int i = 1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) SendDlgItemMessage(hwnd, IDC_GROUP, CB_INSERTSTRING, 0, LPARAM(szGroup)); if (!db_get_ts(hContact, "CList", "Group", &dbv)) { @@ -236,7 +236,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP if (GetWindowTextLength(GetDlgItem(hwnd, IDC_GROUP))) { TCHAR text[512]; GetDlgItemText(hwnd, IDC_GROUP, text, _countof(text)); - Clist_CreateGroup(NULL, text); + Clist_GroupCreate(NULL, text); db_set_ts(hContact, "CList", "Group", text); } else db_unset(hContact, "CList", "Group"); diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index f32b4fcb61..29b5f0f8e6 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -349,7 +349,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule) } if ((true == bCListModule) && (0 == mir_tstrcmpi(sName.c_str(), _T("Group")))) - CallService(MS_CLIST_GROUPCREATE, NULL, reinterpret_cast(sValue.c_str())); + Clist_GroupCreate(NULL, sValue.c_str()); } } } diff --git a/plugins/SendScreenshotPlus/src/CSendDropbox.cpp b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp index dc675a6a40..2bcebe5287 100644 --- a/plugins/SendScreenshotPlus/src/CSendDropbox.cpp +++ b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp @@ -58,7 +58,6 @@ void CSendDropbox::SendThread() DropboxUploadInfo ui = { m_pszFile, _T("SendSS") }; - char **test = &m_URL; if (CallService(MS_DROPBOX_UPLOAD, (WPARAM)&m_URL, (LPARAM)&ui)) { Error(LPGENT("%s (%i):\nCould not add a share to the Dropbox plugin."), TranslateTS(m_pszSendTyp), 0); diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp index c4c32f55dc..5878c9ce40 100755 --- a/plugins/StopSpamMod/src/options.cpp +++ b/plugins/StopSpamMod/src/options.cpp @@ -17,8 +17,6 @@ #include "stdafx.h" -int CreateCListGroup(TCHAR* szGroupName); - char *pluginDescription = LPGEN("No more spam! Robots can't go! Only human beings invited!\r\n\r\nThis plugin works pretty simple:\r\nWhile messages from users on your contact list go as there is no any anti-spam software, messages from unknown users are not delivered to you. But also they are not ignored, this plugin replies with a simple question, and if user gives the right answer, plugin adds him to your contact list so that he can contact you."); TCHAR const *defQuestion = TranslateT("Spammers made me to install small anti-spam system you are now speaking with.\r\nPlease reply \"nospam\" without quotes and spaces if you want to contact me."); @@ -280,7 +278,7 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar db_set_ws(NULL, pluginName, "SpammersGroup", NewGroupName.c_str()); gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("Spammers")); if (!GroupExist && gbSpecialGroup) - CreateCListGroup((TCHAR*)gbSpammersGroup.c_str()); + Clist_GroupCreate(0, gbSpammersGroup.c_str()); } } db_set_b(NULL, pluginName, "SpecialGroup", gbSpecialGroup = BST_CHECKED == IsDlgButtonChecked(hwnd, ID_SPECIALGROUP)); @@ -304,7 +302,7 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar db_set_ws(NULL, pluginName, "AutoAuthGroup", NewAGroupName.c_str()); gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", _T("Not Spammers")); if (!GroupExist && gbAutoAddToServerList) - CreateCListGroup((TCHAR*)gbAutoAuthGroup.c_str()); + Clist_GroupCreate(0, gbAutoAuthGroup.c_str()); } } return TRUE; @@ -317,6 +315,8 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar HINSTANCE hInst; MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l) { + UNREFERENCED_PARAMETER(l); + OPTIONSDIALOGPAGE odp = { 0 }; odp.ptszGroup = LPGENT("Message sessions"); odp.ptszTitle = LPGENT("StopSpam"); diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 2cad3a82a6..cc13f07cbd 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -64,16 +64,6 @@ bool ProtoInList(std::string proto) return std::string::npos != GetProtoList().find(proto + "\r\n"); } -int CreateCListGroup(TCHAR* szGroupName) -{ - int hGroup = CallService(MS_CLIST_GROUPCREATE, 0, 0); - - TCHAR* usTmp = szGroupName; - pcli->pfnRenameGroup(hGroup, usTmp); - - return hGroup; -} - void DeleteCListGroupsByName(TCHAR* szGroupName) { BYTE ConfirmDelete = db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT); @@ -81,9 +71,9 @@ void DeleteCListGroupsByName(TCHAR* szGroupName) db_set_b(NULL, "CList", "ConfirmDelete", 0); TCHAR *szGroup; - for (int i = 1; (szGroup = pcli->pfnGetGroupName(i, NULL)) != NULL; i++) + for (int i = 1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) if (!mir_wstrcmp(szGroupName, szGroup)) - CallService(MS_CLIST_GROUPDELETE, i, 0); + Clist_GroupDelete(i); if (ConfirmDelete) db_set_b(NULL, "CList", "ConfirmDelete", ConfirmDelete); diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp index 2872181726..0310bb6c13 100644 --- a/plugins/StopSpamPlus/src/services.cpp +++ b/plugins/StopSpamPlus/src/services.cpp @@ -47,15 +47,15 @@ INT_PTR RemoveTempContacts(WPARAM, LPARAM lParam) } int hGroup = 1; - char *group_name; + TCHAR *group_name; do { - group_name = (char *)CallService(MS_CLIST_GROUPGETNAME, (WPARAM)hGroup, 0); - if (group_name != NULL && strstr(group_name, "Not In List")) { + group_name = Clist_GroupGetName(hGroup, 0); + if (group_name != NULL && _tcsstr(group_name, TranslateT("Not In List"))) { BYTE ConfirmDelete = db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT); if (ConfirmDelete) db_set_b(NULL, "CList", "ConfirmDelete", 0); - CallService(MS_CLIST_GROUPDELETE, (WPARAM)hGroup, 0); + Clist_GroupDelete(hGroup); if (ConfirmDelete) db_set_b(NULL, "CList", "ConfirmDelete", ConfirmDelete); break; diff --git a/plugins/StopSpamPlus/src/stopspam.cpp b/plugins/StopSpamPlus/src/stopspam.cpp index c7ccac01ea..13fd6dbd21 100644 --- a/plugins/StopSpamPlus/src/stopspam.cpp +++ b/plugins/StopSpamPlus/src/stopspam.cpp @@ -21,7 +21,7 @@ PLUGININFOEX pluginInfoEx = { { 0x553811ee, 0xdeb6, 0x48b8, { 0x89, 0x2, 0xa8, 0xa0, 0xc, 0x1f, 0xd6, 0x79 } } }; - +CLIST_INTERFACE *pcli; HINSTANCE hInst; extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) @@ -38,6 +38,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfoEx); + mir_getCLI(); plSets = new Settings; diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 456c704ad8..6963b75b55 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -256,16 +256,9 @@ MCONTACT CExImContactBase::toDB() // add group if (_pszGroup) { - ptrT ptszGroup( mir_utf8decodeT(_pszGroup)); + ptrT ptszGroup(mir_utf8decodeT(_pszGroup)); db_set_ts(_hContact, MOD_CLIST, "Group", ptszGroup); - if ( Clist_GroupExists(ptszGroup) == NULL) { - HANDLE hGroup = Clist_CreateGroup(NULL, NULL); - if (hGroup) { - // renaming twice is stupid but the only way to avoid error dialog telling shit like - // a group with that name does exist - CallService(MS_CLIST_GROUPRENAME, (WPARAM)hGroup, (LPARAM)ptszGroup); - } - } + Clist_GroupCreate(NULL, ptszGroup); } } return _hContact; diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index 67f085fe0a..dee3bbdc87 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -341,7 +341,7 @@ begin exit; end; - CallService(MS_CLIST_GROUPCREATE,0,lparam(name)); + Clist_GroupCreate(0,name); if hContact<>0 then DBWriteUnicode(hContact,strCList,clGroup,name); -- cgit v1.2.3