summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/GmailNotifier/src/check.cpp132
-rw-r--r--plugins/GmailNotifier/src/gmail.h20
-rw-r--r--plugins/GmailNotifier/src/notify.cpp84
-rw-r--r--plugins/GmailNotifier/src/options.cpp34
-rw-r--r--plugins/GmailNotifier/src/utility.cpp36
5 files changed, 151 insertions, 155 deletions
diff --git a/plugins/GmailNotifier/src/check.cpp b/plugins/GmailNotifier/src/check.cpp
index b3821cb7cf..dafed2dcc8 100644
--- a/plugins/GmailNotifier/src/check.cpp
+++ b/plugins/GmailNotifier/src/check.cpp
@@ -9,12 +9,12 @@ void CheckMailInbox(Account *curAcc)
HINTERNET hHTTPRequest; // internet request hadle
DBVARIANT dbv;
- static char *contentType = "Content-Type: application/x-www-form-urlencoded";
- char requestBuffer[256] = "continue=https%3A%2F%2Fmail.google.com%2Fa%2F";
- char fileBuffer[_MAX_DOWN_BUFFER] = "";
- char *tail;
- char str[64];
- char temp[_MAX_DOWN_BUFFER] = "";
+ static TCHAR *contentType = _T("Content-Type: application/x-www-form-urlencoded");
+ TCHAR requestBuffer[256] = _T("continue=https%3A%2F%2Fmail.google.com%2Fa%2F");
+ TCHAR fileBuffer[_MAX_DOWN_BUFFER] = _T("");
+ TCHAR *tail;
+ TCHAR str[64];
+ TCHAR temp[_MAX_DOWN_BUFFER] = _T("");
unsigned long bufferLength;
if (curAcc->IsChecking)
@@ -22,30 +22,30 @@ void CheckMailInbox(Account *curAcc)
curAcc->IsChecking = TRUE;
- if (!db_get_s(curAcc->hContact, "CList", "MyHandle", &dbv)) {
- lstrcpyA(curAcc->results.content, dbv.pszVal);
+ if (!db_get_ts(curAcc->hContact, "CList", "MyHandle", &dbv)) {
+ lstrcpy(curAcc->results.content, dbv.ptszVal);
db_free(&dbv);
}
- else lstrcpyA(curAcc->results.content, curAcc->name);
+ else lstrcpy(curAcc->results.content, curAcc->name);
- tail = strstr(curAcc->results.content, " [");
+ tail = _tcsstr(curAcc->results.content, _T(" ["));
if (tail) *tail = '\0';
- lstrcatA(curAcc->results.content, " [");
+ lstrcat(curAcc->results.content, _T(" ["));
- lstrcpyA(str, curAcc->results.content);
- lstrcatA(str, Translate("Checking..."));
- lstrcatA(str, "]");
+ lstrcpy(str, curAcc->results.content);
+ lstrcat(str, TranslateT("Checking..."));
+ lstrcat(str, _T("]"));
- db_set_s(curAcc->hContact, "CList", "MyHandle", str);
- hHTTPOpen = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, "", "", 0);
+ db_set_ts(curAcc->hContact, "CList", "MyHandle", str);
+ hHTTPOpen = InternetOpen(_T(""), INTERNET_OPEN_TYPE_PRECONFIG, _T(""), _T(""), 0);
if (!hHTTPOpen) {
- lstrcatA(curAcc->results.content, Translate("Can't open Internet!"));
+ lstrcat(curAcc->results.content, TranslateT("Can't open Internet!"));
goto error_handle;
}
if (curAcc->hosted[0]) {
- hHTTPConnection = InternetConnectA(hHTTPOpen,
- "www.google.com",
+ hHTTPConnection = InternetConnect(hHTTPOpen,
+ _T("www.google.com"),
INTERNET_DEFAULT_HTTPS_PORT,
NULL,
NULL,
@@ -54,22 +54,22 @@ void CheckMailInbox(Account *curAcc)
0);
if (!hHTTPConnection) {
- lstrcatA(curAcc->results.content, Translate("Can't reach server!"));
+ lstrcat(curAcc->results.content, TranslateT("Can't reach server!"));
goto error_handle;
}
- lstrcpyA(str, "/a/");
- lstrcatA(str, curAcc->hosted);
- lstrcatA(str, "/LoginAction");
- hHTTPRequest = HttpOpenRequestA(hHTTPConnection, "POST", str, HTTP_VERSIONA, NULL, NULL, INTERNET_FLAG_SECURE, 0);
- lstrcatA(requestBuffer, curAcc->hosted);
- lstrcatA(requestBuffer, "%2Ffeed%2Fatom&service=mail&userName=");
- lstrcatA(requestBuffer, curAcc->name);
- tail = strchr(requestBuffer, '@');
+ lstrcpy(str, _T("/a/"));
+ lstrcat(str, curAcc->hosted);
+ lstrcat(str, _T("/LoginAction"));
+ hHTTPRequest = HttpOpenRequest(hHTTPConnection, _T("POST"), str, HTTP_VERSION, NULL, NULL, INTERNET_FLAG_SECURE, 0);
+ lstrcat(requestBuffer, curAcc->hosted);
+ lstrcat(requestBuffer, _T("%2Ffeed%2Fatom&service=mail&userName="));
+ lstrcat(requestBuffer, curAcc->name);
+ tail = _tcschr(requestBuffer, '@');
*tail = '\0';
- lstrcatA(requestBuffer, "&password=");
- lstrcatA(requestBuffer, curAcc->pass);
- if (!HttpSendRequestA(hHTTPRequest, contentType, (int)strlen(contentType) + 1, requestBuffer, (int)strlen(requestBuffer) + 1)) {
- lstrcpyA(curAcc->results.content, Translate("Can't send account data!"));
+ lstrcat(requestBuffer, _T("&password="));
+ lstrcat(requestBuffer, curAcc->pass);
+ if (!HttpSendRequest(hHTTPRequest, contentType, (int)_tcslen(contentType) + 1, requestBuffer, (int)_tcslen(requestBuffer) + 1)) {
+ lstrcpy(curAcc->results.content, TranslateT("Can't send account data!"));
goto error_handle;
}
@@ -77,42 +77,42 @@ void CheckMailInbox(Account *curAcc)
InternetCloseHandle(hHTTPRequest);
}
- hHTTPConnection = InternetConnectA(hHTTPOpen, "mail.google.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+ hHTTPConnection = InternetConnect(hHTTPOpen, _T("mail.google.com"), INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
if (!hHTTPConnection) {
- lstrcatA(curAcc->results.content, Translate("Can't reach server!"));
+ lstrcat(curAcc->results.content, TranslateT("Can't reach server!"));
goto error_handle;
}
if (curAcc->hosted[0]) {
- lstrcpyA(str, "/a/");
- lstrcatA(str, curAcc->hosted);
- lstrcatA(str, "/feed/atom");
+ lstrcpy(str, _T("/a/"));
+ lstrcat(str, curAcc->hosted);
+ lstrcat(str, _T("/feed/atom"));
}
- else lstrcpyA(str, "/mail/feed/atom");
+ else lstrcpy(str, _T("/mail/feed/atom"));
- hHTTPRequest = HttpOpenRequest(hHTTPConnection, _T("GET"), _A2T(str), NULL, NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD, 0);
- InternetSetOption(hHTTPRequest, INTERNET_OPTION_USERNAME, _A2T(curAcc->name), (int)strlen(curAcc->name) + 1);
- InternetSetOption(hHTTPRequest, INTERNET_OPTION_PASSWORD, _A2T(curAcc->pass), (int)strlen(curAcc->pass) + 1);
+ hHTTPRequest = HttpOpenRequest(hHTTPConnection, _T("GET"), str, NULL, NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD, 0);
+ InternetSetOption(hHTTPRequest, INTERNET_OPTION_USERNAME, curAcc->name, (int)_tcslen(curAcc->name) + 1);
+ InternetSetOption(hHTTPRequest, INTERNET_OPTION_PASSWORD, curAcc->pass, (int)_tcslen(curAcc->pass) + 1);
if (!HttpSendRequest(hHTTPRequest, NULL, 0, NULL, 0)) {
- lstrcatA(curAcc->results.content, Translate("Can't get RSS feed!"));
+ lstrcat(curAcc->results.content, TranslateT("Can't get RSS feed!"));
goto error_handle;
}
while (InternetReadFile(hHTTPRequest, temp, _MAX_DOWN_BUFFER, &bufferLength) && bufferLength > 0) {
temp[bufferLength] = '\0';
- lstrcatA(fileBuffer, temp);
+ lstrcat(fileBuffer, temp);
}
fileBuffer[_MAX_DOWN_BUFFER - 1] = '\0';
curAcc->results_num = ParsePage(fileBuffer, &curAcc->results);
if (curAcc->results_num == -1) {
- lstrcatA(curAcc->results.content, Translate("Wrong name or password!"));
+ lstrcat(curAcc->results.content, TranslateT("Wrong name or password!"));
goto error_handle;
}
InternetCloseHandle(hHTTPOpen);
InternetCloseHandle(hHTTPConnection);
InternetCloseHandle(hHTTPRequest);
- lstrcatA(curAcc->results.content, _itoa(curAcc->results_num, str, 10));
- lstrcatA(curAcc->results.content, "]");
+ lstrcat(curAcc->results.content, _itot(curAcc->results_num, str, 10));
+ lstrcat(curAcc->results.content, _T("]"));
curAcc->IsChecking = FALSE;
return;
@@ -123,14 +123,14 @@ error_handle:
InternetCloseHandle(hHTTPConnection);
InternetCloseHandle(hHTTPRequest);
- lstrcatA(curAcc->results.content, "]");
+ lstrcat(curAcc->results.content, _T("]"));
curAcc->IsChecking = FALSE;
}
void __cdecl Check_ThreadFunc(void *lpParam)
{
- InternetSetCookieA("https://mail.google.com/mail/", "GX", "");
+ InternetSetCookie(_T("https://mail.google.com/mail/"), _T("GX"), _T(""));
if (lpParam) {
CheckMailInbox((Account *)lpParam);
NotifyUser((Account *)lpParam);
@@ -143,41 +143,37 @@ void __cdecl Check_ThreadFunc(void *lpParam)
}
}
-int ParsePage(char *page, resultLink *prst)
+int ParsePage(TCHAR *page, resultLink *prst)
{
- char *str_head;
- char *str_tail;
- char name[64], title[64];
+ TCHAR *str_head, *str_tail;
+ TCHAR name[64], title[64];
int num = 0;
- wchar_t str[64];
prst->next = NULL;
- if (strstr(page, "Unauthorized"))
+ if (_tcsstr(page, _T("Unauthorized")))
return -1;
- if (!(str_head = strstr(page, "<entry>")))
+ if (!(str_head = _tcsstr(page, _T("<entry>"))))
return 0;
- while (str_head = strstr(str_head, "<title>")) {
+ while (str_head = _tcsstr(str_head, _T("<title>"))) {
prst = prst->next = (resultLink *)malloc(sizeof(resultLink));
str_head += 7;
- str_tail = strstr(str_head, "</title>");
+ str_tail = _tcsstr(str_head, _T("</title>"));
*str_tail = '\0';
- lstrcpynA(title, str_head, 41);
- if (lstrlenA(title) == 40)
- lstrcatA(title, "...");
+ lstrcpyn(title, str_head, 41);
+ if (lstrlen(title) == 40)
+ lstrcat(title, _T("..."));
*str_tail = ' ';
- str_head = strstr(str_head, "<name>") + 6;
- str_tail = strstr(str_head, "</name>");
+ str_head = _tcsstr(str_head, _T("<name>")) + 6;
+ str_tail = _tcsstr(str_head, _T("</name>"));
*str_tail = '\0';
- lstrcpynA(name, str_head, 11);
- lstrcatA(name, ": ");
+ lstrcpyn(name, str_head, 11);
+ lstrcat(name, _T(": "));
*str_tail = ' ';
- lstrcpyA(prst->content, name);
- lstrcatA(prst->content, title);
- MultiByteToWideChar(CP_UTF8, 0, prst->content, -1, str, 64);
- WideCharToMultiByte(CP_ACP, 0, str, -1, prst->content, 64, NULL, NULL);
+ lstrcpy(prst->content, name);
+ lstrcat(prst->content, title);
num++;
}
prst->next = NULL;
diff --git a/plugins/GmailNotifier/src/gmail.h b/plugins/GmailNotifier/src/gmail.h
index 67e5eeda85..fa9cd4dbdd 100644
--- a/plugins/GmailNotifier/src/gmail.h
+++ b/plugins/GmailNotifier/src/gmail.h
@@ -28,10 +28,10 @@
#define IDI_TRAY WM_USER+6
#define pluginName "GmailMNotifier"
#define _MAX_DOWN_BUFFER 65536
-#define LINK "https://www.google.com/accounts/ServiceLoginAuth?continue=https%3A%2F%2Fmail.google.com%2Fmail&service=mail&Email="
-#define FORMDATA1 "<body onload=document.gmail.submit();><form name=gmail action=https://www.google.com/a/"
-#define FORMDATA2 "/LoginAction method=POST><input type=hidden name=continue value=https://mail.google.com/a/"
-#define FORMDATA3 "><INPUT type=hidden value=mail name=service>"
+#define LINK _T("https://www.google.com/accounts/ServiceLoginAuth?continue=https%3A%2F%2Fmail.google.com%2Fmail&service=mail&Email=")
+#define FORMDATA1 _T("<body onload=document.gmail.submit();><form name=gmail action=https://www.google.com/a/")
+#define FORMDATA2 _T("/LoginAction method=POST><input type=hidden name=continue value=https://mail.google.com/a/")
+#define FORMDATA3 _T("><INPUT type=hidden value=mail name=service>")
// #define STR1 "javascript:document.write('<form name=gmail action=https://www.google.com/a/"
// #define STR2 "/LoginAction method=post><input type=hidden name=continue value=https://mail.google.com/hosted/"
// #define STR3 "><input type=hidden value=mail name=service><input type=hidden name=userName value="
@@ -40,14 +40,14 @@
//#define LINK2 "https://www.google.com/a/altmanoptik.com/LoginAction?continue=https%3A%2F%2Fmail.google.com%2Fhosted%2Faltmanoptik.com&service=mail&userName=test&password=123456"
typedef struct s_resultLink{
- char content[64];
+ TCHAR content[64];
struct s_resultLink *next;
}resultLink;
typedef struct s_Account{
- char name[64];
- char pass[64];
- char hosted[64];
+ TCHAR name[64];
+ TCHAR pass[64];
+ TCHAR hosted[64];
MCONTACT hContact;
int oldResults_num;
int results_num;
@@ -81,14 +81,14 @@ extern BOOL optionWindowIsOpen;
INT_PTR Notifying(WPARAM, LPARAM);
INT_PTR PluginMenuCommand(WPARAM, LPARAM);
void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD);
-BOOL GetBrowser(char *);
+BOOL GetBrowser(TCHAR *);
void CheckMailInbox(Account *);
void NotifyUser(Account *);
int OptInit(WPARAM, LPARAM);
void Check_ThreadFunc(void *);
void Login_ThreadFunc(void *);
int OpenBrowser(WPARAM , LPARAM);
-int ParsePage(char *, resultLink *);
+int ParsePage(TCHAR *, resultLink *);
void DeleteResults(resultLink *);
void BuildList(void);
diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp
index a684e5ff0c..66d72ac266 100644
--- a/plugins/GmailNotifier/src/notify.cpp
+++ b/plugins/GmailNotifier/src/notify.cpp
@@ -55,7 +55,7 @@ void NotifyUser(Account *curAcc)
if (optionWindowIsOpen)
return;
- db_set_s(curAcc->hContact, "CList", "MyHandle", curAcc->results.content);
+ db_set_ts(curAcc->hContact, "CList", "MyHandle", curAcc->results.content);
switch (curAcc->results_num) {
case 0:
PUDeletePopup(curAcc->popUpHwnd);
@@ -80,7 +80,7 @@ void NotifyUser(Account *curAcc)
resultLink *prst = curAcc->results.next;
for (int i = 0; i < newMails; i++) {
- dbei.cbBlob = lstrlenA(prst->content) + 1;
+ dbei.cbBlob = lstrlen(prst->content) + 1;
dbei.pBlob = (PBYTE)prst->content;
db_event_add(curAcc->hContact, &dbei);
prst = prst->next;
@@ -90,24 +90,24 @@ void NotifyUser(Account *curAcc)
CLISTEVENT cle = { sizeof(cle) };
cle.hContact = curAcc->hContact;
cle.hDbEvent = (HANDLE)1;
- cle.flags = CLEF_URGENT;
+ cle.flags = CLEF_URGENT | CLEF_TCHAR;
cle.hIcon = LoadSkinnedProtoIcon(pluginName, ID_STATUS_OCCUPIED);
cle.pszService = "GmailMNotifier/Notifying";
- cle.pszTooltip = curAcc->results.next->content;
+ cle.ptszTooltip = curAcc->results.next->content;
CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)curAcc->hContact, (LPARAM)1);
CallServiceSync(MS_CLIST_ADDEVENT, (WPARAM)curAcc->hContact, (LPARAM)& cle);
}
if (opt.notifierOnPop&&newMails > 0) {
- POPUPDATA ppd = { 0 };
+ POPUPDATAT ppd = { 0 };
ppd.lchContact = curAcc->hContact;
ppd.lchIcon = LoadSkinnedProtoIcon(pluginName, ID_STATUS_OCCUPIED);
- lstrcpyA(ppd.lpzContactName, curAcc->results.content);
+ lstrcpy(ppd.lptzContactName, curAcc->results.content);
resultLink *prst = curAcc->results.next;
for (int i = 0; i < 5 && i < newMails; i++) {
- strcat(ppd.lpzText, prst->content);
- strcat(ppd.lpzText, "\n");
+ _tcscat(ppd.lptzText, prst->content);
+ _tcscat(ppd.lptzText, _T("\n"));
prst = prst->next;
}
ppd.colorBack = opt.popupBgColor;
@@ -116,7 +116,7 @@ void NotifyUser(Account *curAcc)
ppd.PluginData = NULL;
ppd.iSeconds = opt.popupDuration;
PUDeletePopup(curAcc->popUpHwnd);
- PUAddPopup(&ppd);
+ PUAddPopupT(&ppd);
}
if (newMails > 0)
SkinPlaySound("Gmail");
@@ -142,65 +142,65 @@ void __cdecl Login_ThreadFunc(void *lpParam)
HANDLE hTempFile;
DWORD dwBytesWritten, dwBufSize = 1024;
- char szTempName[MAX_PATH];
- char buffer[1024];
- char *str_temp;
- char lpPathBuffer[1024];
+ TCHAR szTempName[MAX_PATH];
+ TCHAR buffer[1024];
+ TCHAR *str_temp;
+ TCHAR lpPathBuffer[1024];
Account *curAcc = (Account *)lpParam;
if (GetBrowser(lpPathBuffer)) {
if (opt.AutoLogin == 0) {
if (curAcc->hosted[0]) {
- lstrcatA(lpPathBuffer, "https://mail.google.com/a/");
- lstrcatA(lpPathBuffer, curAcc->hosted);
- lstrcatA(lpPathBuffer, "/?logout");
+ lstrcat(lpPathBuffer, _T("https://mail.google.com/a/"));
+ lstrcat(lpPathBuffer, curAcc->hosted);
+ lstrcat(lpPathBuffer, _T("/?logout"));
}
else {
- lstrcatA(lpPathBuffer, "https://mail.google.com/mail/?logout");
+ lstrcat(lpPathBuffer, _T("https://mail.google.com/mail/?logout"));
}
}
else {
if (curAcc->hosted[0]) {
- GetTempPathA(dwBufSize, buffer);
- GetTempFileNameA(buffer, "gmail", 0, szTempName);
-
- hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- lstrcpyA(buffer, FORMDATA1);
- lstrcatA(buffer, curAcc->hosted);
- lstrcatA(buffer, FORMDATA2);
- lstrcatA(buffer, curAcc->hosted);
- lstrcatA(buffer, FORMDATA3);
- lstrcatA(buffer, "<input type=hidden name=userName value=");
- lstrcatA(buffer, curAcc->name);
- if ((str_temp = strstr(buffer, "@")) != NULL)
+ GetTempPath(dwBufSize, buffer);
+ GetTempFileName(buffer, _T("gmail"), 0, szTempName);
+
+ hTempFile = CreateFile(szTempName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ lstrcpy(buffer, FORMDATA1);
+ lstrcat(buffer, curAcc->hosted);
+ lstrcat(buffer, FORMDATA2);
+ lstrcat(buffer, curAcc->hosted);
+ lstrcat(buffer, FORMDATA3);
+ lstrcat(buffer, _T("<input type=hidden name=userName value="));
+ lstrcat(buffer, curAcc->name);
+ if ((str_temp = _tcsstr(buffer, _T("@"))) != NULL)
*str_temp = '\0';
- lstrcatA(buffer, "><input type=hidden name=password value=");
- lstrcatA(buffer, curAcc->pass);
- lstrcatA(buffer, "></form></body>");
- WriteFile(hTempFile, buffer, lstrlenA(buffer), &dwBytesWritten, NULL);
+ lstrcat(buffer, _T("><input type=hidden name=password value="));
+ lstrcat(buffer, curAcc->pass);
+ lstrcat(buffer, _T("></form></body>"));
+ WriteFile(hTempFile, buffer, lstrlen(buffer), &dwBytesWritten, NULL);
CloseHandle(hTempFile);
- lstrcatA(lpPathBuffer, szTempName);
+ lstrcat(lpPathBuffer, szTempName);
}
else {
- lstrcatA(lpPathBuffer, LINK);
- lstrcatA(lpPathBuffer, mir_urlEncode(curAcc->name));
- lstrcatA(lpPathBuffer, "&Passwd=");
- lstrcatA(lpPathBuffer, mir_urlEncode(curAcc->pass));
+ lstrcat(lpPathBuffer, LINK);
+ lstrcat(lpPathBuffer, _A2T(mir_urlEncode(_T2A(curAcc->name))));
+ lstrcat(lpPathBuffer, _T("&Passwd="));
+ lstrcat(lpPathBuffer, _A2T(mir_urlEncode(_T2A(curAcc->pass))));
if (opt.AutoLogin == 1)
- lstrcatA(lpPathBuffer, "&PersistentCookie=yes");
+ lstrcat(lpPathBuffer, _T("&PersistentCookie=yes"));
}
}
}
- STARTUPINFOA suInfo = { 0 };
+ STARTUPINFO suInfo = { 0 };
PROCESS_INFORMATION procInfo;
suInfo.cb = sizeof(suInfo);
suInfo.wShowWindow = SW_MAXIMIZE;
- if (CreateProcessA(NULL, lpPathBuffer, NULL, NULL, FALSE, 0, NULL, NULL, &suInfo, &procInfo))
+ if (CreateProcess(NULL, lpPathBuffer, NULL, NULL, FALSE, 0, NULL, NULL, &suInfo, &procInfo))
CloseHandle(procInfo.hProcess);
if (curAcc->hosted[0]) {
Sleep(30000);
- DeleteFileA(szTempName);
+ DeleteFile(szTempName);
}
}
diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp
index 3783efb176..5ba800dab7 100644
--- a/plugins/GmailNotifier/src/options.cpp
+++ b/plugins/GmailNotifier/src/options.cpp
@@ -24,7 +24,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
{
int ShowControl;
char str[MAX_PATH] = { 0 };
- char *tail;
+ TCHAR *tail;
static int curIndex = 0;
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_NAME);
@@ -55,7 +55,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SendMessageA(hwndCombo, CB_ADDSTRING, 0, (LONG)acc[i].name);
SendMessage(hwndCombo, CB_SETCURSEL, curIndex, 0);
if (curIndex < acc_num)
- SetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass);
+ SetDlgItemText(hwndDlg, IDC_PASS, acc[curIndex].pass);
SetDlgItemInt(hwndDlg, IDC_CIRCLE, opt.circleTime, FALSE);
if (opt.notifierOnTray)
@@ -152,10 +152,10 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case IDC_BTNADD:
acc_num++;
acc = (Account *)realloc(acc, acc_num * sizeof(Account));
- curIndex = SendMessageA(hwndCombo, CB_ADDSTRING, 0, (LONG)"");
+ curIndex = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LONG)"");
memset(&acc[curIndex], 0, sizeof(Account));
SendMessage(hwndCombo, CB_SETCURSEL, curIndex, 0);
- SetDlgItemTextA(hwndDlg, IDC_PASS, "");
+ SetDlgItemText(hwndDlg, IDC_PASS, _T(""));
SetFocus(hwndCombo);
acc[curIndex].hContact = CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)acc[curIndex].hContact, (LPARAM)pluginName);
@@ -163,17 +163,17 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
break;
case IDC_BTNSAV:
- if (GetDlgItemTextA(hwndDlg, IDC_NAME, acc[curIndex].name, 64)) {
- tail = strstr(acc[curIndex].name, "@");
- if (tail && lstrcmpA(tail + 1, "gmail.com") != 0)
- lstrcpyA(acc[curIndex].hosted, tail + 1);
- SendMessageA(hwndCombo, CB_DELETESTRING, curIndex, 0);
- SendMessageA(hwndCombo, CB_INSERTSTRING, curIndex, (LONG_PTR)acc[curIndex].name);
- SendMessageA(hwndCombo, CB_SETCURSEL, curIndex, 0);
- db_set_s(acc[curIndex].hContact, pluginName, "name", acc[curIndex].name);
- db_set_s(acc[curIndex].hContact, pluginName, "Nick", acc[curIndex].name);
- GetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass, 64);
- db_set_s(acc[curIndex].hContact, pluginName, "Password", acc[curIndex].pass);
+ if (GetDlgItemText(hwndDlg, IDC_NAME, acc[curIndex].name, 64)) {
+ tail = _tcsstr(acc[curIndex].name, _T("@"));
+ if (tail && lstrcmp(tail + 1, _T("gmail.com")) != 0)
+ lstrcpy(acc[curIndex].hosted, tail + 1);
+ SendMessage(hwndCombo, CB_DELETESTRING, curIndex, 0);
+ SendMessage(hwndCombo, CB_INSERTSTRING, curIndex, (LONG_PTR)acc[curIndex].name);
+ SendMessage(hwndCombo, CB_SETCURSEL, curIndex, 0);
+ db_set_ts(acc[curIndex].hContact, pluginName, "name", acc[curIndex].name);
+ db_set_ts(acc[curIndex].hContact, pluginName, "Nick", acc[curIndex].name);
+ GetDlgItemText(hwndDlg, IDC_PASS, acc[curIndex].pass, 64);
+ db_set_ts(acc[curIndex].hContact, pluginName, "Password", acc[curIndex].pass);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
@@ -188,14 +188,14 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
acc[i] = acc[i + 1];
curIndex = 0;
SendMessage(hwndCombo, CB_SETCURSEL, 0, 0);
- SetDlgItemTextA(hwndDlg, IDC_PASS, acc[0].pass);
+ SetDlgItemText(hwndDlg, IDC_PASS, acc[0].pass);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_NAME:
if (HIWORD(wParam) == CBN_SELCHANGE) {
curIndex = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
- SetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass);
+ SetDlgItemText(hwndDlg, IDC_PASS, acc[curIndex].pass);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
diff --git a/plugins/GmailNotifier/src/utility.cpp b/plugins/GmailNotifier/src/utility.cpp
index 9363f27f60..b39a9508a5 100644
--- a/plugins/GmailNotifier/src/utility.cpp
+++ b/plugins/GmailNotifier/src/utility.cpp
@@ -6,58 +6,58 @@ void BuildList(void)
acc_num = 0;
for (MCONTACT hContact = db_find_first(pluginName); hContact; hContact = db_find_next(hContact, pluginName)) {
- if (!db_get_s(hContact, pluginName, "name", &dbv)) {
+ if (!db_get_ts(hContact, pluginName, "name", &dbv)) {
acc_num++;
acc = (Account *)realloc(acc, acc_num * sizeof(Account));
memset(&acc[acc_num-1], 0, sizeof(Account));
acc[acc_num-1].hContact = hContact;
- lstrcpyA(acc[acc_num-1].name, dbv.pszVal);
+ lstrcpy(acc[acc_num-1].name, dbv.ptszVal);
CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
db_free(&dbv);
- if (!db_get_s(hContact, pluginName, "Password", &dbv)) {
- lstrcpyA(acc[acc_num-1].pass, dbv.pszVal);
+ if (!db_get_ts(hContact, pluginName, "Password", &dbv)) {
+ lstrcpy(acc[acc_num-1].pass, dbv.ptszVal);
db_free(&dbv);
}
}
}
for (int i = 0; i < acc_num; i++) {
- char *tail = strchr(acc[i].name, '@');
- if (tail && lstrcmpA(tail + 1, "gmail.com") != 0)
- lstrcpyA(acc[i].hosted, tail + 1);
+ TCHAR *tail = _tcschr(acc[i].name, '@');
+ if (tail && lstrcmp(tail + 1, _T("gmail.com")) != 0)
+ lstrcpy(acc[i].hosted, tail + 1);
acc[i].IsChecking = FALSE;
}
}
-BOOL GetBrowser(char *str)
+BOOL GetBrowser(TCHAR *str)
{
HKEY hKey = NULL;
- char *strKey;
- char strIE[] = "Applications\\iexplore.exe\\shell\\open\\command";
- char strDefault[] = "https\\shell\\open\\command";
+ TCHAR *strKey;
+ TCHAR strIE[] = _T("Applications\\iexplore.exe\\shell\\open\\command");
+ TCHAR strDefault[] = _T("https\\shell\\open\\command");
DBVARIANT dbv;
if (opt.OpenUsePrg == 1)
strKey = strIE;
else if (opt.OpenUsePrg == 0)
strKey = strDefault;
- else if (!db_get_s(NULL, pluginName, "OpenUsePrgPath", &dbv)) {
- lstrcpyA(str, dbv.pszVal);
+ else if (!db_get_ts(NULL, pluginName, "OpenUsePrgPath", &dbv)) {
+ lstrcpy(str, dbv.ptszVal);
db_free(&dbv);
return FALSE;
}
// Open the registry
- if (RegOpenKeyExA(HKEY_CLASSES_ROOT, strKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
+ if (RegOpenKeyEx(HKEY_CLASSES_ROOT, strKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
// Data size
DWORD cbData = 0;
// Get the default value
- if (RegQueryValueExA(hKey, NULL, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS && cbData > 0) {
- if (RegQueryValueExA(hKey, NULL, NULL, NULL, (LPBYTE)str, &cbData) == ERROR_SUCCESS) {
- if ((strKey = strstr(str, "%1")) != NULL)
+ if (RegQueryValueEx(hKey, NULL, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS && cbData > 0) {
+ if (RegQueryValueEx(hKey, NULL, NULL, NULL, (LPBYTE)str, &cbData) == ERROR_SUCCESS) {
+ if ((strKey = _tcsstr(str, _T("%1"))) != NULL)
*(strKey--) = '\0';
- if ((strKey = strstr(str, "-")) != NULL)
+ if ((strKey = _tcsstr(str, _T("-"))) != NULL)
*(strKey--) = '\0';
RegCloseKey(hKey);
return TRUE;