diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-14 18:24:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-14 18:24:56 +0300 |
commit | 68d6271552d4b9bdb27efda50c457f0d56b23457 (patch) | |
tree | 0221f56a8545815514eb3350afe92a2d0262251b /protocols/ICQCorp | |
parent | 64e3214c2222543350f51b517a6b75b6b02b81cf (diff) |
other minor code cleaning considering g_plugin
Diffstat (limited to 'protocols/ICQCorp')
-rw-r--r-- | protocols/ICQCorp/src/options.cpp | 14 | ||||
-rw-r--r-- | protocols/ICQCorp/src/protocol.cpp | 28 | ||||
-rw-r--r-- | protocols/ICQCorp/src/user.cpp | 26 |
3 files changed, 35 insertions, 33 deletions
diff --git a/protocols/ICQCorp/src/options.cpp b/protocols/ICQCorp/src/options.cpp index fb0fd8af76..79c9fda410 100644 --- a/protocols/ICQCorp/src/options.cpp +++ b/protocols/ICQCorp/src/options.cpp @@ -29,12 +29,12 @@ static INT_PTR CALLBACK icqOptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hWnd);
- SetDlgItemInt(hWnd, IDC_OPT_UIN, db_get_dw(0, protoName, "UIN", 0), FALSE);
- if (!db_get_s(0, protoName, "Password", &dbv)) {
+ SetDlgItemInt(hWnd, IDC_OPT_UIN, g_plugin.getDword("UIN"), FALSE);
+ if (!g_plugin.getString("Password", &dbv)) {
SetDlgItemTextA(hWnd, IDC_OPT_PASSWORD, dbv.pszVal);
db_free(&dbv);
}
- if (!db_get_s(0, protoName, "Server", &dbv)) {
+ if (!g_plugin.getString("Server", &dbv)) {
SetDlgItemTextA(hWnd, IDC_OPT_SERVER, dbv.pszVal);
db_free(&dbv);
}
@@ -45,12 +45,12 @@ static INT_PTR CALLBACK icqOptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_dw(0, protoName, "UIN", (DWORD)GetDlgItemInt(hWnd, IDC_OPT_UIN, nullptr, FALSE));
+ g_plugin.setDword("UIN", (DWORD)GetDlgItemInt(hWnd, IDC_OPT_UIN, nullptr, FALSE));
GetDlgItemTextA(hWnd, IDC_OPT_PASSWORD, str, sizeof(str));
- db_set_s(0, protoName, "Password", str);
+ g_plugin.setString("Password", str);
GetDlgItemTextA(hWnd, IDC_OPT_SERVER, str, sizeof(str));
- db_set_s(0, protoName, "Server", str);
- db_set_w(0, protoName, "Port", (WORD)GetDlgItemInt(hWnd, IDC_OPT_PORT, nullptr, FALSE));
+ g_plugin.setString("Server", str);
+ g_plugin.setWord("Port", (WORD)GetDlgItemInt(hWnd, IDC_OPT_PORT, nullptr, FALSE));
return TRUE;
}
break;
diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index b1e1f02d20..cfc2675148 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -195,7 +195,7 @@ bool ICQ::logon(unsigned short logonStatus) DBVARIANT dbv;
char str[128];
- if (!db_get_s(0, protoName, "Server", &dbv)) {
+ if (!g_plugin.getString("Server", &dbv)) {
lstrcpyA(str, dbv.pszVal);
db_free(&dbv);
}
@@ -218,8 +218,8 @@ bool ICQ::logon(unsigned short logonStatus) updateContactList();
- dwUIN = db_get_dw(0, protoName, "UIN", 0);
- if (!db_get_s(0, protoName, "Password", &dbv)) {
+ dwUIN = g_plugin.getDword("UIN", 0);
+ if (!g_plugin.getString("Password", &dbv)) {
lstrcpyA(str, dbv.pszVal);
db_free(&dbv);
}
@@ -602,7 +602,8 @@ unsigned short ICQ::processUdpPacket(Packet &packet) break;
}
- if (e->reply == 0) ProtoBroadcastAck(protoName, u->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, nullptr, 0);
+ if (e->reply == 0)
+ ProtoBroadcastAck(protoName, u->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, nullptr, 0);
doneEvent(true, udpSocket.handleVal, theSequence1);
delete[] buffer;
break;
@@ -763,7 +764,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet) >> timedataStamp
>> newCommand;
- db_set_dw(0, protoName, "LastBroadcastTime", timedataStamp);
+ g_plugin.setDword("LastBroadcastTime", timedataStamp);
timedataStamp = TimeZone_ToLocal(timedataStamp);
processSystemMessage(packet, checkUin, newCommand, timedataStamp);
@@ -1061,7 +1062,7 @@ void ICQ::requestSystemMsg() void ICQ::requestBroadcastMsg()
{
- unsigned int timeStamp = db_get_dw(0, protoName, "LastBroadcastTime", 0);
+ unsigned int timeStamp = g_plugin.getDword("LastBroadcastTime", 0);
Packet packet;
packet << ICQ_VERSION
@@ -1116,13 +1117,13 @@ void ICQ::updateContactList() if ((u = getUserByContact(hContact)) == nullptr) {
u = new ICQUser();
u->hContact = hContact;
- u->dwUIN = db_get_dw(hContact, protoName, "UIN", 0);
+ u->dwUIN = g_plugin.getDword(hContact, "UIN", 0);
icqUsers.push_back(u);
}
if (statusVal <= ID_STATUS_OFFLINE)
u->setStatus(ID_STATUS_OFFLINE);
else
- u->statusVal = db_get_w(hContact, protoName, "Status", ID_STATUS_OFFLINE);
+ u->statusVal = g_plugin.getWord(hContact, "Status", ID_STATUS_OFFLINE);
}
}
@@ -1133,7 +1134,8 @@ void ICQ::updateContactList() Packet userPacket;
for (i = 0; i < icqUsers.size();) {
userCount = (unsigned int)icqUsers.size() - i;
- if (userCount > 100) userCount = 100;
+ if (userCount > 100)
+ userCount = 100;
userPacket.clearPacket();
userPacket << ICQ_VERSION
@@ -1173,7 +1175,7 @@ void ICQ::sendVisibleList() for (i=0; i<icqUsers.size(); i++)
{
u = icqUsers[i];
- if (u->statusVal != ID_STATUS_OFFLINE && db_get_w(u->hContact, protoName, "ApparentMode", 0) == ID_STATUS_ONLINE)
+ if (u->statusVal != ID_STATUS_OFFLINE && g_plugin.getWord(u->hContact, "ApparentMode") == ID_STATUS_ONLINE)
numUsers++;
}
@@ -1183,7 +1185,7 @@ void ICQ::sendVisibleList() for (i=0; i<icqUsers.size(); i++)
{
u = icqUsers[i];
- if (u->statusVal != ID_STATUS_OFFLINE && db_get_w(u->hContact, protoName, "ApparentMode", 0) == ID_STATUS_ONLINE)
+ if (u->statusVal != ID_STATUS_OFFLINE && g_plugin.getWord(u->hContact, "ApparentMode") == ID_STATUS_ONLINE)
userPacket << icqUsers[i]->uin;
}
@@ -1209,7 +1211,7 @@ void ICQ::sendInvisibleList() for (i=0; i<icqUsers.size(); i++)
{
- if (db_get_w(icqUsers[i]->hContact, protoName, "ApparentMode", 0) == ID_STATUS_OFFLINE)
+ if (g_plugin.getWord(icqUsers[i]->hContact, "ApparentMode") == ID_STATUS_OFFLINE)
numUsers++;
}
@@ -1218,7 +1220,7 @@ void ICQ::sendInvisibleList() for (i=0; i<icqUsers.size(); i++)
{
- if (db_get_w(icqUsers[i]->hContact, protoName, "ApparentMode", 0) == ID_STATUS_OFFLINE)
+ if (g_plugin.getWord(icqUsers[i]->hContact, "ApparentMode") == ID_STATUS_OFFLINE)
userPacket << icqUsers[i]->uin;
}
diff --git a/protocols/ICQCorp/src/user.cpp b/protocols/ICQCorp/src/user.cpp index 1b83e518cf..382b5c5303 100644 --- a/protocols/ICQCorp/src/user.cpp +++ b/protocols/ICQCorp/src/user.cpp @@ -36,7 +36,7 @@ void ICQUser::setStatus(unsigned short newStatus) return;
statusVal = newStatus;
- db_set_w(hContact, protoName, "Status", newStatus);
+ g_plugin.setWord(hContact, "Status", newStatus);
}
///////////////////////////////////////////////////////////////////////////////
@@ -44,9 +44,9 @@ void ICQUser::setStatus(unsigned short newStatus) void ICQUser::setInfo(char *name, unsigned int data)
{
if (data && data != 0xFFFFFFFF)
- db_set_dw(hContact, protoName, name, data);
+ g_plugin.setDword(hContact, name, data);
else
- db_unset(hContact, protoName, name);
+ g_plugin.delSetting(hContact, name);
}
///////////////////////////////////////////////////////////////////////////////
@@ -54,9 +54,9 @@ void ICQUser::setInfo(char *name, unsigned int data) void ICQUser::setInfo(char *name, unsigned short data)
{
if (data && data != 0xFFFF)
- db_set_w(hContact, protoName, name, data);
+ g_plugin.setWord(hContact, name, data);
else
- db_unset(hContact, protoName, name);
+ g_plugin.delSetting(hContact, name);
}
///////////////////////////////////////////////////////////////////////////////
@@ -64,9 +64,9 @@ void ICQUser::setInfo(char *name, unsigned short data) void ICQUser::setInfo(char *name, unsigned char data)
{
if (data && data != 0xFF)
- db_set_b(hContact, protoName, name, data);
+ g_plugin.setByte(hContact, name, data);
else
- db_unset(hContact, protoName, name);
+ g_plugin.delSetting(hContact, name);
}
///////////////////////////////////////////////////////////////////////////////
@@ -74,9 +74,9 @@ void ICQUser::setInfo(char *name, unsigned char data) void ICQUser::setInfo(char *name, char *data)
{
if (data[0])
- db_set_s(hContact, protoName, name, data);
+ g_plugin.setString(hContact, name, data);
else
- db_unset(hContact, protoName, name);
+ g_plugin.delSetting(hContact, name);
}
///////////////////////////////////////////////////////////////////////////////
@@ -116,16 +116,16 @@ static INT_PTR CALLBACK icqUserInfoDlgProc(HWND hWnd, UINT msg, WPARAM wParam, L unsigned long ip, port;
MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
- _itow(db_get_dw(hContact, protoName, "UIN", 0), buffer, 10);
+ _itow(g_plugin.getDword(hContact, "UIN", 0), buffer, 10);
setTextValue(hWnd, IDC_INFO_UIN, buffer);
- ip = db_get_dw(hContact, protoName, "IP", 0);
+ ip = g_plugin.getDword(hContact, "IP", 0);
setTextValue(hWnd, IDC_INFO_IP, ip ? _A2T(iptoa(ip)) : nullptr);
- ip = db_get_dw(hContact, protoName, "RealIP", 0);
+ ip = g_plugin.getDword(hContact, "RealIP", 0);
setTextValue(hWnd, IDC_INFO_REALIP, ip ? _A2T(iptoa(ip)) : nullptr);
- port = db_get_w(hContact, protoName, "Port", 0);
+ port = g_plugin.getWord(hContact, "Port", 0);
_itow(port, buffer, 10);
setTextValue(hWnd, IDC_INFO_PORT, port ? buffer : nullptr);
|