diff options
Diffstat (limited to 'protocols/Tlen/src')
-rw-r--r-- | protocols/Tlen/src/jabber.h | 16 | ||||
-rw-r--r-- | protocols/Tlen/src/jabber_iqid.cpp | 110 | ||||
-rw-r--r-- | protocols/Tlen/src/jabber_misc.cpp | 30 | ||||
-rw-r--r-- | protocols/Tlen/src/jabber_opt.cpp | 214 | ||||
-rw-r--r-- | protocols/Tlen/src/jabber_svc.cpp | 110 | ||||
-rw-r--r-- | protocols/Tlen/src/jabber_thread.cpp | 64 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen.cpp | 83 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_avatar.cpp | 14 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_muc.cpp | 36 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_p2p_old.cpp | 20 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_picture.cpp | 4 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_presence.cpp | 28 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_userinfo.cpp | 42 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_voice.cpp | 26 |
14 files changed, 385 insertions, 412 deletions
diff --git a/protocols/Tlen/src/jabber.h b/protocols/Tlen/src/jabber.h index 954e3b4069..2b3899cc3a 100644 --- a/protocols/Tlen/src/jabber.h +++ b/protocols/Tlen/src/jabber.h @@ -283,14 +283,14 @@ struct TlenProtocol : public PROTO_INTERFACE struct ThreadDataStruct *threadData;
HANDLE hTlenNudge;
- HANDLE hMenuMUC;
- HANDLE hMenuChats;
- HANDLE hMenuInbox;
- HANDLE hMenuContactMUC;
- HANDLE hMenuContactVoice;
- HANDLE hMenuContactGrantAuth;
- HANDLE hMenuContactRequestAuth;
- HANDLE hMenuPicture;
+ HGENMENU hMenuMUC;
+ HGENMENU hMenuChats;
+ HGENMENU hMenuInbox;
+ HGENMENU hMenuContactMUC;
+ HGENMENU hMenuContactVoice;
+ HGENMENU hMenuContactGrantAuth;
+ HGENMENU hMenuContactRequestAuth;
+ HGENMENU hMenuPicture;
HANDLE* hServices;
unsigned serviceNum;
diff --git a/protocols/Tlen/src/jabber_iqid.cpp b/protocols/Tlen/src/jabber_iqid.cpp index 3cf0e0f2ae..ef5a6844dc 100644 --- a/protocols/Tlen/src/jabber_iqid.cpp +++ b/protocols/Tlen/src/jabber_iqid.cpp @@ -38,10 +38,10 @@ void JabberIqResultAuth(TlenProtocol *proto, XmlNode *iqNode) if (!strcmp(type, "result")) {
DBVARIANT dbv;
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "Nick", &dbv))
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "Nick", proto->threadData->username);
+ if (db_get(NULL, proto->m_szModuleName, "Nick", &dbv))
+ db_set_s(NULL, proto->m_szModuleName, "Nick", proto->threadData->username);
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
// iqId = JabberSerialNext();
// JabberIqAdd(iqId, IQ_PROC_NONE, JabberIqResultGetRoster);
// JabberSend(info, "<iq type='get' id='"JABBER_IQID"%d'><query xmlns='jabber:iq:roster'/></iq>", iqId);
@@ -77,8 +77,8 @@ void JabberResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { str = JabberXmlGetAttrValue(itemNode, "subscription");
if (!strcmp(str, "remove")) {
if ((hContact=JabberHContactFromJID(proto, jid)) != NULL) {
- if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ db_set_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
JabberListRemove(proto, LIST_ROSTER, jid);
} else {
@@ -103,21 +103,21 @@ void JabberResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { // Add the jid (with empty resource) to Miranda contact list.
hContact = JabberDBCreateContact(proto, jid, nick, FALSE);
}
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
if ((groupNode=JabberXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
JabberContactListCreateGroup(item->group);
// Don't set group again if already correct, or Miranda may show wrong group count in some case
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
+ if (!db_get(hContact, "CList", "Group", &dbv)) {
if (strcmp(dbv.pszVal, item->group))
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, "CList", "Group", item->group);
+ db_free(&dbv);
} else
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
+ db_set_s(hContact, "CList", "Group", item->group);
} else {
item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
}
}
@@ -175,37 +175,37 @@ void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) // Add the jid (with empty resource) to Miranda contact list.
hContact = JabberDBCreateContact(proto, jid, nick, FALSE);
}
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
if ((groupNode=JabberXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
JabberContactListCreateGroup(item->group);
// Don't set group again if already correct, or Miranda may show wrong group count in some case
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
+ if (!db_get(hContact, "CList", "Group", &dbv)) {
if (strcmp(dbv.pszVal, item->group))
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, "CList", "Group", item->group);
+ db_free(&dbv);
}
else
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
+ db_set_s(hContact, "CList", "Group", item->group);
}
else {
item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "AvatarHash", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "AvatarHash", &dbv)) {
if (item->avatarHash) mir_free(item->avatarHash);
item->avatarHash = mir_strdup(dbv.pszVal);
JabberLog(proto, "Setting hash [%s] = %s", nick, item->avatarHash);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- item->avatarFormat = DBGetContactSettingDword(hContact, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
+ item->avatarFormat = db_get_dw(hContact, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
}
}
}
}
// Delete orphaned contacts (if roster sync is enabled)
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "RosterSync", FALSE) == TRUE) {
+ if (db_get_b(NULL, proto->m_szModuleName, "RosterSync", FALSE) == TRUE) {
HANDLE *list;
int listSize, listAllocSize;
@@ -215,7 +215,7 @@ void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) while (hContact != NULL) {
str = GetContactProto(hContact);
if (str != NULL && !strcmp(str, proto->m_szModuleName)) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
if (!JabberListExist(proto, LIST_ROSTER, dbv.pszVal)) {
JabberLog(proto, "Syncing roster: preparing to delete %s (hContact=0x%x)", dbv.pszVal, hContact);
if (listSize >= listAllocSize) {
@@ -227,7 +227,7 @@ void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) }
list[listSize++] = hContact;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
hContact = db_find_next(hContact);
@@ -279,20 +279,20 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if ((queryNode=JabberXmlGetChild(iqNode, "query")) == NULL) return;
if ((itemNode=JabberXmlGetChild(queryNode, "item")) == NULL) return;
if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) return;
+ if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) return;
if (strchr(jid, '@') != NULL) {
sprintf(text, "%s", jid);
} else {
sprintf(text, "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if ((hContact=JabberHContactFromJID(proto, text)) == NULL) {
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv)) return;
+ if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) return;
if (strcmp(dbv.pszVal, jid)) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
} else {
hContact = NULL;
@@ -305,7 +305,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if (n->text != NULL) {
hasFirst = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "FirstName", nText);
+ db_set_s(hContact, proto->m_szModuleName, "FirstName", nText);
mir_free(nText);
}
}
@@ -313,7 +313,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if (n->text != NULL) {
hasLast = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "LastName", nText);
+ db_set_s(hContact, proto->m_szModuleName, "LastName", nText);
mir_free(nText);
}
}
@@ -321,7 +321,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if (n->text != NULL) {
hasNick = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "Nick", nText);
+ db_set_s(hContact, proto->m_szModuleName, "Nick", nText);
mir_free(nText);
}
}
@@ -329,7 +329,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if (n->text != NULL) {
hasEmail = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "e-mail", nText);
+ db_set_s(hContact, proto->m_szModuleName, "e-mail", nText);
mir_free(nText);
}
}
@@ -337,7 +337,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if (n->text != NULL) {
hasCity = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "City", nText);
+ db_set_s(hContact, proto->m_szModuleName, "City", nText);
mir_free(nText);
}
}
@@ -346,20 +346,20 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) WORD nAge;
hasAge = TRUE;
nAge = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Age", nAge);
+ db_set_w(hContact, proto->m_szModuleName, "Age", nAge);
}
}
else if (!strcmp(n->name, "s")) {
if (n->text != NULL && n->text[1] == '\0' && (n->text[0] == '1' || n->text[0] == '2')) {
hasGender = TRUE;
- DBWriteContactSettingByte(hContact, proto->m_szModuleName, "Gender", (BYTE) (n->text[0] == '1'?'M':'F'));
+ db_set_b(hContact, proto->m_szModuleName, "Gender", (BYTE) (n->text[0] == '1'?'M':'F'));
}
}
else if (!strcmp(n->name, "e")) {
if (n->text != NULL) {
hasSchool = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "School", nText);
+ db_set_s(hContact, proto->m_szModuleName, "School", nText);
mir_free(nText);
}
}
@@ -368,7 +368,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) WORD nOccupation;
hasOccupation = TRUE;
nOccupation = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Occupation", nOccupation);
+ db_set_w(hContact, proto->m_szModuleName, "Occupation", nOccupation);
}
}
else if (!strcmp(n->name, "r")) {
@@ -376,45 +376,45 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) WORD nLookFor;
hasLookFor = TRUE;
nLookFor = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "LookingFor", nLookFor);
+ db_set_w(hContact, proto->m_szModuleName, "LookingFor", nLookFor);
}
}
else if (!strcmp(n->name, "g")) { // voice chat enabled
if (n->text != NULL) {
BYTE bVoice;
bVoice = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "VoiceChat", bVoice);
+ db_set_w(hContact, proto->m_szModuleName, "VoiceChat", bVoice);
}
}
else if (!strcmp(n->name, "v")) { // status visibility
if (n->text != NULL) {
BYTE bPublic;
bPublic = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "PublicStatus", bPublic);
+ db_set_w(hContact, proto->m_szModuleName, "PublicStatus", bPublic);
}
}
}
if (!hasFirst)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "FirstName");
+ db_unset(hContact, proto->m_szModuleName, "FirstName");
if (!hasLast)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "LastName");
+ db_unset(hContact, proto->m_szModuleName, "LastName");
// We are not removing "Nick"
// if (!hasNick)
-// DBDeleteContactSetting(hContact, m_szModuleName, "Nick");
+// db_unset(hContact, m_szModuleName, "Nick");
if (!hasEmail)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "e-mail");
+ db_unset(hContact, proto->m_szModuleName, "e-mail");
if (!hasCity)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "City");
+ db_unset(hContact, proto->m_szModuleName, "City");
if (!hasAge)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Age");
+ db_unset(hContact, proto->m_szModuleName, "Age");
if (!hasGender)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Gender");
+ db_unset(hContact, proto->m_szModuleName, "Gender");
if (!hasSchool)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "School");
+ db_unset(hContact, proto->m_szModuleName, "School");
if (!hasOccupation)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Occupation");
+ db_unset(hContact, proto->m_szModuleName, "Occupation");
if (!hasLookFor)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "LookingFor");
+ db_unset(hContact, proto->m_szModuleName, "LookingFor");
ProtoBroadcastAck(proto->m_szModuleName, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
}
}
@@ -435,7 +435,7 @@ void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) if (!strcmp(type, "result")) {
if ((queryNode=JabberXmlGetChild(iqNode, "query")) == NULL) return;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
jsr.hdr.flags = PSR_TCHAR;
for (i=0; i<queryNode->numChild; i++) {
@@ -510,7 +510,7 @@ void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) mir_free(proto->searchJID);
proto->searchJID = NULL;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
found = 0;
if (queryNode->numChild == TLEN_MAX_SEARCH_RESULTS_PER_PAGE) {
@@ -604,9 +604,9 @@ void TlenIqResultVersion(TlenProtocol *proto, XmlNode *iqNode) item->system = NULL;
if (( hContact=JabberHContactFromJID(proto, item->jid )) != NULL ) {
if (item->software != NULL) {
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "MirVer", item->software);
+ db_set_s(hContact, proto->m_szModuleName, "MirVer", item->software);
} else {
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "MirVer");
+ db_unset(hContact, proto->m_szModuleName, "MirVer");
}
}
}
@@ -629,7 +629,7 @@ void TlenIqResultInfo(TlenProtocol *proto, XmlNode *iqNode) if (item->software == NULL) {
char str[128];
mir_snprintf(str, sizeof(str), "Tlen Protocol %s", item->protocolVersion);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "MirVer", str);
+ db_set_s(hContact, proto->m_szModuleName, "MirVer", str);
}
}
}
diff --git a/protocols/Tlen/src/jabber_misc.cpp b/protocols/Tlen/src/jabber_misc.cpp index fccf376f72..30ec49b67d 100644 --- a/protocols/Tlen/src/jabber_misc.cpp +++ b/protocols/Tlen/src/jabber_misc.cpp @@ -50,13 +50,13 @@ void JabberDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) // strip resource if present
s = JabberLoginFromJID(jid);
_strlwr(s);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "jid", s);
+ db_set_s(hContact, proto->m_szModuleName, "jid", s);
mir_free(s);
}
else {
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Hidden");
+ db_unset(hContact, proto->m_szModuleName, "Hidden");
}
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "Nick", nick);
+ db_set_s(hContact, proto->m_szModuleName, "Nick", nick);
JabberLog(proto, "auth request: %s, %s", jid, nick);
//blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
//blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ)
@@ -76,9 +76,9 @@ char *JabberJIDFromHContact(TlenProtocol *proto, HANDLE hContact) {
char *p = NULL;
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
p = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return p;
}
@@ -95,15 +95,15 @@ HANDLE JabberHContactFromJID(TlenProtocol *proto, const char *jid) while (hContact != NULL) {
szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(proto->m_szModuleName, szProto)) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
if ((p=dbv.pszVal) != NULL) {
if (!stricmp(p, jid)) { // exact match (node@domain/resource)
hContactMatched = hContact;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
hContact = db_find_next(hContact);
@@ -123,11 +123,11 @@ HANDLE JabberDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL te if ((hContact=JabberHContactFromJID(proto, jid)) == NULL) {
hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "jid", jid);
+ db_set_s(hContact, proto->m_szModuleName, "jid", jid);
if (nick != NULL && nick[0] != '\0')
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "Nick", nick);
+ db_set_s(hContact, proto->m_szModuleName, "Nick", nick);
if (temporary)
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
}
return hContact;
}
@@ -141,22 +141,22 @@ static void JabberContactListCreateClistGroup(char *groupName) for (i=0;;i++) {
itoa(i, str, 10);
- if (DBGetContactSetting(NULL, "CListGroups", str, &dbv))
+ if (db_get(NULL, "CListGroups", str, &dbv))
break;
name = dbv.pszVal;
if (name[0] != '\0' && !strcmp(name+1, groupName)) {
// Already exist, no need to create
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// Create new group with id = i (str is the text representation of i)
newName[0] = 1 | GROUPF_EXPANDED;
strncpy(newName+1, groupName, sizeof(newName)-1);
newName[sizeof(newName)-1] = '\0';
- DBWriteContactSettingString(NULL, "CListGroups", str, newName);
+ db_set_s(NULL, "CListGroups", str, newName);
CallService(MS_CLUI_GROUPADDED, i+1, 0);
}
diff --git a/protocols/Tlen/src/jabber_opt.cpp b/protocols/Tlen/src/jabber_opt.cpp index 594bbe0ade..fb0e68de1d 100644 --- a/protocols/Tlen/src/jabber_opt.cpp +++ b/protocols/Tlen/src/jabber_opt.cpp @@ -47,23 +47,23 @@ static TabDef tabPages[] = { void TlenLoadOptions(TlenProtocol *proto)
{
- proto->tlenOptions.savePassword = DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE);
- proto->tlenOptions.useEncryption = DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", TRUE);
- proto->tlenOptions.reconnect = DBGetContactSettingByte(NULL, proto->m_szModuleName, "Reconnect", TRUE);
- proto->tlenOptions.alertPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "AlertPolicy", TLEN_ALERTS_IGNORE_NIR);
- proto->tlenOptions.rosterSync = DBGetContactSettingByte(NULL, proto->m_szModuleName, "RosterSync", FALSE);
- proto->tlenOptions.offlineAsInvisible = DBGetContactSettingByte(NULL, proto->m_szModuleName, "OfflineAsInvisible", FALSE);
- proto->tlenOptions.leaveOfflineMessage = DBGetContactSettingByte(NULL, proto->m_szModuleName, "LeaveOfflineMessage", TRUE);
- proto->tlenOptions.offlineMessageOption = DBGetContactSettingWord(NULL, proto->m_szModuleName, "OfflineMessageOption", 0);
- proto->tlenOptions.ignoreAdvertisements = DBGetContactSettingByte(NULL, proto->m_szModuleName, "IgnoreAdvertisements", TRUE);
- proto->tlenOptions.groupChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "GroupChatPolicy", TLEN_MUC_ASK);
- proto->tlenOptions.voiceChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceChatPolicy", TLEN_MUC_ASK);
- proto->tlenOptions.imagePolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "ImagePolicy",TLEN_IMAGES_IGNORE_NIR);
- proto->tlenOptions.enableAvatars = DBGetContactSettingByte(NULL, proto->m_szModuleName, "EnableAvatars", TRUE);
- proto->tlenOptions.enableVersion = DBGetContactSettingByte(NULL, proto->m_szModuleName, "EnableVersion", TRUE);
- proto->tlenOptions.useNudge = DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseNudge", FALSE);
- proto->tlenOptions.logAlerts = DBGetContactSettingByte(NULL, proto->m_szModuleName, "LogAlerts", TRUE);
- proto->tlenOptions.sendKeepAlive = DBGetContactSettingByte(NULL, proto->m_szModuleName, "KeepAlive", TRUE);
+ proto->tlenOptions.savePassword = db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE);
+ proto->tlenOptions.useEncryption = db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE);
+ proto->tlenOptions.reconnect = db_get_b(NULL, proto->m_szModuleName, "Reconnect", TRUE);
+ proto->tlenOptions.alertPolicy = db_get_w(NULL, proto->m_szModuleName, "AlertPolicy", TLEN_ALERTS_IGNORE_NIR);
+ proto->tlenOptions.rosterSync = db_get_b(NULL, proto->m_szModuleName, "RosterSync", FALSE);
+ proto->tlenOptions.offlineAsInvisible = db_get_b(NULL, proto->m_szModuleName, "OfflineAsInvisible", FALSE);
+ proto->tlenOptions.leaveOfflineMessage = db_get_b(NULL, proto->m_szModuleName, "LeaveOfflineMessage", TRUE);
+ proto->tlenOptions.offlineMessageOption = db_get_w(NULL, proto->m_szModuleName, "OfflineMessageOption", 0);
+ proto->tlenOptions.ignoreAdvertisements = db_get_b(NULL, proto->m_szModuleName, "IgnoreAdvertisements", TRUE);
+ proto->tlenOptions.groupChatPolicy = db_get_w(NULL, proto->m_szModuleName, "GroupChatPolicy", TLEN_MUC_ASK);
+ proto->tlenOptions.voiceChatPolicy = db_get_w(NULL, proto->m_szModuleName, "VoiceChatPolicy", TLEN_MUC_ASK);
+ proto->tlenOptions.imagePolicy = db_get_w(NULL, proto->m_szModuleName, "ImagePolicy",TLEN_IMAGES_IGNORE_NIR);
+ proto->tlenOptions.enableAvatars = db_get_b(NULL, proto->m_szModuleName, "EnableAvatars", TRUE);
+ proto->tlenOptions.enableVersion = db_get_b(NULL, proto->m_szModuleName, "EnableVersion", TRUE);
+ proto->tlenOptions.useNudge = db_get_b(NULL, proto->m_szModuleName, "UseNudge", FALSE);
+ proto->tlenOptions.logAlerts = db_get_b(NULL, proto->m_szModuleName, "LogAlerts", TRUE);
+ proto->tlenOptions.sendKeepAlive = db_get_b(NULL, proto->m_szModuleName, "KeepAlive", TRUE);
proto->tlenOptions.useNewP2P = TRUE;
}
@@ -126,16 +126,16 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE));
+ CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE));
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), JabberValidateUsernameWndProc);
}
@@ -164,23 +164,23 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR DBVARIANT dbv;
GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "Password", text);
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "Password", text);
}
else
- DBDeleteContactSetting(NULL, proto->m_szModuleName, "Password");
+ db_unset(NULL, proto->m_szModuleName, "Password");
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
+ db_set_b(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
if (reconnectRequired && proto->isConnected)
MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
TlenLoadOptions(proto);
@@ -205,16 +205,16 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE));
+ CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE));
CheckDlgButton(hwndDlg, IDC_RECONNECT, proto->tlenOptions.reconnect);
CheckDlgButton(hwndDlg, IDC_ROSTER_SYNC, proto->tlenOptions.rosterSync);
@@ -304,36 +304,36 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara DBVARIANT dbv;
GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "Password", text);
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "Password", text);
}
else
- DBDeleteContactSetting(NULL, proto->m_szModuleName, "Password");
-
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "Reconnect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RECONNECT));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "RosterSync", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ROSTER_SYNC));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "OfflineAsInvisible", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOW_OFFLINE));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "IgnoreAdvertisements", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_IGNORE_ADVERTISEMENTS));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "LeaveOfflineMessage", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_OFFLINE_MESSAGE));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "OfflineMessageOption", (WORD) SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "AlertPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "GroupChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "ImagePolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "EnableAvatars", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARS));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "EnableVersion", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VERSIONINFO));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "UseNudge", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NUDGE_SUPPORT));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "LogAlerts", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LOG_ALERTS));
+ db_unset(NULL, proto->m_szModuleName, "Password");
+
+ db_set_b(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
+ db_set_b(NULL, proto->m_szModuleName, "Reconnect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RECONNECT));
+ db_set_b(NULL, proto->m_szModuleName, "RosterSync", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ROSTER_SYNC));
+ db_set_b(NULL, proto->m_szModuleName, "OfflineAsInvisible", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOW_OFFLINE));
+ db_set_b(NULL, proto->m_szModuleName, "IgnoreAdvertisements", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_IGNORE_ADVERTISEMENTS));
+ db_set_b(NULL, proto->m_szModuleName, "LeaveOfflineMessage", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_OFFLINE_MESSAGE));
+ db_set_w(NULL, proto->m_szModuleName, "OfflineMessageOption", (WORD) SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "AlertPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "GroupChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "ImagePolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, "EnableAvatars", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARS));
+ db_set_b(NULL, proto->m_szModuleName, "EnableVersion", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VERSIONINFO));
+ db_set_b(NULL, proto->m_szModuleName, "UseNudge", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NUDGE_SUPPORT));
+ db_set_b(NULL, proto->m_szModuleName, "LogAlerts", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LOG_ALERTS));
if (reconnectRequired && proto->isConnected)
MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
ApplyChanges(proto, 1);
@@ -377,9 +377,9 @@ static INT_PTR CALLBACK TlenVoiceOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara switch (((LPNMHDR) lParam)->code) {
case PSN_APPLY:
{
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "VoiceChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceIn", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_IN, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceOut", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_OUT, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "VoiceChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "VoiceDeviceIn", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_IN, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "VoiceDeviceOut", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_OUT, CB_GETCURSEL, 0, 0));
ApplyChanges(proto, 2);
return TRUE;
}
@@ -403,9 +403,9 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, _T("tlen.pl"));
}
@@ -413,21 +413,21 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_HOST), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_HOSTPORT), TRUE);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "ManualHost", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "ManualHost", &dbv)) {
SetDlgItemText(hwndDlg, IDC_HOST, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
SetDlgItemText(hwndDlg, IDC_HOST, _T("s1.tlen.pl"));
- SetDlgItemInt(hwndDlg, IDC_HOSTPORT, DBGetContactSettingWord(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_HOSTPORT, db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT), FALSE);
- CheckDlgButton(hwndDlg, IDC_KEEPALIVE, DBGetContactSettingByte(NULL, proto->m_szModuleName, "KeepAlive", TRUE));
+ CheckDlgButton(hwndDlg, IDC_KEEPALIVE, db_get_b(NULL, proto->m_szModuleName, "KeepAlive", TRUE));
- CheckDlgButton(hwndDlg, IDC_USE_SSL, DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", TRUE));
+ CheckDlgButton(hwndDlg, IDC_USE_SSL, db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE));
- CheckDlgButton(hwndDlg, IDC_VISIBILITY_SUPPORT, DBGetContactSettingByte(NULL, proto->m_szModuleName, "VisibilitySupport", FALSE));
+ CheckDlgButton(hwndDlg, IDC_VISIBILITY_SUPPORT, db_get_b(NULL, proto->m_szModuleName, "VisibilitySupport", FALSE));
// File transfer options
bChecked = FALSE;
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseFileProxy", FALSE) == TRUE) {
+ if (db_get_b(NULL, proto->m_szModuleName, "UseFileProxy", FALSE) == TRUE) {
bChecked = TRUE;
CheckDlgButton(hwndDlg, IDC_FILE_USE_PROXY, TRUE);
}
@@ -438,7 +438,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT_LABEL), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USE_AUTH), bChecked);
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE) == TRUE) {
+ if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE) == TRUE) {
CheckDlgButton(hwndDlg, IDC_FILE_PROXY_USE_AUTH, TRUE);
} else {
bChecked = FALSE;
@@ -451,20 +451,20 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Forwarding"));
SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("SOCKS4"));
SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("SOCKS5"));
- SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_SETCURSEL, DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyType", 0), 0);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
+ SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_SETCURSEL, db_get_w(NULL, proto->m_szModuleName, "FileProxyType", 0), 0);
+ if (!db_get_ts(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FILE_PROXY_HOST, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- SetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyPort", 0), FALSE);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
+ SetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, db_get_w(NULL, proto->m_szModuleName, "FileProxyPort", 0), FALSE);
+ if (!db_get_ts(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FILE_PROXY_USER, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return TRUE;
}
@@ -520,43 +520,43 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, BOOL reconnectRequired = FALSE;
DBVARIANT dbv;
GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "LoginServer", strlwr(text));
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text));
GetDlgItemTextA(hwndDlg, IDC_HOST, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "ManualHost", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "ManualHost", text);
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "ManualHost", text);
port = (WORD) GetDlgItemInt(hwndDlg, IDC_HOSTPORT, NULL, FALSE);
- if (DBGetContactSettingWord(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port)
+ if (db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port)
reconnectRequired = TRUE;
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "ManualPort", port);
+ db_set_w(NULL, proto->m_szModuleName, "ManualPort", port);
proto->tlenOptions.sendKeepAlive = IsDlgButtonChecked(hwndDlg, IDC_KEEPALIVE);
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "KeepAlive", (BYTE) proto->tlenOptions.sendKeepAlive);
+ db_set_b(NULL, proto->m_szModuleName, "KeepAlive", (BYTE) proto->tlenOptions.sendKeepAlive);
useEncryption = IsDlgButtonChecked(hwndDlg, IDC_USE_SSL);
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", TRUE) != useEncryption)
+ if (db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE) != useEncryption)
reconnectRequired = TRUE;
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", (BYTE) useEncryption);
+ db_set_b(NULL, proto->m_szModuleName, "UseEncryption", (BYTE) useEncryption);
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT));
+ db_set_b(NULL, proto->m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT));
// File transfer options
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY));
+ db_set_w(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0));
GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, sizeof(text));
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "FileProxyHost", text);
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH));
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyHost", text);
+ db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE));
+ db_set_b(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH));
GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, sizeof(text));
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "FileProxyUsername", text);
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyUsername", text);
GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, sizeof(text));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "FileProxyPassword", text);
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyPassword", text);
if (reconnectRequired && proto->isConnected)
MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
ApplyChanges(proto, 4);
@@ -600,11 +600,11 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_ENABLEPOPUP, DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE));
- SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupBack", POPUP_DEFAULT_COLORBKG));
- SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupText", POPUP_DEFAULT_COLORTXT));
- SetDlgItemInt(hwndDlg, IDC_DELAY, DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupDelay", 4), FALSE);
- delayMode = DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
+ CheckDlgButton(hwndDlg, IDC_ENABLEPOPUP, db_get_b(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE));
+ SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, "MailPopupBack", POPUP_DEFAULT_COLORBKG));
+ SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, "MailPopupText", POPUP_DEFAULT_COLORTXT));
+ SetDlgItemInt(hwndDlg, IDC_DELAY, db_get_dw(NULL, proto->m_szModuleName, "MailPopupDelay", 4), FALSE);
+ delayMode = db_get_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
if (delayMode == 1) {
CheckDlgButton(hwndDlg, IDC_DELAY_CUSTOM, TRUE);
} else if (delayMode == 2) {
@@ -653,10 +653,10 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, case PSN_APPLY:
{
BYTE delayMode;
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "MailPopupEnabled", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLEPOPUP));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, "MailPopupBack", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, "MailPopupText", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE));
+ db_set_b(NULL, proto->m_szModuleName, "MailPopupEnabled", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLEPOPUP));
+ db_set_dw(NULL, proto->m_szModuleName, "MailPopupBack", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, "MailPopupText", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE));
delayMode=0;
if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_CUSTOM)) {
delayMode=1;
@@ -664,7 +664,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, delayMode=2;
}
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "MailPopupDelayMode", delayMode);
+ db_set_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", delayMode);
ApplyChanges(proto, 8);
return TRUE;
}
diff --git a/protocols/Tlen/src/jabber_svc.cpp b/protocols/Tlen/src/jabber_svc.cpp index 30e4764e4f..db39892f83 100644 --- a/protocols/Tlen/src/jabber_svc.cpp +++ b/protocols/Tlen/src/jabber_svc.cpp @@ -193,10 +193,10 @@ static HANDLE AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD flag jid = mir_strdup(newJid); _strlwr(jid);
hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "jid", jid);
+ db_set_s(hContact, proto->m_szModuleName, "jid", jid);
if ((nick=JabberNickFromJID(newJid)) == NULL)
nick = mir_strdup(newJid);
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
mir_free(nick);
mir_free(jid);
@@ -208,15 +208,15 @@ static HANDLE AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD flag // PS_ADDTOLIST is called but before the add dialog issue deletion of
// "NotOnList".
// If temporary add, "NotOnList" won't be deleted, and that's expected.
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
if (flags & PALF_TEMPORARY)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
}
else {
// already exist
// Set up a dummy "NotOnList" when adding permanently only
if (!(flags&PALF_TEMPORARY))
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
}
return hContact;
@@ -301,7 +301,7 @@ int __cdecl TlenProtocol::Authorize(HANDLE hDbEvent) JabberSend(this, "<presence to='%s' type='subscribed'/>", jid);
// Automatically add this user to my roster if option is enabled
- if (DBGetContactSettingByte(NULL, m_szModuleName, "AutoAdd", TRUE) == TRUE) {
+ if (db_get_b(NULL, m_szModuleName, "AutoAdd", TRUE) == TRUE) {
HANDLE hContact;
JABBER_LIST_ITEM *item;
@@ -310,7 +310,7 @@ int __cdecl TlenProtocol::Authorize(HANDLE hDbEvent) if ((hContact=AddToListByJID(this, jid, 0)) != NULL) {
// Trigger actual add by removing the "NotOnList" added by AddToListByJID()
// See AddToListByJID() and JabberDbSettingChanged().
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
}
}
}
@@ -495,7 +495,7 @@ int __cdecl TlenProtocol::GetInfo(HANDLE hContact, int infoType) JabberIqAdd(this, iqId, IQ_PROC_NONE, TlenIqResultVcard);
JabberSend(this, "<iq type='get' id='"JABBER_IQID"%d' to='tuba'><query xmlns='jabber:iq:register'></query></iq>", iqId);
} else {
- if (DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) return 1;
+ if (db_get(hContact, m_szModuleName, "jid", &dbv)) return 1;
if ((nick=JabberNickFromJID(dbv.pszVal)) != NULL) {
if ((pNick=JabberTextEncode(nick)) != NULL) {
iqId = JabberSerialNext(this);
@@ -505,7 +505,7 @@ int __cdecl TlenProtocol::GetInfo(HANDLE hContact, int infoType) }
mir_free(nick);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -517,12 +517,12 @@ int __cdecl TlenProtocol::SetApparentMode(HANDLE hContact, int mode) char *jid;
if (!isOnline) return 0;
- if (!DBGetContactSettingByte(NULL, m_szModuleName, "VisibilitySupport", FALSE)) return 0;
+ if (!db_get_b(NULL, m_szModuleName, "VisibilitySupport", FALSE)) return 0;
if (mode != 0 && mode != ID_STATUS_ONLINE && mode != ID_STATUS_OFFLINE) return 1;
- oldMode = DBGetContactSettingWord(hContact, m_szModuleName, "ApparentMode", 0);
+ oldMode = db_get_w(hContact, m_szModuleName, "ApparentMode", 0);
if ((int) mode == oldMode) return 1;
- DBWriteContactSettingWord(hContact, m_szModuleName, "ApparentMode", (WORD) mode);
- if (!DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) {
+ db_set_w(hContact, m_szModuleName, "ApparentMode", (WORD) mode);
+ if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
jid = dbv.pszVal;
switch (mode) {
case ID_STATUS_ONLINE:
@@ -540,7 +540,7 @@ int __cdecl TlenProtocol::SetApparentMode(HANDLE hContact, int mode) JabberSend(this, "<presence to='%s'><show>available</show></presence>", jid);
break;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -571,16 +571,16 @@ static void __cdecl TlenGetAwayMsgThread(void *ptr) DBVARIANT dbv;
JABBER_LIST_ITEM *item;
SENDACKTHREADDATA *data = (SENDACKTHREADDATA *)ptr;
- if (!DBGetContactSetting(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
if ((item=JabberListGetItemPtr(data->proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (item->statusMessage != NULL) {
ProtoBroadcastAck(data->proto->m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) item->statusMessage);
return;
}
}
else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
ProtoBroadcastAck(data->proto->m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) "");
@@ -592,10 +592,10 @@ INT_PTR TlenSendAlert(void *ptr, LPARAM wParam, LPARAM lParam) HANDLE hContact = ( HANDLE )wParam;
DBVARIANT dbv;
TlenProtocol *proto = (TlenProtocol *)ptr;
- if (proto->isOnline && !DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (proto->isOnline && !db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
JabberSend(proto, "<m tp='a' to='%s'/>", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -608,7 +608,7 @@ int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg) int id;
char msgType[16];
- if (!isOnline || DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) {
+ if (!isOnline || db_get(hContact, m_szModuleName, "jid", &dbv)) {
SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
tdata->proto = this;
tdata->hContact = hContact;
@@ -632,12 +632,12 @@ int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg) if ((msgEnc=JabberTextEncode(msg)) != NULL) {
if (JabberListExist(this, LIST_CHATROOM, dbv.pszVal) && strchr(dbv.pszVal, '/') == NULL) {
strcpy(msgType, "groupchat");
- } else if (DBGetContactSettingByte(hContact, m_szModuleName, "bChat", FALSE)) {
+ } else if (db_get_b(hContact, m_szModuleName, "bChat", FALSE)) {
strcpy(msgType, "privchat");
} else {
strcpy(msgType, "chat");
}
- if (!strcmp(msgType, "groupchat") || DBGetContactSettingByte(NULL, m_szModuleName, "MsgAck", FALSE) == FALSE) {
+ if (!strcmp(msgType, "groupchat") || db_get_b(NULL, m_szModuleName, "MsgAck", FALSE) == FALSE) {
SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
tdata->proto = this;
tdata->hContact = hContact;
@@ -660,7 +660,7 @@ int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg) }
mir_free(msgEnc);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
@@ -678,9 +678,9 @@ static INT_PTR TlenGetAvatarInfo(void *ptr, LPARAM wParam, LPARAM lParam) if (!proto->tlenOptions.enableAvatars) return GAIR_NOAVATAR;
if (AI->hContact != NULL) {
- if (!DBGetContactSetting(AI->hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(AI->hContact, proto->m_szModuleName, "jid", &dbv)) {
item = JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (item != NULL) {
downloadingAvatar = item->newAvatarDownloading;
avatarHash = item->avatarHash;
@@ -801,8 +801,8 @@ HANDLE __cdecl TlenProtocol::SendFile(HANDLE hContact, const PROTOCHAR* szDescri int id;
if (!isOnline) return 0;
-// if (DBGetContactSettingWord(ccs->hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0;
- if (DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) return 0;
+// if (db_get_w(ccs->hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0;
+ if (db_get(hContact, m_szModuleName, "jid", &dbv)) return 0;
ft = TlenFileCreateFT(this, dbv.pszVal);
for (ft->fileCount=0; ppszFiles[ft->fileCount]; ft->fileCount++);
ft->files = (char **) mir_alloc(sizeof(char *) * ft->fileCount);
@@ -823,7 +823,7 @@ HANDLE __cdecl TlenProtocol::SendFile(HANDLE hContact, const PROTOCHAR* szDescri ft->szDescription = mir_t2a(szDescription);
ft->hContact = hContact;
ft->currentFile = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
id = JabberSerialNext(this);
_snprintf(idStr, sizeof(idStr), "%d", id);
@@ -908,18 +908,18 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam) hContact = (HANDLE) wParam;
szProto = GetContactProto(hContact);
if (szProto == NULL || strcmp(szProto, proto->m_szModuleName)) return 0;
-// if (DBGetContactSettingByte(hContact, proto->m_szModuleName, "ChatRoom", 0) != 0) return 0;
+// if (db_get_b(hContact, proto->m_szModuleName, "ChatRoom", 0) != 0) return 0;
// A contact's group is changed
if (!strcmp(cws->szSetting, "Group")) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- DBFreeVariant(&dbv);
- if (!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) {
+ db_free(&dbv);
+ if (!db_get(hContact, "CList", "MyHandle", &dbv)) {
nick = JabberTextEncode(dbv.pszVal);
- DBFreeVariant(&dbv);
- } else if (!DBGetContactSetting(hContact, proto->m_szModuleName, "Nick", &dbv)) {
+ db_free(&dbv);
+ } else if (!db_get(hContact, proto->m_szModuleName, "Nick", &dbv)) {
nick = JabberTextEncode(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
nick = JabberNickFromJID(item->jid);
}
@@ -943,7 +943,7 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam) }
}
else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -955,7 +955,7 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam) // szProto = GetContactProto(hContact);
// if (szProto == NULL || strcmp(szProto, proto->m_szModuleName)) return 0;
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
jid = dbv.pszVal;
if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
if (cws->value.type == DBVT_DELETED) {
@@ -980,7 +980,7 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam) }
if (newNick != NULL) mir_free(newNick);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
// A temporary contact has been added permanently
@@ -988,33 +988,33 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam) char *jid, *nick, *pGroup;
if (cws->value.type==DBVT_DELETED || (cws->value.type==DBVT_BYTE && cws->value.bVal==0)) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
jid = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
JabberLog(proto, "Add %s permanently to list", jid);
- if (!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) {
+ if (!db_get(hContact, "CList", "MyHandle", &dbv)) {
nick = JabberTextEncode(dbv.pszVal); //Utf8Encode
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
nick = JabberNickFromJID(jid);
}
if (nick != NULL) {
JabberLog(proto, "jid=%s nick=%s", jid, nick);
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
+ if (!db_get(hContact, "CList", "Group", &dbv)) {
if ((pGroup=TlenGroupEncode(dbv.pszVal)) != NULL) {
JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'><group>%s</group></item></query></iq>", nick, jid, pGroup);
JabberSend(proto, "<presence to='%s' type='subscribe'/>", jid);
mir_free(pGroup);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'/></query></iq>", nick, jid);
JabberSend(proto, "<presence to='%s' type='subscribe'/>", jid);
}
mir_free(nick);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
}
mir_free(jid);
}
@@ -1036,7 +1036,7 @@ int JabberContactDeleted(void *ptr, WPARAM wParam, LPARAM lParam) szProto = GetContactProto((HANDLE)wParam);
if (szProto == NULL || strcmp(szProto, proto->m_szModuleName))
return 0;
- if (!DBGetContactSetting((HANDLE) wParam, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get((HANDLE) wParam, proto->m_szModuleName, "jid", &dbv)) {
char *jid, *p, *q;
jid = dbv.pszVal;
@@ -1049,7 +1049,7 @@ int JabberContactDeleted(void *ptr, WPARAM wParam, LPARAM lParam) JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item jid='%s' subscription='remove'/></query></iq>", jid);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -1060,7 +1060,7 @@ int __cdecl TlenProtocol::UserIsTyping(HANDLE hContact, int type) JABBER_LIST_ITEM *item;
if (!isOnline) return 0;
- if (!DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
if ((item=JabberListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != NULL /*&& item->wantComposingEvent == TRUE*/) {
switch (type) {
case PROTOTYPE_SELFTYPING_OFF:
@@ -1071,7 +1071,7 @@ int __cdecl TlenProtocol::UserIsTyping(HANDLE hContact, int type) break;
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -1282,15 +1282,15 @@ TlenProtocol::TlenProtocol( const char* aProtoName, const TCHAR* aUserName ) DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, m_szModuleName, "LoginServer", &dbv)) {
- DBFreeVariant(&dbv);
+ if (!db_get(NULL, m_szModuleName, "LoginServer", &dbv)) {
+ db_free(&dbv);
} else {
- DBWriteContactSettingString(NULL, m_szModuleName, "LoginServer", "tlen.pl");
+ db_set_s(NULL, m_szModuleName, "LoginServer", "tlen.pl");
}
- if (!DBGetContactSetting(NULL, m_szModuleName, "ManualHost", &dbv)) {
- DBFreeVariant(&dbv);
+ if (!db_get(NULL, m_szModuleName, "ManualHost", &dbv)) {
+ db_free(&dbv);
} else {
- DBWriteContactSettingString(NULL, m_szModuleName, "ManualHost", "s1.tlen.pl");
+ db_set_s(NULL, m_szModuleName, "ManualHost", "s1.tlen.pl");
}
TlenLoadOptions(this);
diff --git a/protocols/Tlen/src/jabber_thread.cpp b/protocols/Tlen/src/jabber_thread.cpp index 3b93aa51d5..31fb47a10f 100644 --- a/protocols/Tlen/src/jabber_thread.cpp +++ b/protocols/Tlen/src/jabber_thread.cpp @@ -133,12 +133,12 @@ void __cdecl JabberServerThread(ThreadData *info) info->proto->threadData = info;
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
strncpy(info->username, dbv.pszVal, sizeof(info->username));
info->username[sizeof(info->username)-1] = '\0';
_strlwr(info->username);
- DBWriteContactSettingString(NULL, info->proto->m_szModuleName, "LoginName", info->username);
- DBFreeVariant(&dbv);
+ db_set_s(NULL, info->proto->m_szModuleName, "LoginName", info->username);
+ db_free(&dbv);
} else {
JabberLog(info->proto, "Thread ended, login name is not configured");
@@ -146,12 +146,12 @@ void __cdecl JabberServerThread(ThreadData *info) }
if (loginErr == 0) {
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "LoginServer", &dbv)) {
strncpy(info->server, dbv.pszVal, sizeof(info->server));
info->server[sizeof(info->server)-1] = '\0';
_strlwr(info->server);
- DBWriteContactSettingString(NULL, info->proto->m_szModuleName, "LoginServer", info->server);
- DBFreeVariant(&dbv);
+ db_set_s(NULL, info->proto->m_szModuleName, "LoginServer", info->server);
+ db_free(&dbv);
} else {
JabberLog(info->proto, "Thread ended, login server is not configured");
loginErr = LOGINERR_NONETWORK;
@@ -178,11 +178,11 @@ void __cdecl JabberServerThread(ThreadData *info) loginErr = LOGINERR_BADUSERID;
}
} else {
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "Password", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
strncpy(info->password, dbv.pszVal, sizeof(info->password));
info->password[sizeof(info->password)-1] = '\0';
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
JabberLog(info->proto, "Thread ended, password is not configured");
loginErr = LOGINERR_BADUSERID;
@@ -207,14 +207,14 @@ void __cdecl JabberServerThread(ThreadData *info) }
_snprintf(jidStr, sizeof(jidStr), "%s@%s", info->username, info->server);
- DBWriteContactSettingString(NULL, info->proto->m_szModuleName, "jid", jidStr);
+ db_set_s(NULL, info->proto->m_szModuleName, "jid", jidStr);
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
strncpy(info->manualHost, dbv.pszVal, sizeof(info->manualHost));
info->manualHost[sizeof(info->manualHost)-1] = '\0';
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- info->port = DBGetContactSettingWord(NULL, info->proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT);
+ info->port = db_get_w(NULL, info->proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT);
info->useEncryption = info->proto->tlenOptions.useEncryption;
if (info->manualHost[0])
@@ -225,11 +225,11 @@ void __cdecl JabberServerThread(ThreadData *info) JabberLog(info->proto, "Thread server='%s' port='%d'", connectHost, info->port);
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "AvatarHash", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "AvatarHash", &dbv)) {
strcpy(info->proto->threadData->avatarHash, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- info->avatarFormat = DBGetContactSettingDword(NULL, info->proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
+ info->avatarFormat = db_get_dw(NULL, info->proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
reconnectMaxTime = 10;
@@ -367,8 +367,8 @@ void __cdecl JabberServerThread(ThreadData *info) while (hContact != NULL) {
str = GetContactProto(hContact);
if (str != NULL && !strcmp(str, info->proto->m_szModuleName)) {
- if (DBGetContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- DBWriteContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ db_set_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
}
hContact = db_find_next(hContact);
@@ -810,20 +810,20 @@ static void JabberProcessIq(XmlNode *node, ThreadData *info) // Add the jid (with empty resource) to Miranda contact list.
hContact = JabberDBCreateContact(info->proto, jid, nick, FALSE);
}
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
if ((groupNode=JabberXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
JabberContactListCreateGroup(item->group);
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
+ db_set_s(hContact, "CList", "Group", item->group);
}
else {
item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
if (!strcmp(str, "none") || (!strcmp(str, "from") && strchr(jid, '@') != NULL)) {
- if (DBGetContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ db_set_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
}
else {
@@ -842,8 +842,8 @@ static void JabberProcessIq(XmlNode *node, ThreadData *info) // remove, so that history will be retained.
if (!strcmp(str, "remove")) {
if ((hContact=JabberHContactFromJID(info->proto, jid)) != NULL) {
- if (DBGetContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ db_set_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
JabberListRemove(info->proto, LIST_ROSTER, jid);
}
}
@@ -1087,7 +1087,7 @@ static void TlenProcessM(XmlNode *node, ThreadData *info) /* MUC private message */
str = JabberResourceFromJID(f);
hContact = JabberDBCreateContact(info->proto, f, str, TRUE);
- DBWriteContactSettingByte(hContact, info->proto->m_szModuleName, "bChat", TRUE);
+ db_set_b(hContact, info->proto->m_szModuleName, "bChat", TRUE);
mir_free(str);
localMessage = JabberTextDecode(bNode->text);
recv.flags = 0;
@@ -1146,18 +1146,18 @@ static void TlenMailPopup(TlenProtocol *proto, char *title, char *emailInfo) {
if ( !ServiceExists(MS_POPUP_ADDPOPUP))
return;
- if (!DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE))
+ if (!db_get_b(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE))
return;
POPUPDATA ppd = { 0 };
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIL));
strcpy(ppd.lpzContactName, title);
strcpy(ppd.lpzText, emailInfo);
- ppd.colorBack = DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupBack", 0);
- ppd.colorText = DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupText", 0);
- BYTE delayMode = DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
+ ppd.colorBack = db_get_dw(NULL, proto->m_szModuleName, "MailPopupBack", 0);
+ ppd.colorText = db_get_dw(NULL, proto->m_szModuleName, "MailPopupText", 0);
+ BYTE delayMode = db_get_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
if (delayMode == 1)
- ppd.iSeconds = DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupDelay", 4);
+ ppd.iSeconds = db_get_dw(NULL, proto->m_szModuleName, "MailPopupDelay", 4);
else if (delayMode == 2)
ppd.iSeconds = -1;
PUAddPopUp(&ppd);
@@ -1281,12 +1281,12 @@ static void TlenProcessP(XmlNode *node, ThreadData *info) n = mir_strdup(Translate("Private conference"));// JabberNickFromJID(f);
}
sprintf(jid, "%s/%s", f, info->username);
-// if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
+// if (!db_get(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
// always real username
// sprintf(jid, "%s/%s", f, dbv.pszVal);
TlenMUCCreateWindow(info->proto, f, n, 0, NULL, id);
TlenMUCRecvPresence(info->proto, jid, ID_STATUS_ONLINE, flags, k);
-// DBFreeVariant(&dbv);
+// db_free(&dbv);
// }
mir_free(n);
}
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 4b392137e0..495a89a0ee 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -119,55 +119,28 @@ static void TlenRegisterIcons() int TlenPrebuildContactMenu(void *ptr, WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact;
- DBVARIANT dbv;
- CLISTMENUITEM clmi = { sizeof(clmi) };
- JABBER_LIST_ITEM *item;
+ HANDLE hContact = (HANDLE)wParam;
TlenProtocol *proto = (TlenProtocol *)ptr;
- if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
- if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- if (item->subscription == SUB_NONE || item->subscription == SUB_FROM)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactRequestAuth, (LPARAM) &clmi);
-
- if (item->subscription == SUB_NONE || item->subscription == SUB_TO)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactGrantAuth, (LPARAM) &clmi);
-
- if (item->status != ID_STATUS_OFFLINE)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactMUC, (LPARAM) &clmi);
-
- if (item->status != ID_STATUS_OFFLINE && !TlenVoiceIsInUse(proto))
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactVoice, (LPARAM) &clmi);
-
- if (item->status != ID_STATUS_OFFLINE)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuPicture, (LPARAM) &clmi);
-
- DBFreeVariant(&dbv);
+ if (hContact != NULL && proto->isOnline) {
+ DBVARIANT dbv;
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ JABBER_LIST_ITEM *item = JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal);
+ db_free(&dbv);
+ if (item != NULL) {
+ Menu_ShowItem(proto->hMenuContactRequestAuth, item->subscription == SUB_NONE || item->subscription == SUB_FROM);
+ Menu_ShowItem(proto->hMenuContactGrantAuth, item->subscription == SUB_NONE || item->subscription == SUB_TO);
+ Menu_ShowItem(proto->hMenuContactMUC, item->status != ID_STATUS_OFFLINE);
+ Menu_ShowItem(proto->hMenuContactVoice, item->status != ID_STATUS_OFFLINE && !TlenVoiceIsInUse(proto));
+ Menu_ShowItem(proto->hMenuPicture, item->status != ID_STATUS_OFFLINE);
return 0;
}
- DBFreeVariant(&dbv);
}
}
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactMUC, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactVoice, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactRequestAuth, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactGrantAuth, (LPARAM) &clmi);
+
+ Menu_ShowItem(proto->hMenuContactMUC, false);
+ Menu_ShowItem(proto->hMenuContactVoice, false);
+ Menu_ShowItem(proto->hMenuContactRequestAuth, false);
+ Menu_ShowItem(proto->hMenuContactGrantAuth, false);
return 0;
}
@@ -177,9 +150,9 @@ INT_PTR TlenContactMenuHandleRequestAuth(void *ptr, LPARAM wParam, LPARAM lParam DBVARIANT dbv;
TlenProtocol *proto = (TlenProtocol *)ptr;
if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
JabberSend(proto, "<presence to='%s' type='subscribe'/>", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -191,9 +164,9 @@ INT_PTR TlenContactMenuHandleGrantAuth(void *ptr, LPARAM wParam, LPARAM lParam) DBVARIANT dbv;
TlenProtocol *proto = (TlenProtocol *)ptr;
if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
JabberSend(proto, "<presence to='%s' type='subscribed'/>", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -220,15 +193,15 @@ INT_PTR TlenMenuHandleInbox(void *ptr, LPARAM wParam, LPARAM lParam) char form[1024];
char cookie[1024];
TlenProtocol *proto = (TlenProtocol *)ptr;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
login = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE) == TRUE) {
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv)) {
+ if (db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE) == TRUE) {
+ if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
} else if (proto->threadData != NULL && strlen(proto->threadData->password) > 0) {
password = mir_strdup(proto->threadData->password);
@@ -287,8 +260,8 @@ int TlenOnModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam) while (hContact != NULL) {
char *szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(szProto, proto->m_szModuleName)) {
- if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ db_set_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
}
hContact = db_find_next(hContact);
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index f6460e905b..1df8c8836d 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -50,7 +50,7 @@ void TlenGetAvatarFileName(TlenProtocol *proto, JABBER_LIST_ITEM *item, TCHAR* p } else if (proto->threadData != NULL) {
format = proto->threadData->avatarFormat;
} else {
- format = DBGetContactSettingDword(NULL, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
+ format = db_get_dw(NULL, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
}
tszFileType = TEXT("png");
switch(format) {
@@ -81,9 +81,9 @@ static void RemoveAvatar(TlenProtocol *proto, HANDLE hContact) { }
TlenGetAvatarFileName( proto, NULL, tFileName, sizeof tFileName );
DeleteFile(tFileName);
- DBDeleteContactSetting(hContact, "ContactPhoto", "File");
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "AvatarHash");
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "AvatarFormat");
+ db_unset(hContact, "ContactPhoto", "File");
+ db_unset(hContact, proto->m_szModuleName, "AvatarHash");
+ db_unset(hContact, proto->m_szModuleName, "AvatarFormat");
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
}
@@ -118,9 +118,9 @@ static void SetAvatar(TlenProtocol *proto, HANDLE hContact, JABBER_LIST_ITEM *it if ( out != NULL ) {
fwrite( data, len, 1, out );
fclose( out );
- DBWriteContactSettingTString(hContact, "ContactPhoto", "File", filename );
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "AvatarHash", md5);
- DBWriteContactSettingDword(hContact, proto->m_szModuleName, "AvatarFormat", format);
+ db_set_ts(hContact, "ContactPhoto", "File", filename );
+ db_set_s(hContact, proto->m_szModuleName, "AvatarHash", md5);
+ db_set_dw(hContact, proto->m_szModuleName, "AvatarFormat", format);
}
ProtoBroadcastAck( proto->m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL , 0);
}
diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp index d28c4ed37b..c43ee11edd 100644 --- a/protocols/Tlen/src/tlen_muc.cpp +++ b/protocols/Tlen/src/tlen_muc.cpp @@ -72,9 +72,9 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) char jid[256];
HANDLE hContact;
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (((hContact=JabberHContactFromJID(proto, jid)) != NULL) || !strcmp(id, proto->threadData->username)) {
ZeroMemory(&ci, sizeof(ci));
ci.cbSize = sizeof(ci);
@@ -250,14 +250,14 @@ static int TlenMUCHandleEvent(void *ptr, WPARAM wParam, LPARAM lParam) char str[256];
sprintf(str, "%s/%s", mucce->pszID, nick);
hContact = JabberDBCreateContact(proto, str, nick, TRUE); //(char *)mucce->pszUID
- DBWriteContactSettingByte(hContact, proto->m_szModuleName, "bChat", TRUE);
+ db_set_b(hContact, proto->m_szModuleName, "bChat", TRUE);
CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
} else {
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
char str[512];
_snprintf(str, sizeof(str), "%s@%s", nick, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
hContact = JabberDBCreateContact(proto, str, nick, TRUE);
CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
}
@@ -277,7 +277,7 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r char *nick;
int ignore, ask, groupChatPolicy;
if (roomId == NULL) return 1;
- groupChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "GroupChatPolicy", 0);
+ groupChatPolicy = db_get_w(NULL, proto->m_szModuleName, "GroupChatPolicy", 0);
ask = TRUE;
ignore = FALSE;
if (groupChatPolicy == TLEN_MUC_ASK) {
@@ -288,9 +288,9 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r } else if (groupChatPolicy == TLEN_MUC_IGNORE_NIR) {
char jid[256];
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -300,9 +300,9 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r char jid[256];
JABBER_LIST_ITEM *item;
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -961,12 +961,12 @@ static void __cdecl TlenMUCCSendQueryResultThread(void *ptr) while (hContact != NULL) {
char *str = GetContactProto(hContact);
if (str != NULL && !strcmp(str, threadData->proto->m_szModuleName)) {
- if (!DBGetContactSettingByte(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
- if (!DBGetContactSetting(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get_b(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
+ if (!db_get(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
if (strcmp(dbv.pszVal, "b73@tlen.pl")) {
queryResult.iItemsNum++;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -979,14 +979,14 @@ static void __cdecl TlenMUCCSendQueryResultThread(void *ptr) while (hContact != NULL) {
char *baseProto = GetContactProto(hContact);
if (baseProto != NULL && !strcmp(baseProto, threadData->proto->m_szModuleName)) {
- if (!DBGetContactSettingByte(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
- if (!DBGetContactSetting(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get_b(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
+ if (!db_get(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
if (strcmp(dbv.pszVal, "b73@tlen.pl")) {
queryResult.pItems[queryResult.iItemsNum].pszID = mir_strdup(dbv.pszVal);
queryResult.pItems[queryResult.iItemsNum].pszName = mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
queryResult.iItemsNum++;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -1056,13 +1056,13 @@ INT_PTR TlenMUCContactMenuHandleMUC(void *ptr, LPARAM wParam, LPARAM lParam) return 1;
}
if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char serialId[32];
sprintf(serialId, JABBER_IQID"%d", JabberSerialNext(proto));
item = JabberListAdd(proto, LIST_INVITATIONS, serialId);
item->nick = mir_strdup(dbv.pszVal);
JabberSend(proto, "<p to='c' tp='c' id='%s'/>", serialId);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp index 7c1f706d49..308079097c 100644 --- a/protocols/Tlen/src/tlen_p2p_old.cpp +++ b/protocols/Tlen/src/tlen_p2p_old.cpp @@ -466,27 +466,27 @@ JABBER_SOCKET TlenP2PListen(TLEN_FILE_TRANSFER *ft) if (ft->localName != NULL) mir_free(ft->localName);
ft->localName = NULL;
ft->wPort = 0;
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseFileProxy", FALSE)) {
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
+ if (db_get_b(NULL, proto->m_szModuleName, "UseFileProxy", FALSE)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
strcpy(sb.szHost, dbv.pszVal);
- DBFreeVariant(&dbv);
- sb.wPort = DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyPort", 0);
+ db_free(&dbv);
+ sb.wPort = db_get_w(NULL, proto->m_szModuleName, "FileProxyPort", 0);
sb.useAuth = FALSE;
strcpy(sb.szUser, "");
strcpy(sb.szPassword, "");
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE)) {
+ if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE)) {
sb.useAuth = TRUE;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
strcpy(sb.szUser, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
strcpy(sb.szPassword, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
- switch (DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyType", 0)) {
+ switch (db_get_w(NULL, proto->m_szModuleName, "FileProxyType", 0)) {
case 0: // forwarding
useProxy = 1;
break;
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index d61842d8dd..c0233ee233 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -256,7 +256,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) { BOOL SendPicture(TlenProtocol *proto, HANDLE hContact) {
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char *jid = dbv.pszVal;
char szFilter[512];
char *szFileName = (char*) mir_alloc(_MAX_PATH);
@@ -314,7 +314,7 @@ BOOL SendPicture(TlenProtocol *proto, HANDLE hContact) { fclose(fp);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return FALSE;
}
diff --git a/protocols/Tlen/src/tlen_presence.cpp b/protocols/Tlen/src/tlen_presence.cpp index 7dc15f41f6..1207857241 100644 --- a/protocols/Tlen/src/tlen_presence.cpp +++ b/protocols/Tlen/src/tlen_presence.cpp @@ -73,19 +73,19 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) p = NULL; JabberListAddResource(proto, LIST_ROSTER, from, status, statusNode?p:NULL); if (p) { - DBWriteContactSettingString(hContact, "CList", "StatusMsg", p); + db_set_s(hContact, "CList", "StatusMsg", p); mir_free(p); } else { - DBDeleteContactSetting(hContact, "CList", "StatusMsg"); + db_unset(hContact, "CList", "StatusMsg"); } // Determine status to show for the contact and request version information if (item != NULL) { laststatus = item->status; item->status = status; } - if (strchr(from, '@') != NULL || DBGetContactSettingByte(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { - if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) - DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", (WORD) status); + if (strchr(from, '@') != NULL || db_get_b(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { + if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) + db_set_w(hContact, proto->m_szModuleName, "Status", (WORD) status); } if (item != NULL) { if (!item->infoRequested) { @@ -122,9 +122,9 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) JabberListAddResource(proto, LIST_ROSTER, from, status, p); if ((hContact=JabberHContactFromJID(proto, from)) != NULL) { if (p) { - DBWriteContactSettingString(hContact, "CList", "StatusMsg", p); + db_set_s(hContact, "CList", "StatusMsg", p); } else { - DBDeleteContactSetting(hContact, "CList", "StatusMsg"); + db_unset(hContact, "CList", "StatusMsg"); } } if (p) mir_free(p); @@ -136,9 +136,9 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) item->infoRequested = FALSE; } if ((hContact=JabberHContactFromJID(proto, from)) != NULL) { - if (strchr(from, '@') != NULL || DBGetContactSettingByte(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { - if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) - DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", (WORD) status); + if (strchr(from, '@') != NULL || db_get_b(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) { + if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) + db_set_w(hContact, proto->m_szModuleName, "Status", (WORD) status); } if (item != NULL && item->isTyping) { item->isTyping = FALSE; @@ -214,8 +214,8 @@ static void JabberSendPresenceTo(TlenProtocol *proto, int status, char *to) break; case ID_STATUS_OFFLINE: presenceType = "unavailable"; - if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "LeaveOfflineMessage", FALSE)) { - int offlineMessageOption = DBGetContactSettingWord(NULL, proto->m_szModuleName, "OfflineMessageOption", 0); + if (db_get_b(NULL, proto->m_szModuleName, "LeaveOfflineMessage", FALSE)) { + int offlineMessageOption = db_get_w(NULL, proto->m_szModuleName, "OfflineMessageOption", 0); if (offlineMessageOption == 0) { switch (proto->m_iStatus) { case ID_STATUS_ONLINE: @@ -245,11 +245,11 @@ static void JabberSendPresenceTo(TlenProtocol *proto, int status, char *to) } else if (offlineMessageOption < 7) { DBVARIANT dbv; const char *statusNames[] = {"OnDefault", "AwayDefault", "NaDefault", "DndDefault", "FreeChatDefault", "InvDefault"}; - if (!DBGetContactSetting(NULL, "SRAway", statusNames[offlineMessageOption-1], &dbv)) { + if (!db_get(NULL, "SRAway", statusNames[offlineMessageOption-1], &dbv)) { int i; char substituteStr[128]; ptr = mir_strdup(dbv.pszVal); - DBFreeVariant(&dbv); + db_free(&dbv); for (i=0;ptr[i];i++) { if (ptr[i] != '%') continue; if (!_strnicmp(ptr+i,"%time%",6)) diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp index 25f2858d8a..933841fd3f 100644 --- a/protocols/Tlen/src/tlen_userinfo.cpp +++ b/protocols/Tlen/src/tlen_userinfo.cpp @@ -191,35 +191,35 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, _T(""));
SetFocus(GetDlgItem(hwndDlg, IDC_STATIC));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "FirstName", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "FirstName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FIRSTNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_FIRSTNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "LastName", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "LastName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_LASTNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_LASTNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "Nick", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "Nick", &dbv)) {
SetDlgItemText(hwndDlg, IDC_NICKNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_NICKNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "e-mail", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "e-mail", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EMAIL, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_EMAIL, _T(""));
- if (!DBGetContactSetting(data->hContact, data->proto->m_szModuleName, "Age", &dbv)) {
+ if (!db_get(data->hContact, data->proto->m_szModuleName, "Age", &dbv)) {
SetDlgItemInt(hwndDlg, IDC_AGE, dbv.wVal, FALSE);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_AGE, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "City", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "City", &dbv)) {
SetDlgItemText(hwndDlg, IDC_CITY, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_CITY, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "School", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "School", &dbv)) {
SetDlgItemText(hwndDlg, IDC_SCHOOL, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_SCHOOL, _T(""));
- switch (DBGetContactSettingByte(data->hContact, data->proto->m_szModuleName, "Gender", '?')) {
+ switch (db_get_b(data->hContact, data->proto->m_szModuleName, "Gender", '?')) {
case 'M':
SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 1, 0);
SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, TranslateTS(tlenFieldGender[0].name));
@@ -233,7 +233,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, _T(""));
break;
}
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "Occupation", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "Occupation", 0);
if (i>0 && i<13) {
SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, TranslateTS(tlenFieldOccupation[i-1].name));
SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, i, 0);
@@ -241,7 +241,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, _T(""));
SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, 0, 0);
}
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "LookingFor", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "LookingFor", 0);
if (i>0 && i<6) {
SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, TranslateTS(tlenFieldLookfor[i-1].name));
SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, i, 0);
@@ -249,11 +249,11 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, _T(""));
SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, 0, 0);
}
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "VoiceChat", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "VoiceChat", 0);
CheckDlgButton(hwndDlg, IDC_VOICECONVERSATIONS, i);
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "PublicStatus", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "PublicStatus", 0);
CheckDlgButton(hwndDlg, IDC_PUBLICSTATUS, i);
- if (!DBGetContactSetting(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
jid = JabberTextDecode(dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_INFO_JID, jid);
mir_free(jid);
@@ -281,7 +281,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, TranslateT("not on roster"));
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
break;
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index c476d55116..cd8b7dda3b 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -131,7 +131,7 @@ static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control) control->waveHeadersPos = 0;
control->waveHeadersNum = FRAMES_AVAILABLE_MAX_LIMIT + 2;
- j = DBGetContactSettingWord(NULL, control->proto->m_szModuleName, "VoiceDeviceOut", 0);
+ j = db_get_w(NULL, control->proto->m_szModuleName, "VoiceDeviceOut", 0);
iSelDev = WAVE_MAPPER;
if (j != 0) {
iNumDevs = waveOutGetNumDevs();
@@ -198,7 +198,7 @@ static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control) SetThreadPriority(control->hThread, THREAD_PRIORITY_ABOVE_NORMAL);
- j = DBGetContactSettingWord(NULL, control->proto->m_szModuleName, "VoiceDeviceIn", 0);
+ j = db_get_w(NULL, control->proto->m_szModuleName, "VoiceDeviceIn", 0);
iSelDev = WAVE_MAPPER;
if (j != 0) {
iNumDevs = waveInGetNumDevs();
@@ -708,7 +708,7 @@ INT_PTR TlenVoiceContactMenuHandleVoice(void *ptr, LPARAM wParam, LPARAM lParam) return 1;
}
if ((hContact=(HANDLE) wParam) != NULL) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char serialId[32];
sprintf(serialId, "%d", JabberSerialNext(proto));
if ((item = JabberListAdd(proto, LIST_VOICE, serialId)) != NULL) {
@@ -720,7 +720,7 @@ INT_PTR TlenVoiceContactMenuHandleVoice(void *ptr, LPARAM wParam, LPARAM lParam) TlenVoiceStart(ft, 2);
JabberSend(ft->proto, "<v t='%s' e='1' i='%s' v='1'/>", ft->jid, serialId);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -953,9 +953,9 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) char jid[256];
HANDLE hContact;
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if ((hContact=JabberHContactFromJID(proto, jid)) != NULL) {
return mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
}
@@ -1025,7 +1025,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) int ask, ignore, voiceChatPolicy;
ask = TRUE;
ignore = FALSE;
- voiceChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceChatPolicy", 0);
+ voiceChatPolicy = db_get_w(NULL, proto->m_szModuleName, "VoiceChatPolicy", 0);
if (voiceChatPolicy == TLEN_MUC_ASK) {
ignore = FALSE;
ask = TRUE;
@@ -1034,9 +1034,9 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) } else if (voiceChatPolicy == TLEN_MUC_IGNORE_NIR) {
char jid[256];
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -1045,9 +1045,9 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) } else if (voiceChatPolicy == TLEN_MUC_ACCEPT_IR) {
char jid[256];
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -1095,7 +1095,7 @@ int TlenVoiceBuildInDeviceList(TlenProtocol *proto, HWND hWnd) }
}
}
- i = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceIn", 0);
+ i = db_get_w(NULL, proto->m_szModuleName, "VoiceDeviceIn", 0);
if (i>j) i = 0;
SendMessage(hWnd, CB_SETCURSEL, i, 0);
return 0;
@@ -1114,7 +1114,7 @@ int TlenVoiceBuildOutDeviceList(TlenProtocol *proto, HWND hWnd) }
}
}
- i = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceOut", 0);
+ i = db_get_w(NULL, proto->m_szModuleName, "VoiceDeviceOut", 0);
if (i>j) i = 0;
SendMessage(hWnd, CB_SETCURSEL, i, 0);
return 0;
|