summaryrefslogtreecommitdiff
path: root/plugins/Nudge
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-05 22:27:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-05 22:27:16 +0000
commit007b4c7301f0d26a72f89f74e9929f42e24eb3e6 (patch)
treeb1ee30b70c6e36d1a06aed6885cb80dc560a68ca /plugins/Nudge
parentf4a1bbc6ba4b8137cb868639ac146aa97e97e9df (diff)
- rest of menus cleared;
- old database macroses wiped out from all plugins (left in m_database.h for compatibility) git-svn-id: http://svn.miranda-ng.org/main/trunk@4324 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Nudge')
-rw-r--r--plugins/Nudge/src/main.cpp12
-rw-r--r--plugins/Nudge/src/nudge.cpp69
-rw-r--r--plugins/Nudge/src/nudge.h3
-rw-r--r--plugins/Nudge/src/shake.cpp8
4 files changed, 42 insertions, 50 deletions
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp
index d94994b68a..73caaf1db3 100644
--- a/plugins/Nudge/src/main.cpp
+++ b/plugins/Nudge/src/main.cpp
@@ -31,8 +31,10 @@ PLUGININFOEX pluginInfo={
INT_PTR NudgeShowMenu(WPARAM wParam,LPARAM lParam)
{
for(NudgeElementList *n = NudgeList;n != NULL; n = n->next)
- if (!strcmp((char *) wParam,n->item.ProtocolName))
- return n->item.ShowContactMenu(lParam != 0);
+ if (!strcmp((char *) wParam,n->item.ProtocolName)) {
+ Menu_ShowItem(n->item.hContactMenu, lParam != 0);
+ break;
+ }
return 0;
}
@@ -40,7 +42,7 @@ INT_PTR NudgeShowMenu(WPARAM wParam,LPARAM lParam)
INT_PTR NudgeSend(WPARAM wParam,LPARAM lParam)
{
char *protoName = GetContactProto((HANDLE)wParam);
- int diff = time(NULL) - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastSent", time(NULL)-30);
+ int diff = time(NULL) - db_get_dw((HANDLE) wParam, "Nudge", "LastSent", time(NULL)-30);
if(diff < GlobalNudge.sendTimeSec)
{
@@ -85,8 +87,8 @@ int NudgeReceived(WPARAM wParam,LPARAM lParam)
DWORD currentTimestamp = time(NULL);
DWORD nudgeSentTimestamp = lParam ? (DWORD)lParam : currentTimestamp;
- int diff = currentTimestamp - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp-30);
- int diff2 = nudgeSentTimestamp - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived2", nudgeSentTimestamp-30);
+ int diff = currentTimestamp - db_get_dw((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp-30);
+ int diff2 = nudgeSentTimestamp - db_get_dw((HANDLE) wParam, "Nudge", "LastReceived2", nudgeSentTimestamp-30);
if(diff >= GlobalNudge.recvTimeSec)
db_set_dw((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp);
diff --git a/plugins/Nudge/src/nudge.cpp b/plugins/Nudge/src/nudge.cpp
index 51b6af9824..5c83b6cfe9 100644
--- a/plugins/Nudge/src/nudge.cpp
+++ b/plugins/Nudge/src/nudge.cpp
@@ -4,7 +4,7 @@ void CNudge::Save(void)
{
char SectionName[512];
mir_snprintf(SectionName,512,"useByProtocol");
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->useByProtocol);
+ db_set_b(NULL, "Nudge", SectionName, this->useByProtocol);
mir_snprintf(SectionName,512,"RecvTimeSec");
db_set_dw(NULL, "Nudge", SectionName, this->recvTimeSec);
mir_snprintf(SectionName,512,"SendTimeSec");
@@ -18,51 +18,42 @@ void CNudge::Load(void)
{
char SectionName[512];
mir_snprintf(SectionName,512,"useByProtocol");
- this->useByProtocol = DBGetContactSettingByte(NULL, "Nudge", SectionName, FALSE) != 0;
+ this->useByProtocol = db_get_b(NULL, "Nudge", SectionName, FALSE) != 0;
mir_snprintf(SectionName,512,"RecvTimeSec");
- this->recvTimeSec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 30);
+ this->recvTimeSec = db_get_dw(NULL, "Nudge", SectionName, 30);
mir_snprintf(SectionName,512,"SendTimeSec");
- this->sendTimeSec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 30);
+ this->sendTimeSec = db_get_dw(NULL, "Nudge", SectionName, 30);
mir_snprintf(SectionName,512,"ResendDelaySec");
- this->resendDelaySec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 3);
-}
-
-int CNudgeElement::ShowContactMenu(bool show)
-{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = show? CMIM_FLAGS : CMIM_FLAGS | CMIF_HIDDEN ;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi);
-
- return 0;
+ this->resendDelaySec = db_get_dw(NULL, "Nudge", SectionName, 3);
}
void CNudgeElement::Save(void)
{
char SectionName[512];
mir_snprintf(SectionName,512,"%s-openMessageWindow", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->openMessageWindow);
+ db_set_b(NULL, "Nudge", SectionName, this->openMessageWindow);
mir_snprintf(SectionName,512,"%s-openContactList", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->openContactList);
+ db_set_b(NULL, "Nudge", SectionName, this->openContactList);
mir_snprintf(SectionName,512,"%s-useIgnore", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->useIgnoreSettings);
+ db_set_b(NULL, "Nudge", SectionName, this->useIgnoreSettings);
mir_snprintf(SectionName,512,"%s-showStatus", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->showStatus);
+ db_set_b(NULL, "Nudge", SectionName, this->showStatus);
mir_snprintf(SectionName,512,"%s-showPopup", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->showPopup);
+ db_set_b(NULL, "Nudge", SectionName, this->showPopup);
mir_snprintf(SectionName,512,"%s-shakeClist", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->shakeClist);
+ db_set_b(NULL, "Nudge", SectionName, this->shakeClist);
mir_snprintf(SectionName,512,"%s-shakeChat", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->shakeChat);
+ db_set_b(NULL, "Nudge", SectionName, this->shakeChat);
mir_snprintf(SectionName,512,"%s-enabled", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->enabled);
+ db_set_b(NULL, "Nudge", SectionName, this->enabled);
mir_snprintf(SectionName,512,"%s-autoResend", ProtocolName);
- DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->autoResend);
+ db_set_b(NULL, "Nudge", SectionName, this->autoResend);
mir_snprintf(SectionName,512,"%s-statusFlags", ProtocolName);
db_set_dw(NULL, "Nudge", SectionName, this->statusFlags);
mir_snprintf(SectionName,512,"%s-recText", ProtocolName);
- DBWriteContactSettingTString(NULL, "Nudge", SectionName, this->recText);
+ db_set_ts(NULL, "Nudge", SectionName, this->recText);
mir_snprintf(SectionName,512,"%s-senText", ProtocolName);
- DBWriteContactSettingTString(NULL, "Nudge", SectionName, this->senText);
+ db_set_ts(NULL, "Nudge", SectionName, this->senText);
}
@@ -71,42 +62,42 @@ void CNudgeElement::Load(void)
DBVARIANT dbv;
char SectionName[512];
mir_snprintf(SectionName,512,"%s-openMessageWindow", ProtocolName);
- this->openMessageWindow = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->openMessageWindow = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-openContactList", ProtocolName);
- this->openContactList = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->openContactList = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-useIgnore", ProtocolName);
- this->useIgnoreSettings = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->useIgnoreSettings = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-showStatus", ProtocolName);
- this->showStatus = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->showStatus = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-showPopup", ProtocolName);
- this->showPopup = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->showPopup = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-shakeClist", ProtocolName);
- this->shakeClist = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->shakeClist = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-shakeChat", ProtocolName);
- this->shakeChat = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->shakeChat = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-enabled", ProtocolName);
- this->enabled = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0;
+ this->enabled = db_get_b(NULL, "Nudge", SectionName, TRUE) != 0;
mir_snprintf(SectionName,512,"%s-autoResend", ProtocolName);
- this->autoResend = DBGetContactSettingByte(NULL, "Nudge", SectionName, FALSE) != 0;
+ this->autoResend = db_get_b(NULL, "Nudge", SectionName, FALSE) != 0;
mir_snprintf(SectionName,512,"%s-statusFlags", ProtocolName);
- this->statusFlags = DBGetContactSettingDword(NULL, "Nudge", SectionName, 967);
+ this->statusFlags = db_get_dw(NULL, "Nudge", SectionName, 967);
mir_snprintf(SectionName,512,"%s-recText", ProtocolName);
- if (!DBGetContactSettingTString(NULL,"Nudge",SectionName,&dbv))
+ if (!db_get_ts(NULL,"Nudge",SectionName,&dbv))
{
_tcsncpy(this->recText,dbv.ptszVal,TEXT_LEN);
if(_tcsclen(this->recText) < 1)
_tcsncpy(this->recText,TranslateT("You received a nudge"),TEXT_LEN);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
_tcsncpy(this->recText,TranslateT("You received a nudge"),TEXT_LEN);
mir_snprintf(SectionName,512,"%s-senText", ProtocolName);
- if (!DBGetContactSettingTString(NULL,"Nudge",SectionName,&dbv))
+ if (!db_get_ts(NULL,"Nudge",SectionName,&dbv))
{
_tcsncpy(this->senText,dbv.ptszVal,TEXT_LEN);
if(_tcsclen(this->senText) < 1)
_tcsncpy(this->senText,TranslateT("You sent a nudge"),TEXT_LEN);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
_tcsncpy(this->senText,TranslateT("You sent a nudge"),TEXT_LEN);
diff --git a/plugins/Nudge/src/nudge.h b/plugins/Nudge/src/nudge.h
index 8a531639ca..8a6c39e5d5 100644
--- a/plugins/Nudge/src/nudge.h
+++ b/plugins/Nudge/src/nudge.h
@@ -51,11 +51,10 @@ public:
int iProtoNumber;
HANDLE hIcoLibItem;
HANDLE hEvent;
- HANDLE hContactMenu;
+ HGENMENU hContactMenu;
void Load(void);
void Save(void);
- int ShowContactMenu(bool show);
};
typedef struct NudgeElementList
diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp
index 7976d8fe88..f1a4c4a46e 100644
--- a/plugins/Nudge/src/shake.cpp
+++ b/plugins/Nudge/src/shake.cpp
@@ -5,10 +5,10 @@ void CShake::Load(void)
Shaking = false;
ShakingChat = false;
- nScaleClist = DBGetContactSettingDword(NULL, "Nudge", "ScaleClist", 5);
- nScaleChat = DBGetContactSettingDword(NULL, "Nudge", "ScaleChat", 2);
- nMoveClist = DBGetContactSettingDword(NULL, "Nudge", "MoveClist", 15);
- nMoveChat = DBGetContactSettingDword(NULL, "Nudge", "MoveChat", 15);
+ nScaleClist = db_get_dw(NULL, "Nudge", "ScaleClist", 5);
+ nScaleChat = db_get_dw(NULL, "Nudge", "ScaleChat", 2);
+ nMoveClist = db_get_dw(NULL, "Nudge", "MoveClist", 15);
+ nMoveChat = db_get_dw(NULL, "Nudge", "MoveChat", 15);
}
void CShake::Save(void)
{