summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-26 22:28:47 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-26 22:28:47 +0000
commit7f47efb0c5973054e00fac918d2e1cdd187dd35a (patch)
treefa7adcd9166e58cd2ae2a15a2e744a5ea6b1b0b5
parentc8ae2a45d384650fb562b078a06f024dc85caae8 (diff)
virtual protos, invisible in the Account Manager & status bar, but fortunately searchable
git-svn-id: http://svn.miranda-ng.org/main/trunk@2515 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Clist_nicer/src/cluiservices.cpp29
-rw-r--r--plugins/Clist_nicer/src/statusbar.cpp63
-rw-r--r--src/modules/clist/clistmenus.cpp13
-rw-r--r--src/modules/findadd/findadd.cpp8
-rw-r--r--src/modules/protocols/protocols.cpp2
-rw-r--r--src/modules/protocols/protoopts.cpp23
6 files changed, 69 insertions, 69 deletions
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp
index 2d8c2e0db8..df7296080f 100644
--- a/plugins/Clist_nicer/src/cluiservices.cpp
+++ b/plugins/Clist_nicer/src/cluiservices.cpp
@@ -45,18 +45,16 @@ static INT_PTR GetClistVersion(WPARAM wParam, LPARAM lParam)
void FreeProtocolData( void )
{
//free protocol data
- int nPanel;
- int nParts=SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0);
- for (nPanel=0;nPanel<nParts;nPanel++)
- {
- ProtocolData *PD;
- PD=(ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0);
- if (PD!=NULL&&!IsBadCodePtr((FARPROC)PD))
- {
+ int nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0);
+ for (int nPanel=0; nPanel < nParts; nPanel++) {
+ ProtocolData *PD = (ProtocolData *)SendMessage(pcli->hwndStatus, SB_GETTEXT, nPanel, 0);
+ if (PD != NULL && !IsBadCodePtr((FARPROC)PD)) {
SendMessage(pcli->hwndStatus,SB_SETTEXT,(WPARAM)nPanel|SBT_OWNERDRAW,0);
if (PD->RealName) mir_free(PD->RealName);
if (PD) mir_free(PD);
-} } }
+ }
+ }
+}
int g_maxStatus = ID_STATUS_OFFLINE;
char g_maxProto[100] = "";
@@ -173,20 +171,16 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto )
SendMessage(pcli->hwndStatus, SB_SETPARTS, partCount, (LPARAM)partWidths);
for ( partCount=0, i=0; i < protoCount; i++ ) { //count down since built in ones tend to go at the end
- ProtocolData *PD;
- PROTOACCOUNT *pa;
- int caps1, caps2;
-
int idx = pcli->pfnGetAccountIndexByPos( i );
if ( idx == -1 )
continue;
- pa = accs[idx];
+ PROTOACCOUNT *pa = accs[idx];
if ( !pcli->pfnGetProtocolVisibility( pa->szModuleName ))
continue;
status = CallProtoService( pa->szModuleName,PS_GETSTATUS,0,0);
- PD = ( ProtocolData* )mir_alloc(sizeof(ProtocolData));
+ ProtocolData *PD = ( ProtocolData* )mir_alloc(sizeof(ProtocolData));
PD->RealName = mir_strdup( pa->szModuleName );
PD->statusbarpos = partCount;
{
@@ -196,8 +190,8 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto )
flags |= SBT_NOBORDERS;
SendMessageA( pcli->hwndStatus, SB_SETTEXTA, partCount|flags,(LPARAM)PD );
}
- caps2 = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
- caps1 = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ int caps2 = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
+ int caps1 = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if ((caps1 & PF1_IM) && (caps2 & (PF2_LONGAWAY | PF2_SHORTAWAY))) {
onlineness = GetStatusOnlineness(status);
if (onlineness > maxOnline) {
@@ -262,5 +256,4 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto )
}
SFL_Update(hIcon, iIcon, hCListImages, szStatus, TRUE);
}
- return;
}
diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp
index ae6b847bef..936f1f0b92 100644
--- a/plugins/Clist_nicer/src/statusbar.cpp
+++ b/plugins/Clist_nicer/src/statusbar.cpp
@@ -42,33 +42,35 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
{
switch(msg) {
case WM_SETCURSOR:
- {
- POINT pt;
-
- GetCursorPos(&pt);
- SendMessage(GetParent(hwnd),msg,wParam,lParam);
- if (pt.x == ptMouse.x && pt.y == ptMouse.y)
- return 1;//return(TestCursorOnBorders());
-
- ptMouse = pt;
- if (tooltip_active){
- KillTimer(hwnd, TIMERID_HOVER);
- if ( !NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0))
- CallService("mToolTip/HideTip", 0, 0);
- tooltip_active = FALSE;
+ {
+ POINT pt;
+ GetCursorPos(&pt);
+
+ SendMessage(GetParent(hwnd),msg,wParam,lParam);
+ if (pt.x == ptMouse.x && pt.y == ptMouse.y)
+ return 1;//return(TestCursorOnBorders());
+
+ ptMouse = pt;
+ if (tooltip_active){
+ KillTimer(hwnd, TIMERID_HOVER);
+ if ( !NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0))
+ CallService("mToolTip/HideTip", 0, 0);
+ tooltip_active = FALSE;
}
- KillTimer(hwnd, TIMERID_HOVER);
- SetTimer(hwnd, TIMERID_HOVER, 750, 0);
+ KillTimer(hwnd, TIMERID_HOVER);
+ SetTimer(hwnd, TIMERID_HOVER, 750, 0);
+ }
break;
- }
+
case WM_NCHITTEST:
- {
- LRESULT lr = SendMessage(GetParent(hwnd), WM_NCHITTEST, wParam, lParam);
- if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT
- || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
- return HTTRANSPARENT;
+ {
+ LRESULT lr = SendMessage(GetParent(hwnd), WM_NCHITTEST, wParam, lParam);
+ if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT
+ || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
+ return HTTRANSPARENT;
+ }
break;
- }
+
case WM_ERASEBKGND:
if (cfg::dat.bSkinnedStatusBar)
return 1;
@@ -146,9 +148,6 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
}
break;
- case WM_DESTROY:
- break;
-
case WM_TIMER:
if (wParam == TIMERID_HOVER) {
POINT pt;
@@ -156,17 +155,13 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
GetCursorPos(&pt);
if (pt.x == ptMouse.x && pt.y == ptMouse.y) {
- int i,nParts;
- RECT rc;
-
ScreenToClient(hwnd, &pt);
- nParts = SendMessage(hwnd, SB_GETPARTS, 0, 0);
- for (i = 0; i < nParts; i++) {
+ int nParts = SendMessage(hwnd, SB_GETPARTS, 0, 0);
+ for (int i = 0; i < nParts; i++) {
+ RECT rc;
SendMessage(hwnd, SB_GETRECT, i, (LPARAM)&rc);
if (PtInRect(&rc,pt)) {
- ProtocolData *PD;
- PD = (ProtocolData *)SendMessageA(hwnd, SB_GETTEXTA, i, 0);
-
+ ProtocolData *PD = (ProtocolData *)SendMessageA(hwnd, SB_GETTEXTA, i, 0);
if (PD) {
if (NotifyEventHooks(hStatusBarShowToolTipEvent, (WPARAM)PD->RealName, 0) > 0) // a plugin handled this event
tooltip_active = TRUE;
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp
index 01db784728..2ef22dbd70 100644
--- a/src/modules/clist/clistmenus.cpp
+++ b/src/modules/clist/clistmenus.cpp
@@ -795,12 +795,17 @@ static INT_PTR SetStatusMode(WPARAM wParam, LPARAM)
return 0;
}
-int fnGetProtocolVisibility(const char* accName)
+int fnGetProtocolVisibility(const char *accName)
{
if (accName) {
- PROTOACCOUNT* pa = Proto_GetAccount(accName);
- return pa && pa->bIsVisible && Proto_IsAccountEnabled(pa) &&
- pa->ppro && (pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0));
+ PROTOACCOUNT *pa = Proto_GetAccount(accName);
+ if (pa && pa->bIsVisible && Proto_IsAccountEnabled(pa) && pa->ppro) {
+ PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(pa->szProtoName);
+ if (pd == NULL || pd->type != PROTOTYPE_PROTOCOL)
+ return FALSE;
+
+ return (pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0));
+ }
}
return FALSE;
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp
index 4bf76abf68..d6be80d7ca 100644
--- a/src/modules/findadd/findadd.cpp
+++ b/src/modules/findadd/findadd.cpp
@@ -349,7 +349,9 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
int i, index = 0, cbwidth = 0, netProtoCount = 0;
for (i=0; i < accounts.getCount(); i++) {
- if ( !Proto_IsAccountEnabled(accounts[i])) continue;
+ if ( !Proto_IsAccountEnabled(accounts[i]))
+ continue;
+
DWORD caps = (DWORD)CallProtoServiceInt(NULL,accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (caps & PF1_BASICSEARCH || caps & PF1_EXTSEARCH || caps & PF1_SEARCHBYEMAIL || caps & PF1_SEARCHBYNAME)
netProtoCount++;
@@ -375,7 +377,9 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
for (i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if ( !Proto_IsAccountEnabled(pa)) continue;
+ if ( !Proto_IsAccountEnabled(pa))
+ continue;
+
DWORD caps = (DWORD)CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if ( !(caps&PF1_BASICSEARCH) && !(caps&PF1_EXTSEARCH) && !(caps&PF1_SEARCHBYEMAIL) && !(caps&PF1_SEARCHBYNAME))
continue;
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index a39e62899a..7589693e3b 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -122,7 +122,7 @@ static INT_PTR Proto_RegisterModule(WPARAM, LPARAM lParam)
memset(p, 0, sizeof(PROTOCOLDESCRIPTOR));
p->cbSize = PROTOCOLDESCRIPTOR_V3_SIZE;
p->type = pd->type;
- if (p->type == PROTOTYPE_PROTOCOL) {
+ if (p->type == PROTOTYPE_PROTOCOL || p->type == PROTOTYPE_VIRTUAL) {
// let's create a new container
PROTO_INTERFACE* ppi = AddDefaultAccount(pd->szName);
if (ppi) {
diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp
index 9aa7436b4d..31f3302252 100644
--- a/src/modules/protocols/protoopts.cpp
+++ b/src/modules/protocols/protoopts.cpp
@@ -481,13 +481,8 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
EnableWindow( GetDlgItem(hwndDlg, IDC_REMOVE), FALSE);
EnableWindow( GetDlgItem(hwndDlg, IDC_OPTIONS), FALSE);
EnableWindow( GetDlgItem(hwndDlg, IDC_UPGRADE), FALSE);
-
{
LOGFONT lf;
- HDC hdc;
- HFONT hfnt;
- TEXTMETRIC tm;
-
GetObject((HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0), sizeof(lf), &lf);
dat->hfntText = CreateFontIndirect(&lf);
@@ -495,11 +490,14 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
lf.lfWeight = FW_BOLD;
dat->hfntTitle = CreateFontIndirect(&lf);
- hdc = GetDC(hwndDlg);
- hfnt = (HFONT)SelectObject(hdc, dat->hfntTitle);
+ HDC hdc = GetDC(hwndDlg);
+ HFONT hfnt = (HFONT)SelectObject(hdc, dat->hfntTitle);
+
+ TEXTMETRIC tm;
GetTextMetrics(hdc, &tm);
dat->titleHeight = tm.tmHeight;
SelectObject(hdc, dat->hfntText);
+
GetTextMetrics(hdc, &tm);
dat->textHeight = tm.tmHeight;
SelectObject(hdc, hfnt);
@@ -660,10 +658,15 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
dat->iSelected = -1;
SendMessage(hList, LB_RESETCONTENT, 0, 0);
for (i=0; i < accounts.getCount(); i++) {
- int iItem = SendMessage(hList, LB_ADDSTRING, 0, (LPARAM)accounts[i]->tszAccountName);
- SendMessage(hList, LB_SETITEMDATA, iItem, (LPARAM)accounts[i]);
+ PROTOACCOUNT *p = accounts[i];
+ PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(p->szProtoName);
+ if (pd == NULL || pd->type != PROTOTYPE_PROTOCOL)
+ continue;
+
+ int iItem = SendMessage(hList, LB_ADDSTRING, 0, (LPARAM)p->tszAccountName);
+ SendMessage(hList, LB_SETITEMDATA, iItem, (LPARAM)p);
- if (accounts[i] == acc)
+ if (p == acc)
ListBox_SetCurSel(hList, iItem);
}