diff options
-rw-r--r-- | protocols/Yahoo/src/avatar.cpp | 93 | ||||
-rw-r--r-- | protocols/Yahoo/src/file_transfer.cpp | 16 | ||||
-rw-r--r-- | protocols/Yahoo/src/im.cpp | 8 | ||||
-rw-r--r-- | protocols/Yahoo/src/options.cpp | 182 | ||||
-rw-r--r-- | protocols/Yahoo/src/proto.cpp | 46 | ||||
-rw-r--r-- | protocols/Yahoo/src/services.cpp | 56 | ||||
-rw-r--r-- | protocols/Yahoo/src/user_info.cpp | 14 | ||||
-rw-r--r-- | protocols/Yahoo/src/yahoo.cpp | 36 |
8 files changed, 205 insertions, 246 deletions
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index b76e4c4de2..adb05e8e08 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -206,7 +206,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) } else {
HANDLE myhFile;
- GetAvatarFileName(hContact, buf, 1024, db_get_b(hContact, m_szModuleName,"AvatarType", 0));
+ GetAvatarFileName(hContact, buf, 1024, getByte(hContact, "AvatarType", 0));
DeleteFile(buf);
LOG(("Saving file: %s size: %u", buf, nlhrReply->dataLength));
@@ -301,13 +301,13 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p */
if (getByte("AvatarUL", 0) != 1) {
// NO avatar URL??
- if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv)) {
+ if (!getTString("AvatarFile", &dbv)) {
struct _stat statbuf;
if (_tstat( dbv.ptszVal, &statbuf ) != 0) {
LOG(("[ext_yahoo_got_picture] Avatar File Missing? Can't find file: %s", dbv.ptszVal));
} else {
- db_set_s(NULL, m_szModuleName, "AvatarInv", who);
+ setString("AvatarInv", who);
SendAvatar(dbv.ptszVal);
}
@@ -344,21 +344,22 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p if (!cksum || cksum == -1) {
LOG(("[ext_yahoo_got_picture] Resetting avatar."));
- db_set_dw(hContact, m_szModuleName, "PictCK", 0);
-
+ setDword(hContact, "PictCK", 0);
reset_avatar(hContact);
- } else {
+ }
+ else {
if (pic_url == NULL) {
LOG(("[ext_yahoo_got_picture] WARNING: Empty URL for avatar?"));
return;
}
TCHAR z[1024];
- GetAvatarFileName(hContact, z, 1024, db_get_b(hContact, m_szModuleName,"AvatarType", 0));
+ GetAvatarFileName(hContact, z, 1024, getByte(hContact, "AvatarType", 0));
- if (db_get_dw(hContact, m_szModuleName,"PictCK", 0) != cksum || _taccess( z, 0) != 0) {
+ if (getDword(hContact, "PictCK", 0) != cksum || _taccess( z, 0) != 0) {
- DebugLog("[ext_yahoo_got_picture] Checksums don't match or avatar file is missing. Current: %d, New: %d",(int)db_get_dw(hContact, m_szModuleName,"PictCK", 0), cksum);
+ DebugLog("[ext_yahoo_got_picture] Checksums don't match or avatar file is missing. Current: %d, New: %d",
+ getDword(hContact, "PictCK", 0), cksum);
struct avatar_info *avt = ( avatar_info* )malloc(sizeof(struct avatar_info));
avt->who = strdup(who);
@@ -421,10 +422,10 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p }*/
LOG(("[ext_yahoo_got_picture] Buddy: %s told us this is bad??Expired??. Re-uploading", who));
- db_unset(NULL, m_szModuleName, "AvatarURL");
+ delSetting("AvatarURL");
- if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv2)) {
- db_set_s(NULL, m_szModuleName, "AvatarInv", who);
+ if (!getTString("AvatarFile", &dbv2)) {
+ setString("AvatarInv", who);
SendAvatar(dbv2.ptszVal);
db_free(&dbv2);
} else {
@@ -462,14 +463,13 @@ void CYahooProto::ext_got_picture_checksum(const char *me, const char *who, int /* Last thing check the checksum and request new one if we need to */
if (!cksum || cksum == -1) {
- db_set_dw(hContact, m_szModuleName, "PictCK", 0);
-
+ setDword(hContact, "PictCK", 0);
reset_avatar(hContact);
}
else {
- if (db_get_dw(hContact, m_szModuleName,"PictCK", 0) != cksum) {
+ if (getDword(hContact, "PictCK", 0) != cksum) {
// Now save the new checksum. No rush requesting new avatar yet.
- db_set_dw(hContact, m_szModuleName, "PictCK", cksum);
+ setDword(hContact, "PictCK", cksum);
// Need to delete the Avatar File!!
TCHAR szFile[MAX_PATH];
@@ -499,7 +499,7 @@ void CYahooProto::ext_got_picture_update(const char *me, const char *who, int bu return;
}
- db_set_b(hContact, m_szModuleName, "AvatarType", buddy_icon);
+ setByte(hContact, "AvatarType", buddy_icon);
/* Last thing check the checksum and request new one if we need to */
reset_avatar(hContact);
@@ -517,7 +517,7 @@ void CYahooProto::ext_got_picture_status(const char *me, const char *who, int bu return;
}
- db_set_b(hContact, m_szModuleName, "AvatarType", buddy_icon);
+ setByte(hContact, "AvatarType", buddy_icon);
/* Last thing check the checksum and request new one if we need to */
reset_avatar(hContact);
@@ -540,7 +540,7 @@ void CYahooProto::ext_got_picture_upload(const char *me, const char *url,unsigne if (cksum != 0) {
LOG(("[ext_yahoo_got_picture_upload] Updating Checksum to: %d", cksum));
setDword("AvatarHash", cksum);
- db_unset(NULL, m_szModuleName, "TMPAvatarHash");
+ delSetting("TMPAvatarHash");
// This is only meant for message sessions, but we don't got those in miranda yet
//YAHOO_bcast_picture_checksum(cksum);
@@ -551,7 +551,7 @@ void CYahooProto::ext_got_picture_upload(const char *me, const char *url,unsigne }else
cksum = getDword("AvatarHash", 0);
- setString(NULL, "AvatarURL", url);
+ setString("AvatarURL", url);
//YAHOO_SetDword("AvatarExpires", ts);
if (!getString("AvatarInv", &dbv)) {
@@ -561,7 +561,7 @@ void CYahooProto::ext_got_picture_upload(const char *me, const char *url,unsigne //void yahoo_send_picture_info(int id, const char *me, const char *who, const char *pic_url, int cksum)
yahoo_send_picture_info(m_id, dbv.pszVal, 2, url, cksum);
- db_unset(NULL, m_szModuleName, "AvatarInv");
+ delSetting("AvatarInv");
db_free(&dbv);
}
}
@@ -582,39 +582,29 @@ void CYahooProto::reset_avatar(HANDLE hContact) void CYahooProto::request_avatar(const char* who)
{
- time_t last_chk, cur_time;
- HANDLE hContact = 0;
- //char szFile[MAX_PATH];
-
if (!getByte("ShowAvatars", 1 )) {
LOG(("Avatars disabled, but available for: %s", who));
return;
}
- hContact = getbuddyH(who);
+ HANDLE hContact = getbuddyH(who);
if (!hContact)
return;
- /*GetAvatarFileName(hContact, szFile, sizeof szFile, db_get_b(hContact, m_szModuleName,"AvatarType", 0));
- DeleteFile(szFile);*/
-
+ time_t cur_time;
time(&cur_time);
- last_chk = db_get_dw(hContact, m_szModuleName, "PictLastCheck", 0);
+ time_t last_chk = getDword(hContact, "PictLastCheck", 0);
/*
* time() - in seconds ( 60*60 = 1 hour)
*/
- if (db_get_dw(hContact, m_szModuleName,"PictCK", 0) == 0 ||
- last_chk == 0 || (cur_time - last_chk) > 60) {
-
- db_set_dw(hContact, m_szModuleName, "PictLastCheck", (DWORD)cur_time);
-
- LOG(("Requesting Avatar for: %s", who));
- yahoo_request_buddy_avatar(m_id, who);
- } else {
- LOG(("Avatar Not Available for: %s Last Check: %ld Current: %ld (Flood Check in Effect)", who, last_chk, cur_time));
+ if (getDword(hContact, "PictCK", 0) == 0 || last_chk == 0 || (cur_time - last_chk) > 60) {
+ setDword(hContact, "PictLastCheck", (DWORD)cur_time);
+ LOG(("Requesting Avatar for: %s", who));
+ yahoo_request_buddy_avatar(m_id, who);
}
+ else LOG(("Avatar Not Available for: %s Last Check: %ld Current: %ld (Flood Check in Effect)", who, last_chk, cur_time));
}
void CYahooProto::InitCustomFolders(void)
@@ -650,11 +640,10 @@ void CYahooProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, int cbLen, CreateDirectoryTreeT(pszDest);
if (hContact != NULL) {
- int ck_sum = db_get_dw(hContact, m_szModuleName,"PictCK", 0);
+ int ck_sum = getDword(hContact, "PictCK", 0);
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%lX"), ck_sum);
- } else {
- tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%S avatar"), m_szModuleName);
}
+ else tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%S avatar"), m_szModuleName);
mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("%s"), type == 1 ? _T(".swf") : _T(".png"));
}
@@ -678,7 +667,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) return GAIR_NOAVATAR;
}
- avtType = db_get_b(AI->hContact, m_szModuleName,"AvatarType", 0);
+ avtType = getByte(AI->hContact, "AvatarType", 0);
DebugLog("[YAHOO_GETAVATARINFO] Avatar Type: %d", avtType);
if ( avtType != 2) {
@@ -688,10 +677,10 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) return GAIR_NOAVATAR;
}
- if (db_get_dw(AI->hContact, m_szModuleName,"PictCK", 0) == 0)
+ if (getDword(AI->hContact, "PictCK", 0) == 0)
return GAIR_NOAVATAR;
- GetAvatarFileName(AI->hContact, AI->filename, SIZEOF(AI->filename), db_get_b(AI->hContact, m_szModuleName,"AvatarType", 0));
+ GetAvatarFileName(AI->hContact, AI->filename, SIZEOF(AI->filename), getByte(AI->hContact, "AvatarType", 0));
AI->format = PA_FORMAT_PNG;
DebugLog("[YAHOO_GETAVATARINFO] filename: %s", AI->filename);
@@ -799,7 +788,7 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) int ret = -3;
if (getDword("AvatarHash", 0)) {
- if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv)) {
+ if (!getTString("AvatarFile", &dbv)) {
if (_taccess(dbv.ptszVal, 0) == 0) {
lstrcpyn(buffer, dbv.ptszVal, size-1);
buffer[size-1] = '\0';
@@ -831,10 +820,10 @@ INT_PTR __cdecl CYahooProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) DebugLog("[Deleting Avatar Info]");
/* remove ALL our Avatar Info Keys */
- db_unset(NULL, m_szModuleName, "AvatarFile");
- db_unset(NULL, m_szModuleName, "AvatarHash");
- db_unset(NULL, m_szModuleName, "AvatarURL");
- db_unset(NULL, m_szModuleName, "AvatarTS");
+ delSetting("AvatarFile");
+ delSetting("AvatarHash");
+ delSetting("AvatarURL");
+ delSetting("AvatarTS");
/* Send a Yahoo packet saying we don't got an avatar anymore */
yahoo_send_picture_status(m_id, 0);
@@ -887,8 +876,8 @@ INT_PTR __cdecl CYahooProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) /* now check and make sure we don't reupload same thing over again */
if (hash != getDword("AvatarHash", 0)) {
- setTString(NULL, "AvatarFile", tszMyFile);
- db_set_dw(NULL, m_szModuleName, "TMPAvatarHash", hash);
+ setTString("AvatarFile", tszMyFile);
+ setDword("TMPAvatarHash", hash);
/* Set Sharing to ON if it's OFF */
if (getByte("ShareAvatar", 0) != 2) {
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index 6e463ff6af..4c74801976 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -44,7 +44,7 @@ static y_filetransfer* new_ft(CYahooProto* ppro, int id, HANDLE hContact, const ft->cancel = 0;
ft->y7 = y7;
- ft->hWaitEvent = CreateEvent( NULL, FALSE, FALSE, NULL);
+ ft->hWaitEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
ft->pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
ft->pfts.hContact = hContact;
@@ -177,11 +177,7 @@ static void upload_file(int id, int fd, int error, void *data) LOG(("proto: %s, hContact: %p", sf->ppro->m_szModuleName, sf->hContact));
LOG(("Sending file: %s", fi->filename));
- //ProtoBroadcastAck(sf->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, sf, 0);
- //ProtoBroadcastAck(sf->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, sf, 0);
ProtoBroadcastAck(sf->ppro->m_szModuleName, sf->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, sf, 0);
- //ProtoBroadcastAck(sf->hContact, ACKTYPE_FILE, ACKRESULT_SENTREQUEST, sf, 0);
- //ProtoBroadcastAck(sf->hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, sf, 0);
do {
ReadFile(myhFile, buf, sizeof(buf), &dw, NULL);
@@ -713,16 +709,6 @@ HANDLE __cdecl CYahooProto::SendFile( HANDLE hContact, const PROTOCHAR* szDescri if ( !m_bLoggedIn )
return 0;
- /*DebugLog("Getting Files");
-
- if ( ppszFiles[1] != NULL) {
- MessageBoxA(NULL, "YAHOO protocol allows only one file to be sent at a time", "Yahoo", MB_OK | MB_ICONINFORMATION);
- return 0;
- }
-
- DebugLog("Getting Yahoo ID");
- */
-
if (!getString(hContact, YAHOO_LOGINID, &dbv)) {
long tFileSize = 0;
struct _stat statbuf;
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index e2800095cf..0fb7aa160a 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -142,13 +142,11 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons if (buddy_icon < 0) return;
//?? Don't generate floods!!
- db_set_b(hContact, m_szModuleName, "AvatarType", (BYTE)buddy_icon);
- if (buddy_icon != 2) {
+ setByte(hContact, "AvatarType", (BYTE)buddy_icon);
+ if (buddy_icon != 2)
reset_avatar(hContact);
- } else if (db_get_dw(hContact, m_szModuleName,"PictCK", 0) == 0) {
- /* request the buddy image */
+ else if (getDword(hContact, "PictCK", 0) == 0) /* request the buddy image */
request_avatar(who);
- }
}
////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index d7f2e539ea..45d94c4177 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -27,128 +27,123 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv;
- CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
+ CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA );
switch ( msg ) {
case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
ppro = (CYahooProto*)lParam;
- SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam );
- if ( !ppro->getString( YAHOO_LOGINID, &dbv )) {
- SetDlgItemTextA(hwndDlg,IDC_HANDLE,dbv.pszVal);
+ if ( !ppro->getString( YAHOO_LOGINID, &dbv)) {
+ SetDlgItemTextA(hwndDlg, IDC_HANDLE, dbv.pszVal);
db_free(&dbv);
}
- if ( !ppro->getString("Nick", &dbv )) {
- SetDlgItemTextA(hwndDlg,IDC_NICK,dbv.pszVal);
+ if ( !ppro->getString("Nick", &dbv)) {
+ SetDlgItemTextA(hwndDlg, IDC_NICK, dbv.pszVal);
db_free(&dbv);
}
- if ( !ppro->getString( YAHOO_PASSWORD, &dbv )) {
+ if ( !ppro->getString( YAHOO_PASSWORD, &dbv)) {
//bit of a security hole here, since it's easy to extract a password from an edit box
CallService(MS_DB_CRYPT_DECODESTRING, strlen( dbv.pszVal )+1, (LPARAM)dbv.pszVal);
- SetDlgItemTextA( hwndDlg, IDC_PASSWORD, dbv.pszVal );
- db_free( &dbv );
+ SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal );
+ db_free(&dbv);
}
- //SetButtonCheck( hwndDlg, IDC_DISABLE_UTF8, ppro->getByte("DisableUTF8", 0));
- SetButtonCheck( hwndDlg, IDC_USE_YAB, ppro->getByte("UseYAB", 1 ));
- SetButtonCheck( hwndDlg, IDC_SHOW_AVATARS, ppro->getByte("ShowAvatars", 1 ));
- SetButtonCheck( hwndDlg, IDC_MAIL_AUTOLOGIN, ppro->getByte("MailAutoLogin", 1 ));
- SetButtonCheck( hwndDlg, IDC_DISABLEYAHOOMAIL, !ppro->getByte("DisableYahoomail", 0));
- SetButtonCheck( hwndDlg, IDC_SHOW_ERRORS, ppro->getByte("ShowErrors", 1 ));
+ //SetButtonCheck(hwndDlg, IDC_DISABLE_UTF8, ppro->getByte("DisableUTF8", 0));
+ SetButtonCheck(hwndDlg, IDC_USE_YAB, ppro->getByte("UseYAB", 1 ));
+ SetButtonCheck(hwndDlg, IDC_SHOW_AVATARS, ppro->getByte("ShowAvatars", 1 ));
+ SetButtonCheck(hwndDlg, IDC_MAIL_AUTOLOGIN, ppro->getByte("MailAutoLogin", 1 ));
+ SetButtonCheck(hwndDlg, IDC_DISABLEYAHOOMAIL, !ppro->getByte("DisableYahoomail", 0));
+ SetButtonCheck(hwndDlg, IDC_SHOW_ERRORS, ppro->getByte("ShowErrors", 1 ));
return TRUE;
case WM_COMMAND:
-
+
switch ( LOWORD( wParam )) {
- case IDC_NEWYAHOOACCOUNTLINK:
- CallService(MS_UTILS_OPENURL, 1,
+ case IDC_NEWYAHOOACCOUNTLINK:
+ CallService(MS_UTILS_OPENURL, 1,
ppro->getByte("YahooJapan", 0) ?
- (LPARAM)"http://edit.yahoo.co.jp/config/eval_register" :
- (LPARAM)"http://edit.yahoo.com/config/eval_register");
- return TRUE;
-
- //case IDC_DISABLE_UTF8:
+ (LPARAM)"http://edit.yahoo.co.jp/config/eval_register" :
+ (LPARAM)"http://edit.yahoo.com/config/eval_register");
+ return TRUE;
+
+ //case IDC_DISABLE_UTF8:
case IDC_USE_YAB:
case IDC_SHOW_AVATARS:
case IDC_MAIL_AUTOLOGIN:
case IDC_SHOW_ERRORS:
case IDC_DISABLEYAHOOMAIL:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
- if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus())
+ if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus())
switch( LOWORD( wParam )) {
case IDC_HANDLE:
case IDC_PASSWORD:
case IDC_NICK:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
+ }
break;
case WM_NOTIFY:
-
+
if (((LPNMHDR)lParam)->code == (UINT) PSN_APPLY ) {
BOOL reconnectRequired = FALSE;
char str[128];
- GetDlgItemTextA( hwndDlg, IDC_HANDLE, str, sizeof( str ));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, sizeof( str ));
dbv.pszVal = NULL;
-
- if ( ppro->getString( YAHOO_LOGINID, &dbv ) || lstrcmpA( str, dbv.pszVal ))
+
+ if ( ppro->getString( YAHOO_LOGINID, &dbv) || lstrcmpA( str, dbv.pszVal ))
reconnectRequired = TRUE;
-
+
if ( dbv.pszVal != NULL)
- db_free( &dbv );
-
+ db_free(&dbv);
+
ppro->setString( YAHOO_LOGINID, str );
- GetDlgItemTextA( hwndDlg, IDC_PASSWORD, str, sizeof( str ));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof( str ));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM)str);
dbv.pszVal = NULL;
- if ( ppro->getString( YAHOO_PASSWORD, &dbv ) || lstrcmpA( str, dbv.pszVal ))
+ if ( ppro->getString( YAHOO_PASSWORD, &dbv) || lstrcmpA( str, dbv.pszVal ))
reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- db_free( &dbv );
-
+ db_free(&dbv);
+
ppro->setString( YAHOO_PASSWORD, str );
- GetDlgItemTextA( hwndDlg, IDC_NICK, str, sizeof( str ));
-
-
+ GetDlgItemTextA(hwndDlg, IDC_NICK, str, sizeof( str ));
+
+
if (str[0] == '\0') {
/* Check for empty Nick, if so delete the key in the DB */
- db_unset( NULL, ppro->m_szModuleName, "Nick");
+ ppro->delSetting("Nick");
} else {
/* otherwise save the new Nick */
- ppro->setString("Nick", str );
+ ppro->setString("Nick", str);
}
- //ppro->setByte("DisableUTF8", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_DISABLE_UTF8 ));
- ppro->setByte("UseYAB", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_USE_YAB ));
- ppro->setByte("ShowAvatars", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_SHOW_AVATARS ));
- ppro->setByte("MailAutoLogin", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_MAIL_AUTOLOGIN ));
- ppro->setByte("DisableYahoomail", ( BYTE )!IsDlgButtonChecked( hwndDlg, IDC_DISABLEYAHOOMAIL ));
- ppro->setByte("ShowErrors", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_SHOW_ERRORS ));
+ ppro->setByte("UseYAB", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USE_YAB));
+ ppro->setByte("ShowAvatars", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_AVATARS));
+ ppro->setByte("MailAutoLogin", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MAIL_AUTOLOGIN));
+ ppro->setByte("DisableYahoomail", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_DISABLEYAHOOMAIL));
+ ppro->setByte("ShowErrors", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_ERRORS));
+
+ if (reconnectRequired)
+ ppro->delSetting(YAHOO_PWTOKEN);
- if (reconnectRequired ) {
- db_unset(NULL, ppro->m_szModuleName, YAHOO_PWTOKEN);
- }
-
- /*if ( restartRequired )
- MessageBoxA( hwndDlg, Translate("The changes you have made require you to restart Miranda NG before they take effect"), Translate("YAHOO Options"), MB_OK );
- else */
if ( reconnectRequired && ppro->m_bLoggedIn )
- MessageBoxA( hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK );
+ MessageBoxA(hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK );
return TRUE;
- }
-
+ }
+
break;
}
return FALSE;
@@ -160,39 +155,39 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv;
- CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
+ CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA );
switch ( msg ) {
case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg );
ppro = ( CYahooProto* )lParam;
- SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam );
- if ( !ppro->getString( YAHOO_LOGINSERVER, &dbv )) {
- SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, dbv.pszVal );
- db_free( &dbv );
+ if ( !ppro->getString( YAHOO_LOGINSERVER, &dbv)) {
+ SetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, dbv.pszVal );
+ db_free(&dbv);
}
- else SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER,
+ else SetDlgItemTextA(hwndDlg, IDC_LOGINSERVER,
ppro->getByte("YahooJapan", 0)
- ? YAHOO_DEFAULT_JAPAN_LOGIN_SERVER
+ ? YAHOO_DEFAULT_JAPAN_LOGIN_SERVER
: YAHOO_DEFAULT_LOGIN_SERVER );
- SetDlgItemInt( hwndDlg, IDC_YAHOOPORT, ppro->getWord( NULL, YAHOO_LOGINPORT, YAHOO_DEFAULT_PORT ), FALSE );
+ SetDlgItemInt(hwndDlg, IDC_YAHOOPORT, ppro->getWord(YAHOO_LOGINPORT, YAHOO_DEFAULT_PORT), FALSE);
- SetButtonCheck( hwndDlg, IDC_YAHOO_JAPAN, ppro->getByte("YahooJapan", 0));
+ SetButtonCheck(hwndDlg, IDC_YAHOO_JAPAN, ppro->getByte("YahooJapan", 0));
return TRUE;
case WM_COMMAND:
switch ( LOWORD( wParam )) {
case IDC_RESETSERVER:
- SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, YAHOO_DEFAULT_LOGIN_SERVER );
+ SetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, YAHOO_DEFAULT_LOGIN_SERVER );
SetDlgItemInt( hwndDlg, IDC_YAHOOPORT, YAHOO_DEFAULT_PORT, FALSE );
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_YAHOO_JAPAN:
- SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER,
+ SetDlgItemTextA(hwndDlg, IDC_LOGINSERVER,
(IsDlgButtonChecked(hwndDlg,IDC_YAHOO_JAPAN)==BST_CHECKED) ?
YAHOO_DEFAULT_JAPAN_LOGIN_SERVER :
YAHOO_DEFAULT_LOGIN_SERVER );
@@ -214,34 +209,29 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY )
{
- BOOL reconnectRequired = FALSE/*, restartRequired = FALSE*/;
- char str[128];
- DBVARIANT dbv;
- int port;
-
- GetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, str, sizeof( str ));
+ BOOL reconnectRequired = FALSE;
+ char str[128];
+ GetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, str, sizeof( str ));
- if ( ppro->getString( YAHOO_LOGINSERVER, &dbv ) || lstrcmpA( str, dbv.pszVal ))
+ DBVARIANT dbv;
+ if ( ppro->getString( YAHOO_LOGINSERVER, &dbv) || lstrcmpA( str, dbv.pszVal ))
reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- db_free( &dbv );
+ db_free(&dbv);
- ppro->setString( YAHOO_LOGINSERVER, str );
+ ppro->setString(YAHOO_LOGINSERVER, str);
- port = GetDlgItemInt( hwndDlg, IDC_YAHOOPORT, NULL, FALSE );
- if ( ppro->getWord(NULL, YAHOO_LOGINPORT, -1) != port)
+ int port = GetDlgItemInt(hwndDlg, IDC_YAHOOPORT, NULL, FALSE );
+ if ( ppro->getWord(YAHOO_LOGINPORT, -1) != port)
reconnectRequired = TRUE;
- ppro->setWord( NULL, YAHOO_LOGINPORT, port);
+ ppro->setWord(YAHOO_LOGINPORT, port);
- ppro->setByte("YahooJapan", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_YAHOO_JAPAN ));
+ ppro->setByte("YahooJapan", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN ));
- /*if ( restartRequired )
- MessageBoxA( hwndDlg, Translate("The changes you have made require you to restart Miranda NG before they take effect"), Translate("YAHOO Options"), MB_OK );
- else */
if ( reconnectRequired && ppro->m_bLoggedIn )
- MessageBoxA( hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK );
+ MessageBoxA(hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK );
return TRUE;
}
@@ -256,14 +246,14 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
YList *l;
- CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
+ CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA );
switch ( msg ) {
case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg );
ppro = ( CYahooProto* )lParam;
- SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam );
if ( ppro->getByte("IgnoreUnknown", 0)) {
CheckDlgButton(hwndDlg, IDC_OPT_IGN_UNKNOWN, 1);
@@ -308,7 +298,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP MessageBoxA(hwndDlg, Translate("You need to be connected to Yahoo to add to Ignore List."), Translate("Yahoo Ignore"), MB_OK| MB_ICONINFORMATION);
else {
char id[128];
- int i = GetDlgItemTextA( hwndDlg, IDC_YIGN_EDIT, id, sizeof( id ));
+ int i = GetDlgItemTextA(hwndDlg, IDC_YIGN_EDIT, id, sizeof( id ));
if (i < 3) {
MessageBoxA(hwndDlg, Translate("Please enter a valid buddy name to ignore."), Translate("Yahoo Ignore"), MB_OK| MB_ICONINFORMATION);
@@ -322,7 +312,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP }
ppro->IgnoreBuddy(id, 0);
SendMessageA(GetDlgItem(hwndDlg,IDC_YIGN_LIST), LB_ADDSTRING, 0, (LPARAM)id);
- SetDlgItemTextA( hwndDlg, IDC_YIGN_EDIT, "");
+ SetDlgItemTextA(hwndDlg, IDC_YIGN_EDIT, "");
}
break;
@@ -352,7 +342,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
- ppro->setByte("IgnoreUnknown", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_OPT_IGN_UNKNOWN ));
+ ppro->setByte("IgnoreUnknown", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OPT_IGN_UNKNOWN ));
return TRUE;
}
break;
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index fee84eaccd..4849eb034a 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -206,9 +206,9 @@ int CYahooProto::Authorize( HANDLE hdbe ) /* Need to remove the buddy from our Miranda Lists */
HANDLE hContact = DbGetAuthEventContact(&dbei);
if (hContact != NULL) {
- ptrA who( db_get_sa(hContact, m_szModuleName, YAHOO_LOGINID));
+ ptrA who( getStringA(hContact, YAHOO_LOGINID));
if (who) {
- ptrA myid( db_get_sa(hContact, m_szModuleName, "MyIdentity"));
+ ptrA myid( getStringA(hContact, "MyIdentity"));
DebugLog("Accepting buddy:%s", who);
accept(myid, who, getWord(hContact, "yprotoid", 0));
}
@@ -251,9 +251,9 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) /* Need to remove the buddy from our Miranda Lists */
HANDLE hContact = DbGetAuthEventContact(&dbei);
if (hContact != NULL) {
- ptrA who( db_get_sa(hContact, m_szModuleName, YAHOO_LOGINID));
+ ptrA who( getStringA(hContact, YAHOO_LOGINID));
if (who) {
- ptrA myid( db_get_sa(hContact, m_szModuleName, "MyIdentity"));
+ ptrA myid( getStringA(hContact, "MyIdentity"));
ptrA u_reason( mir_utf8encodeT(reason));
DebugLog("Rejecting buddy:%s msg: %s", who, u_reason);
@@ -493,7 +493,6 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) db_free(&dbv);
}
- //db_get_w(NULL, m_szModuleName, "StartupStatus", status);
m_startStatus = iNewStatus;
//reset the unread email count. We'll get a new packet since we are connecting.
@@ -533,18 +532,18 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact) /* Check Yahoo Games Message */
if (!getString(hContact, "YGMsg", &dbv)) {
gm = strdup(dbv.pszVal);
-
- db_free( &dbv );
+ db_free(&dbv);
}
- if (! db_get_s(hContact, "CList", "StatusMsg", &dbv )) {
+ if (! db_get_s(hContact, "CList", "StatusMsg", &dbv)) {
if (lstrlenA(dbv.pszVal) >= 1)
sm = strdup(dbv.pszVal);
- db_free( &dbv );
- } else {
- WORD status = getWord(hContact, "YStatus", YAHOO_STATUS_OFFLINE);
- sm = yahoo_status_code( yahoo_status( status ));
+ db_free(&dbv);
+ }
+ else {
+ int status = getWord(hContact, "YStatus", (WORD)YAHOO_STATUS_OFFLINE);
+ sm = yahoo_status_code( yahoo_status(status));
if (sm) sm = strdup(sm); /* we need this to go global FREE later */
}
@@ -754,7 +753,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM db_free(&dbv);
}
- SetButtonCheck( hwndDlg, IDC_YAHOO_JAPAN, ppro->getByte("YahooJapan", 0));
+ SetButtonCheck(hwndDlg, IDC_YAHOO_JAPAN, ppro->getByte("YahooJapan", 0));
return TRUE;
}
@@ -762,7 +761,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if ( LOWORD( wParam ) == IDC_NEWYAHOOACCOUNTLINK ) {
CallService(MS_UTILS_OPENURL,
1,
- (( BYTE )IsDlgButtonChecked( hwndDlg, IDC_YAHOO_JAPAN ) == 1) ?
+ ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN ) == 1) ?
(LPARAM) "http://edit.yahoo.co.jp/config/eval_register" :
(LPARAM) "http://edit.yahoo.com/config/eval_register"
);
@@ -792,31 +791,30 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM dbv.pszVal = NULL;
- if ( ppro->getString( YAHOO_LOGINID, &dbv ) || lstrcmpA( str, dbv.pszVal ))
+ if (ppro->getString( YAHOO_LOGINID, &dbv) || lstrcmpA(str, dbv.pszVal))
reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- db_free( &dbv );
+ db_free(&dbv);
ppro->setString(YAHOO_LOGINID, str);
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str));
dbv.pszVal = NULL;
- if ( ppro->getString( YAHOO_PASSWORD, &dbv ) || lstrcmpA( str, dbv.pszVal ))
+ if (ppro->getString( YAHOO_PASSWORD, &dbv) || lstrcmpA(str, dbv.pszVal))
reconnectRequired = TRUE;
- if ( dbv.pszVal != NULL)
- db_free( &dbv );
+ if (dbv.pszVal != NULL)
+ db_free(&dbv);
- if (reconnectRequired ) {
- db_unset(NULL, ppro->m_szModuleName, YAHOO_PWTOKEN);
- }
+ if (reconnectRequired)
+ ppro->delSetting(YAHOO_PWTOKEN);
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM) str);
ppro->setString(YAHOO_PASSWORD, str);
- ppro->setByte("YahooJapan", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_YAHOO_JAPAN ));
+ ppro->setByte("YahooJapan", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN ));
if ( reconnectRequired && ppro->m_bLoggedIn )
- MessageBoxA( hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK );
+ MessageBoxA(hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK );
return TRUE;
}
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index b78d380f05..2a69c8ee9f 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -36,8 +36,8 @@ void CYahooProto::logoff_buddies() setDword(hContact, "PictLastCheck", 0);
setDword(hContact, "PictLoading", 0);
db_unset(hContact, "CList", "StatusMsg");
- db_unset(hContact, m_szModuleName, "YMsg");
- db_unset(hContact, m_szModuleName, "YGMsg");
+ delSetting(hContact, "YMsg");
+ delSetting(hContact, "YGMsg");
}
}
@@ -101,7 +101,7 @@ int __cdecl CYahooProto::OnContactDeleted( WPARAM wParam, LPARAM lParam ) DebugLog("[YahooContactDeleted] Removing %s", dbv.pszVal);
remove_buddy(dbv.pszVal, getWord(hContact, "yprotoid", 0));
- db_free( &dbv );
+ db_free(&dbv);
} else {
DebugLog("[YahooContactDeleted] Can't retrieve contact Yahoo ID");
}
@@ -117,26 +117,26 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam switch (msg) {
case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg );
{
- CYahooProto* ppro = ( CYahooProto* )lParam;
- SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );
+ CYahooProto* ppro = (CYahooProto*)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam );
- SendMessage( hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)ppro->LoadIconEx("yahoo", true ));
- SendMessage( hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)ppro->LoadIconEx("yahoo"));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)ppro->LoadIconEx("yahoo", true ));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)ppro->LoadIconEx("yahoo"));
- if ( !db_get_s( NULL, ppro->m_szModuleName, YAHOO_CUSTSTATDB, &dbv )) {
- SetDlgItemTextA( hwndDlg, IDC_CUSTSTAT, dbv. pszVal );
+ if ( !ppro->getString(YAHOO_CUSTSTATDB, &dbv)) {
+ SetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, dbv. pszVal );
- EnableWindow( GetDlgItem( hwndDlg, IDOK ), lstrlenA(dbv.pszVal) > 0);
- db_free( &dbv );
+ EnableWindow( GetDlgItem(hwndDlg, IDOK ), lstrlenA(dbv.pszVal) > 0);
+ db_free(&dbv);
}
else {
- SetDlgItemTextA( hwndDlg, IDC_CUSTSTAT, "");
- EnableWindow( GetDlgItem( hwndDlg, IDOK ), FALSE );
+ SetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, "");
+ EnableWindow( GetDlgItem(hwndDlg, IDOK ), FALSE );
}
- CheckDlgButton( hwndDlg, IDC_CUSTSTATBUSY, ppro->getByte("BusyCustStat", 0));
+ CheckDlgButton(hwndDlg, IDC_CUSTSTATBUSY, ppro->getByte("BusyCustStat", 0));
}
return TRUE;
@@ -145,27 +145,27 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam case IDOK:
{
char str[ 255 + 1 ];
- CYahooProto* ppro = ( CYahooProto* )GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
+ CYahooProto* ppro = ( CYahooProto* )GetWindowLongPtr(hwndDlg, GWLP_USERDATA );
/* Get String from dialog */
- GetDlgItemTextA( hwndDlg, IDC_CUSTSTAT, str, sizeof( str ));
+ GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, sizeof( str ));
/* Save it for later use */
ppro->setString( YAHOO_CUSTSTATDB, str );
- ppro->setByte("BusyCustStat", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_CUSTSTATBUSY ));
+ ppro->setByte("BusyCustStat", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CUSTSTATBUSY ));
/* set for Idle/AA */
if (ppro->m_startMsg) mir_free(ppro->m_startMsg);
ppro->m_startMsg = mir_strdup(str);
/* notify Server about status change */
- ppro->set_status(YAHOO_CUSTOM_STATUS, str, ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_CUSTSTATBUSY ));
+ ppro->set_status(YAHOO_CUSTOM_STATUS, str, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CUSTSTATBUSY ));
/* change local/miranda status */
- ppro->BroadcastStatus(( BYTE )IsDlgButtonChecked( hwndDlg, IDC_CUSTSTATBUSY ) ? ID_STATUS_AWAY : ID_STATUS_ONLINE);
+ ppro->BroadcastStatus((BYTE)IsDlgButtonChecked(hwndDlg, IDC_CUSTSTATBUSY ) ? ID_STATUS_AWAY : ID_STATUS_ONLINE);
}
case IDCANCEL:
- DestroyWindow( hwndDlg );
+ DestroyWindow(hwndDlg );
break;
}
@@ -175,20 +175,20 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam BOOL toSet;
- toSet = GetDlgItemTextA( hwndDlg, IDC_CUSTSTAT, str, sizeof( str )) != 0;
+ toSet = GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, sizeof( str )) != 0;
- EnableWindow( GetDlgItem( hwndDlg, IDOK ), toSet );
+ EnableWindow( GetDlgItem(hwndDlg, IDOK ), toSet );
}
}
break; /* case WM_COMMAND */
case WM_CLOSE:
- DestroyWindow( hwndDlg );
+ DestroyWindow(hwndDlg );
break;
case WM_DESTROY:
{
- CYahooProto* ppro = ( CYahooProto* )GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
+ CYahooProto* ppro = ( CYahooProto* )GetWindowLongPtr(hwndDlg, GWLP_USERDATA );
ppro->ReleaseIconEx("yahoo", true);
ppro->ReleaseIconEx("yahoo");
}
@@ -261,7 +261,7 @@ INT_PTR __cdecl CYahooProto::OnShowProfileCommand( WPARAM wParam, LPARAM lParam return 0;
_snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal );
- db_free( &dbv );
+ db_free(&dbv);
OpenURL(tUrl, 0);
return 0;
@@ -280,14 +280,14 @@ INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand( WPARAM wParam, LPARAM lPara {
DBVARIANT dbv;
- if ( getString( YAHOO_LOGINID, &dbv ) != 0) {
+ if ( getString( YAHOO_LOGINID, &dbv) != 0) {
ShowError( TranslateT("Yahoo Error"), TranslateT("Please enter your yahoo id in Options/Network/Yahoo"));
return 0;
}
char tUrl[ 4096 ];
_snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal );
- db_free( &dbv );
+ db_free(&dbv);
OpenURL(tUrl, 0);
return 0;
diff --git a/protocols/Yahoo/src/user_info.cpp b/protocols/Yahoo/src/user_info.cpp index 4f3bc291b3..9aba43ac7a 100644 --- a/protocols/Yahoo/src/user_info.cpp +++ b/protocols/Yahoo/src/user_info.cpp @@ -26,7 +26,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa switch ( msg ) {
case WM_INITDIALOG:
// lParam is hContact
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg );
//SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_USERDETAILS));
@@ -62,27 +62,27 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa DBVARIANT dbv;
char z[128];
- if (ppro->getString( hContact, YAHOO_LOGINID, &dbv ) == 0) {
+ if (ppro->getString( hContact, YAHOO_LOGINID, &dbv) == 0) {
strcpy(z, dbv.pszVal);
- db_free( &dbv );
+ db_free(&dbv);
} else {
strcpy(z, "???");
}
SetDlgItemTextA(hwndDlg, IDC_SEARCH_ID, z);
- if (ppro->getString( hContact, "Transport", &dbv ) == 0) {
+ if (ppro->getString( hContact, "Transport", &dbv) == 0) {
strcpy(z, dbv.pszVal);
- db_free( &dbv );
+ db_free(&dbv);
} else {
strcpy(z, "Yahoo");
}
SetDlgItemTextA(hwndDlg, IDC_SEARCH_PROTOCOL, z);
- if (ppro->getString( hContact, "MirVer", &dbv ) == 0) {
+ if (ppro->getString( hContact, "MirVer", &dbv) == 0) {
strcpy(z, dbv.pszVal);
- db_free( &dbv );
+ db_free(&dbv);
} else {
strcpy(z, "???");
}
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index e67eb052ef..4191ab03c1 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -196,7 +196,7 @@ void CYahooProto::remove_buddy(const char *who, int protocol) }
yahoo_remove_buddy(m_id, who, protocol, dbv.pszVal);
- db_free( &dbv );
+ db_free(&dbv);
}
void CYahooProto::sendtyping(const char *who, int protocol, int stat)
@@ -290,7 +290,7 @@ HANDLE CYahooProto::getbuddyH(const char *yahoo_id) continue;
int tCompareResult = lstrcmpiA( dbv.pszVal, yahoo_id );
- db_free( &dbv );
+ db_free(&dbv);
if ( tCompareResult )
continue;
@@ -349,7 +349,7 @@ const char* CYahooProto::find_buddy( const char *yahoo_id) return NULL;
strncpy(nick, dbv.pszVal, 128);
- db_free( &dbv );
+ db_free(&dbv);
return nick;
}
@@ -400,7 +400,7 @@ void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, co /*
* Delete the IdleTS if the user went offline
*/
- db_unset(hContact, m_szModuleName, "IdleTS");
+ delSetting(hContact, "IdleTS");
}
else {
time_t idlets = 0;
@@ -414,7 +414,7 @@ void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, co }
}
- db_set_dw(hContact, m_szModuleName, "IdleTS", idlets);
+ setDword(hContact, "IdleTS", idlets);
}
YAHOO_DEBUGLOG("[ext_status_changed] exiting");
@@ -519,30 +519,28 @@ void CYahooProto::ext_status_logon(const char *who, int protocol, int stat, cons if (s != NULL)
setString( hContact, "MirVer", s);
else
- db_unset( hContact, m_szModuleName, "MirVer");
-
- } else {
- Set_Protocol(hContact, protocol);
+ delSetting(hContact, "MirVer");
}
+ else Set_Protocol(hContact, protocol);
/* Add the client_Version # to the contact DB entry */
- db_set_dw( hContact, m_szModuleName, "ClientVersion", client_version);
+ setDword( hContact, "ClientVersion", client_version);
/* Last thing check the checksum and request new one if we need to */
if (buddy_icon == -1) {
YAHOO_DEBUGLOG("[ext_status_logon] No avatar information in this packet? Not touching stuff!");
} else {
// we got some avatartype info
- db_set_b(hContact, m_szModuleName, "AvatarType", buddy_icon);
+ setByte(hContact, "AvatarType", buddy_icon);
if (cksum == 0 || cksum == -1) {
// no avatar
- db_set_dw(hContact, m_szModuleName, "PictCK", 0);
- } else if (db_get_dw(hContact, m_szModuleName,"PictCK", 0) != (unsigned)cksum) {
+ setDword(hContact, "PictCK", 0);
+ } else if (getDword(hContact, "PictCK", 0) != (unsigned)cksum) {
//char szFile[MAX_PATH];
// Save new Checksum
- db_set_dw(hContact, m_szModuleName, "PictCK", cksum);
+ setDword(hContact, "PictCK", cksum);
// Need to delete the Avatar File!!
//GetAvatarFileName(hContact, szFile, sizeof szFile, 0);
@@ -629,10 +627,10 @@ void CYahooProto::ext_got_stealth(char *stealthlist) //LOG(("Resetting STEALTH for id = %s", dbv.pszVal));
/* need to delete the ApparentMode thingy */
if (getWord(hContact, "ApparentMode", 0))
- db_unset(hContact, m_szModuleName, "ApparentMode");
+ delSetting(hContact, "ApparentMode");
}
- db_free( &dbv );
+ db_free(&dbv);
}
}
@@ -677,7 +675,7 @@ void CYahooProto::ext_got_buddies(YList * buds) //LOG(("Resetting STEALTH for id = %s", dbv.pszVal));
/* need to delete the ApparentMode thingy */
if (getWord(hContact, "ApparentMode", 0))
- db_unset(hContact, m_szModuleName, "ApparentMode");
+ delSetting(hContact, "ApparentMode");
}
//if (bud->auth)
@@ -814,7 +812,7 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha if (strcmp(myid, m_yahoo_id))
setString(hContact, "MyIdentity", myid);
else
- db_unset(hContact, m_szModuleName, "MyIdentity");
+ delSetting(hContact, "MyIdentity");
//setWord(hContact, "yprotoid", protocol);
Set_Protocol(hContact, protocol);
@@ -1151,7 +1149,7 @@ void CYahooProto::ext_login_response(int succ, const char *url) }
else mir_sntprintf(buff, SIZEOF(buff), TranslateT("Could not log in, unknown reason: %d."), succ);
- db_unset(NULL, m_szModuleName, YAHOO_PWTOKEN);
+ delSetting(YAHOO_PWTOKEN);
YAHOO_DEBUGLOG("ERROR: %s", buff);
|