summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-07 19:47:13 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-07 19:47:13 +0000
commit097c52ad9a2928422084bf76cebee58958341574 (patch)
tree26d6b11e9738fc4e854f68c0ff04eaadf7d849e8 /plugins/Scriver/src
parentf096b29abb03618ec609ba4acaedaed43eec1fea (diff)
end of the old database macroses
git-svn-id: http://svn.miranda-ng.org/main/trunk@4373 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver/src')
-rw-r--r--plugins/Scriver/src/infobar.cpp120
-rw-r--r--plugins/Scriver/src/msgwindow.cpp81
2 files changed, 102 insertions, 99 deletions
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp
index 9ffe857006..106b547f21 100644
--- a/plugins/Scriver/src/infobar.cpp
+++ b/plugins/Scriver/src/infobar.cpp
@@ -58,36 +58,38 @@ void SetupInfobar(InfobarWindowData* idat) {
RefreshInfobar(idat);
}
-static HICON GetExtraStatusIcon(InfobarWindowData* idat) {
- BYTE bXStatus = db_get_b(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusId", 0);
- if (bXStatus > 0) {
- return (HICON) CallProtoService(idat->mwd->szProto, "/GetXStatusIcon", bXStatus, 0);
- }
- return NULL;
+static HICON GetExtraStatusIcon(InfobarWindowData* idat)
+{
+ BYTE bXStatus = db_get_b(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusId", 0);
+ if (bXStatus > 0) {
+ return (HICON) CallProtoService(idat->mwd->szProto, "/GetXStatusIcon", bXStatus, 0);
+ }
+ return NULL;
}
-void RefreshInfobar(InfobarWindowData* idat) {
+void RefreshInfobar(InfobarWindowData* idat)
+{
HWND hwnd = idat->hWnd;
struct SrmmWindowData *dat = idat->mwd;
- TCHAR *szContactName = GetNickname(dat->windowData.hContact, dat->szProto);
- TCHAR *szContactStatusMsg = DBGetStringT(dat->windowData.hContact, "CList", "StatusMsg");
- TCHAR *szXStatusName = DBGetStringT(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusName");
- TCHAR *szXStatusMsg = DBGetStringT(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusMsg");
- HICON hIcon = GetExtraStatusIcon(idat);
+ TCHAR *szContactName = GetNickname(dat->windowData.hContact, dat->szProto);
+ TCHAR *szContactStatusMsg = db_get_tsa(dat->windowData.hContact, "CList", "StatusMsg");
+ TCHAR *szXStatusName = db_get_tsa(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusName");
+ TCHAR *szXStatusMsg = db_get_tsa(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusMsg");
+ HICON hIcon = GetExtraStatusIcon(idat);
TCHAR szText[2048];
SETTEXTEX st;
if ( szXStatusMsg && *szXStatusMsg )
mir_sntprintf(szText, 2047, _T("%s (%s)"), TranslateTS(szXStatusName), szXStatusMsg);
else
mir_sntprintf(szText, 2047, _T("%s"), TranslateTS(szXStatusName));
- st.flags = ST_DEFAULT;
+ st.flags = ST_DEFAULT;
st.codepage = 1200;
SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactName);
- SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactStatusMsg);
- hIcon = (HICON)SendDlgItemMessage(hwnd, IDC_XSTATUSICON, STM_SETICON, (WPARAM)hIcon, 0);
- if (hIcon) {
- DestroyIcon(hIcon);
- }
+ SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactStatusMsg);
+ hIcon = (HICON)SendDlgItemMessage(hwnd, IDC_XSTATUSICON, STM_SETICON, (WPARAM)hIcon, 0);
+ if (hIcon) {
+ DestroyIcon(hIcon);
+ }
SetToolTipText(hwnd, idat->hXStatusTip, szText, NULL);
SendMessage(hwnd, WM_SIZE, 0, 0);
InvalidateRect(hwnd, NULL, TRUE);
@@ -159,59 +161,59 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
return TRUE;
}
case WM_CTLCOLORDLG:
- case WM_CTLCOLORSTATIC:
+ case WM_CTLCOLORSTATIC:
return (INT_PTR)g_dat.hInfobarBrush;
-
+
case WM_DROPFILES:
SendMessage(GetParent(hwnd), WM_DROPFILES, wParam, lParam);
return FALSE;
-
+
case WM_NOTIFY:
- {
- LPNMHDR pNmhdr = (LPNMHDR)lParam;
- switch (pNmhdr->idFrom) {
- case IDC_INFOBAR_NAME:
- case IDC_INFOBAR_STATUS:
- switch (pNmhdr->code) {
- case EN_MSGFILTER:
- switch (((MSGFILTER *) lParam)->msg) {
- case WM_CHAR:
- SendMessage(GetParent(hwnd), ((MSGFILTER *) lParam)->msg, ((MSGFILTER *) lParam)->wParam, ((MSGFILTER *) lParam)->lParam);
- SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
- return TRUE;
- case WM_LBUTTONUP:
- {
- CHARRANGE sel;
- SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
- bWasCopy = FALSE;
- if (sel.cpMin != sel.cpMax) {
- SendDlgItemMessage(hwnd, pNmhdr->idFrom, WM_COPY, 0, 0);
- sel.cpMin = sel.cpMax ;
- SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXSETSEL, 0, (LPARAM)& sel);
- bWasCopy = TRUE;
- }
- SetFocus(GetParent(hwnd));
- }
- }
- break;
- case EN_LINK:
- switch (((ENLINK *) lParam)->msg) {
- case WM_RBUTTONDOWN:
- case WM_LBUTTONUP:
- if (!bWasCopy) {
- if (HandleLinkClick(g_hInst, hwnd, GetDlgItem(GetParent(hwnd), IDC_MESSAGE),(ENLINK*)lParam)) {
- SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
- return TRUE;
+ {
+ LPNMHDR pNmhdr = (LPNMHDR)lParam;
+ switch (pNmhdr->idFrom) {
+ case IDC_INFOBAR_NAME:
+ case IDC_INFOBAR_STATUS:
+ switch (pNmhdr->code) {
+ case EN_MSGFILTER:
+ switch (((MSGFILTER *) lParam)->msg) {
+ case WM_CHAR:
+ SendMessage(GetParent(hwnd), ((MSGFILTER *) lParam)->msg, ((MSGFILTER *) lParam)->wParam, ((MSGFILTER *) lParam)->lParam);
+ SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ case WM_LBUTTONUP:
+ {
+ CHARRANGE sel;
+ SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
+ bWasCopy = FALSE;
+ if (sel.cpMin != sel.cpMax) {
+ SendDlgItemMessage(hwnd, pNmhdr->idFrom, WM_COPY, 0, 0);
+ sel.cpMin = sel.cpMax ;
+ SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXSETSEL, 0, (LPARAM)& sel);
+ bWasCopy = TRUE;
+ }
+ SetFocus(GetParent(hwnd));
}
}
- bWasCopy = FALSE;
break;
+ case EN_LINK:
+ switch (((ENLINK *) lParam)->msg) {
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONUP:
+ if (!bWasCopy) {
+ if (HandleLinkClick(g_hInst, hwnd, GetDlgItem(GetParent(hwnd), IDC_MESSAGE),(ENLINK*)lParam)) {
+ SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+ }
+ bWasCopy = FALSE;
+ break;
+ }
}
+ break;
}
break;
}
- break;
- }
case WM_DRAWITEM:
{
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp
index f8108668b6..7cf14db289 100644
--- a/plugins/Scriver/src/msgwindow.cpp
+++ b/plugins/Scriver/src/msgwindow.cpp
@@ -50,10 +50,10 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto)
{
int isTemplate;
int i, j, len;
- TCHAR* tokens[4] = {0};
- int tokenLen[4] = {0};
+ TCHAR* tokens[4] = {0};
+ int tokenLen[4] = {0};
TCHAR *p, *tmplt, *title;
- char *accModule;
+ char *accModule;
TCHAR *pszNewTitleEnd = mir_tstrdup(TranslateT("Message Session"));
isTemplate = 0;
if (hContact && szProto) {
@@ -62,7 +62,7 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto)
tokens[1] = mir_tstrdup((TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto ?
db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : ID_STATUS_OFFLINE, GSMDF_TCHAR));
tokenLen[1] = lstrlen(tokens[1]);
- tokens[2] = DBGetStringT(hContact, "CList", "StatusMsg");
+ tokens[2] = db_get_tsa(hContact, "CList", "StatusMsg");
if (tokens[2] != NULL) {
tokenLen[2] = (int)lstrlen(tokens[2]);
for (i = j = 0; i < tokenLen[2]; i++) {
@@ -78,15 +78,15 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto)
tokenLen[2] = j;
}
- accModule = (char *) CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM) hContact, 0);
- if (accModule != NULL) {
- PROTOACCOUNT* proto = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)accModule);
- if (proto != NULL) {
- tokens[3] = mir_tstrdup(proto->tszAccountName);
- tokenLen[3] = lstrlen(tokens[3]);
- }
- }
- tmplt = DBGetStringT(NULL, SRMMMOD, SRMSGSET_WINDOWTITLE);
+ accModule = (char *) CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM) hContact, 0);
+ if (accModule != NULL) {
+ PROTOACCOUNT* proto = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)accModule);
+ if (proto != NULL) {
+ tokens[3] = mir_tstrdup(proto->tszAccountName);
+ tokenLen[3] = lstrlen(tokens[3]);
+ }
+ }
+ tmplt = db_get_tsa(NULL, SRMMMOD, SRMSGSET_WINDOWTITLE);
if (tmplt != NULL) {
isTemplate = 1;
} else {
@@ -101,14 +101,14 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto)
}
for (len = 0, p = tmplt; *p; p++, len++) {
if (*p == '%') {
- for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
- int tnlen = (int)_tcslen(titleTokenNames[i]);
- if (!_tcsncmp(p, titleTokenNames[i], tnlen)) {
- len += tokenLen[i] - 1;
- p += tnlen - 1;
- break;
- }
- }
+ for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
+ int tnlen = (int)_tcslen(titleTokenNames[i]);
+ if (!_tcsncmp(p, titleTokenNames[i], tnlen)) {
+ len += tokenLen[i] - 1;
+ p += tnlen - 1;
+ break;
+ }
+ }
}
}
if (!isTemplate) {
@@ -117,17 +117,17 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto)
title = (TCHAR *)mir_alloc(sizeof(TCHAR) * (len + 1));
for (len = 0, p = tmplt; *p; p++) {
if (*p == '%') {
- for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
- int tnlen = lstrlen(titleTokenNames[i]);
- if (!_tcsncmp(p, titleTokenNames[i], tnlen)) {
- if (tokens[i] != NULL) {
- memcpy(title+len, tokens[i], sizeof(TCHAR) * tokenLen[i]);
- len += tokenLen[i];
- }
- p += tnlen - 1;
- break;
- }
- }
+ for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
+ int tnlen = lstrlen(titleTokenNames[i]);
+ if (!_tcsncmp(p, titleTokenNames[i], tnlen)) {
+ if (tokens[i] != NULL) {
+ memcpy(title+len, tokens[i], sizeof(TCHAR) * tokenLen[i]);
+ len += tokenLen[i];
+ }
+ p += tnlen - 1;
+ break;
+ }
+ }
if (i < SIZEOF(titleTokenNames)) continue;
}
title[len++] = *p;
@@ -140,22 +140,23 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto)
if (isTemplate) {
mir_free(tmplt);
}
- for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
- mir_free(tokens[i]);
- }
+ for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
+ mir_free(tokens[i]);
+ }
mir_free(pszNewTitleEnd);
return title;
}
TCHAR* GetTabName(HANDLE *hContact)
{
- if (hContact) {
+ if (hContact)
return GetNickname(hContact, NULL);
- }
+
return NULL;
}
-static int GetChildCount(ParentWindowData *dat) {
+static int GetChildCount(ParentWindowData *dat)
+{
return TabCtrl_GetItemCount(dat->hwndTabs);
}
@@ -166,9 +167,9 @@ static void GetChildWindowRect(ParentWindowData *dat, RECT *rcChild)
GetClientRect(dat->hwndTabs, &rcTabs);
TabCtrl_AdjustRect(dat->hwndTabs, FALSE, &rcTabs);
rcStatus.top = rcStatus.bottom = 0;
- if (dat->flags2 & SMF2_SHOWSTATUSBAR) {
+ if (dat->flags2 & SMF2_SHOWSTATUSBAR)
GetWindowRect(dat->hwndStatus, &rcStatus);
- }
+
rcChild->left = 0;
rcChild->right = rc.right;
if (dat->flags2 & SMF2_TABSATBOTTOM) {