summaryrefslogtreecommitdiff
path: root/plugins/Non-IM Contact
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-07 19:27:31 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-07 19:27:31 +0000
commit1a8fbb98e30b55aee908e3ad2382622a0688c635 (patch)
tree870a5861345c4f0115304655861c1d0137d8b3ef /plugins/Non-IM Contact
parentd2a2a30b0dfd94fa50bf269a17c6486a33114877 (diff)
direct access to CListGroups restricted
git-svn-id: http://svn.miranda-ng.org/main/trunk@6009 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Non-IM Contact')
-rw-r--r--plugins/Non-IM Contact/src/commonheaders.h1
-rw-r--r--plugins/Non-IM Contact/src/contactinfo.cpp48
-rw-r--r--plugins/Non-IM Contact/src/main.cpp2
3 files changed, 11 insertions, 40 deletions
diff --git a/plugins/Non-IM Contact/src/commonheaders.h b/plugins/Non-IM Contact/src/commonheaders.h
index 8dad5c498a..ca593df8ab 100644
--- a/plugins/Non-IM Contact/src/commonheaders.h
+++ b/plugins/Non-IM Contact/src/commonheaders.h
@@ -33,6 +33,7 @@ struct DLGTEMPLATEEX
#include <newpluginapi.h>
#include <m_clist.h>
+#include <m_clistint.h>
#include <m_clui.h>
#include <m_skin.h>
#include <m_langpack.h>
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp
index daf3f96ce4..c55ea4f159 100644
--- a/plugins/Non-IM Contact/src/contactinfo.cpp
+++ b/plugins/Non-IM Contact/src/contactinfo.cpp
@@ -78,32 +78,6 @@ LRESULT CALLBACK ButtWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
return res;
}
-void checkGroups(TCHAR* group)
-{
- if (lstrlen(group) < 1)
- return;
-
- char str[50];
- int i;
- for (i=0;; i++) {
- _itoa(i, str, 10);
- DBVARIANT dbv;
- if (db_get_ts(NULL, "CListGroups", str, &dbv))
- break;
-
- bool bFound = lstrcmpi(dbv.ptszVal+1, group) == 0;
- db_free(&dbv);
- if (bFound)
- return;
- }
-
- TCHAR name[256];
- name[0] = 1 | GROUPF_EXPANDED;
- _tcsncpy(name+1, group, SIZEOF(name)-1);
- db_set_ts(NULL, "CListGroups", str, name);
- CallService(MS_CLUI_GROUPADDED, i+1, 0);
-}
-
int BrowseForFolder(HWND hwnd,char *szPath)
{
int result=0;
@@ -138,8 +112,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
switch(msg) {
case WM_INITDIALOG:
{
- int i = 0;
- DBVARIANT dbv;
+ int i;
char string[512];
HANDLE hContact = (HANDLE)((PROPSHEETPAGE*)lParam)->lParam;
TranslateDialogDefault(hwnd);
@@ -155,16 +128,11 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
SetDlgItemTextA(hwnd, IDC_PARAMS, string);
/* group*/
- while (i != -1) {
- char str[3];
- mir_snprintf(str, SIZEOF(str), "%d", i);
- if (!db_get_ts(NULL, "CListGroups", str, &dbv)) {
- SendMessage(GetDlgItem(hwnd, IDC_GROUP), CB_INSERTSTRING,0, LPARAM(dbv.ptszVal+1));
- db_free(&dbv);
- i++;
- }
- else i = -1;
- }
+ TCHAR *szGroup;
+ for (i=1; (szGroup = pcli->pfnGetGroupName(i, NULL)) != NULL; i++)
+ SendMessage(GetDlgItem(hwnd, IDC_GROUP), CB_INSERTSTRING,0, LPARAM(szGroup));
+
+ DBVARIANT dbv;
if (!db_get(hContact, "CList", "Group", &dbv))
SetDlgItemTextA(hwnd, IDC_GROUP, dbv.pszVal);
@@ -268,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, SIZEOF(text));
- checkGroups(text);
+ Clist_CreateGroup(NULL, text);
db_set_ts(hContact, "CList", "Group", text);
}
else db_unset(hContact, "CList", "Group");
@@ -595,7 +563,7 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam)
}
else if (contactDone && !strcmp(line,"[/Non-IM Contact]\r\n")) {
if (!name) continue;
- int size = strlen(name) + strlen("Do you want to import this Non-IM Contact?\r\n\r\nName: \r\n") + 1;
+ size_t size = strlen(name) + strlen("Do you want to import this Non-IM Contact?\r\n\r\nName: \r\n") + 1;
char *msg = (char*)malloc(size);
mir_snprintf(msg, size, "Do you want to import this Non-IM Contact?\r\n\r\nName: %s\r\n", name);
if (program) {
diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp
index 02df17e56d..a2a9537b88 100644
--- a/plugins/Non-IM Contact/src/main.cpp
+++ b/plugins/Non-IM Contact/src/main.cpp
@@ -6,6 +6,7 @@
#include "Version.h"
+CLIST_INTERFACE *pcli;
HINSTANCE hInst;
int hLangpack;
@@ -122,6 +123,7 @@ IconItem icoList[] =
extern "C" __declspec(dllexport) int Load()
{
mir_getLP(&pluginInfoEx);
+ mir_getCLI();
Icon_Register(hInst, LPGEN("Non-IM Contact"), icoList, SIZEOF(icoList));