From d5d50b471277d5d69f59a8f29bf87201149ce191 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Jul 2013 22:02:18 +0000 Subject: applied protocol helpers git-svn-id: http://svn.miranda-ng.org/main/trunk@5305 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Yahoo/src/avatar.cpp | 78 ++++++++++++++++---------------- protocols/Yahoo/src/chat.cpp | 6 +-- protocols/Yahoo/src/file_transfer.cpp | 2 +- protocols/Yahoo/src/im.cpp | 14 +++--- protocols/Yahoo/src/options.cpp | 64 +++++++++++++------------- protocols/Yahoo/src/proto.cpp | 40 ++++++++--------- protocols/Yahoo/src/proto.h | 19 -------- protocols/Yahoo/src/services.cpp | 30 ++++++------- protocols/Yahoo/src/user_info.cpp | 6 +-- protocols/Yahoo/src/util.cpp | 84 +++-------------------------------- protocols/Yahoo/src/yahoo.cpp | 78 ++++++++++++++++---------------- 11 files changed, 165 insertions(+), 256 deletions(-) (limited to 'protocols/Yahoo') diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 5aa80eb389..b76e4c4de2 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -111,14 +111,14 @@ void __cdecl CYahooProto::send_avt_thread(void *psf) return; } - SetByte("AvatarUL", 1); + setByte("AvatarUL", 1); yahoo_send_avatar(m_id, sf->filename, sf->filesize, &upload_avt, sf); free(sf->filename); free(sf); - if (GetByte("AvatarUL", 1) == 1) - SetByte("AvatarUL", 0); + if (getByte("AvatarUL", 1) == 1) + setByte("AvatarUL", 0); } void CYahooProto::SendAvatar(const TCHAR *szFile) @@ -178,8 +178,8 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) LOG(("ERROR: Can't find buddy: %s", avt->who)); error = 1; } else if (!error) { - SetDword(hContact, "PictCK", avt->cksum); - SetDword(hContact, "PictLoading", 1); + setDword(hContact, "PictCK", avt->cksum); + setDword(hContact, "PictLoading", 1); } if (!error) { @@ -221,7 +221,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) WriteFile(myhFile, nlhrReply->pData, nlhrReply->dataLength, &c, NULL); CloseHandle(myhFile); - SetDword(hContact, "PictLastCheck", 0); + setDword(hContact, "PictLastCheck", 0); } else { LOG(("Can not open file for writing: %s", buf)); error = 1; @@ -231,12 +231,12 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) } } - if (GetDword(hContact, "PictCK", 0) != avt->cksum) { + if (getDword(hContact, "PictCK", 0) != avt->cksum) { LOG(("WARNING: Checksum updated during download?!")); error = 1; /* don't use this one? */ } - SetDword(hContact, "PictLoading", 0); + setDword(hContact, "PictLoading", 0); LOG(("File download complete!?")); if (error) @@ -252,7 +252,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) _tcsncpy(AI.filename, buf, SIZEOF(AI.filename)); if (error) - SetDword(hContact, "PictCK", 0); + setDword(hContact, "PictCK", 0); ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, !error ? ACKRESULT_SUCCESS:ACKRESULT_FAILED,(HANDLE) &AI, 0); } @@ -277,7 +277,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p DBVARIANT dbv; /* need to send avatar info */ - if (!GetByte("ShowAvatars", 1 )) { + if (!getByte("ShowAvatars", 1 )) { LOG(("[ext_yahoo_got_picture] We are not using/showing avatars!")); yahoo_send_picture_update(m_id, who, 0); // no avatar (disabled) return; @@ -285,9 +285,9 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] Getting ready to send info!")); /* need to read CheckSum */ - cksum = GetDword("AvatarHash", 0); + cksum = getDword("AvatarHash", 0); if (cksum) { - if (!GetString("AvatarURL", &dbv)) { + if (!getString("AvatarURL", &dbv)) { LOG(("[ext_yahoo_got_picture] Sending url: %s checksum: %d to '%s'!", dbv.pszVal, cksum, who)); //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, who, 2, dbv.pszVal, cksum); @@ -299,7 +299,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p /* * Try to re-upload the avatar */ - if (GetByte("AvatarUL", 0) != 1) { + if (getByte("AvatarUL", 0) != 1) { // NO avatar URL?? if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv)) { struct _stat statbuf; @@ -323,7 +323,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p case 2: /* * We got Avatar Info for our buddy. */ - if (!GetByte("ShowAvatars", 1 )) { + if (!getByte("ShowAvatars", 1 )) { LOG(("[ext_yahoo_got_picture] We are not using/showing avatars!")); return; } @@ -380,7 +380,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p DBVARIANT dbv; /* need to send avatar info */ - if (!GetByte("ShowAvatars", 1 )) { + if (!getByte("ShowAvatars", 1 )) { LOG(("[ext_yahoo_got_picture] We are not using/showing avatars!")); yahoo_send_picture_update(m_id, who, 0); // no avatar (disabled) return; @@ -388,7 +388,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] Getting ready to send info!")); /* need to read CheckSum */ - mcksum = GetDword("AvatarHash", 0); + mcksum = getDword("AvatarHash", 0); if (mcksum == 0) { /* this should NEVER Happen??? */ LOG(("[ext_yahoo_got_picture] No personal checksum? and Invalidate?!")); @@ -398,7 +398,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] My Checksum: %d", mcksum)); - if (!GetString("AvatarURL", &dbv)) { + if (!getString("AvatarURL", &dbv)) { if (lstrcmpiA(pic_url, dbv.pszVal) == 0) { DBVARIANT dbv2; /*time_t ts; @@ -408,7 +408,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] WARNING: Checksums don't match!")); /*time(&ts); - ae = GetDword("AvatarExpires", 0); + ae = getDword("AvatarExpires", 0); if (ae != 0 && ae > (ts - 300)) { LOG(("[ext_yahoo_got_picture] Current Time: %lu Expires: %lu ", ts, ae)); @@ -481,7 +481,7 @@ void CYahooProto::ext_got_picture_checksum(const char *me, const char *who, int // Request new avatar here... (might also want to check the sharing status?) - if (GetByte("ShareAvatar", 0) == 2) + if (getByte("ShareAvatar", 0) == 2) request_avatar(who); } } @@ -536,10 +536,10 @@ void CYahooProto::ext_got_picture_upload(const char *me, const char *url,unsigne } - cksum = GetDword("TMPAvatarHash", 0); + cksum = getDword("TMPAvatarHash", 0); if (cksum != 0) { LOG(("[ext_yahoo_got_picture_upload] Updating Checksum to: %d", cksum)); - SetDword("AvatarHash", cksum); + setDword("AvatarHash", cksum); db_unset(NULL, m_szModuleName, "TMPAvatarHash"); // This is only meant for message sessions, but we don't got those in miranda yet @@ -549,12 +549,12 @@ void CYahooProto::ext_got_picture_upload(const char *me, const char *url,unsigne // need to tell the stupid Yahoo that our icon updated //YAHOO_bcast_picture_update(2); }else - cksum = GetDword("AvatarHash", 0); + cksum = getDword("AvatarHash", 0); - SetString(NULL, "AvatarURL", url); + setString(NULL, "AvatarURL", url); //YAHOO_SetDword("AvatarExpires", ts); - if (!GetString("AvatarInv", &dbv)) { + if (!getString("AvatarInv", &dbv)) { LOG(("[ext_yahoo_got_picture_upload] Buddy: %s told us this is bad??", dbv.pszVal)); LOG(("[ext_yahoo_got_picture] Sending url: %s checksum: %d to '%s'!", url, cksum, dbv.pszVal)); @@ -570,7 +570,7 @@ void CYahooProto::ext_got_avatar_share(int buddy_icon) { LOG(("[ext_yahoo_got_avatar_share] buddy icon: %d", buddy_icon)); - SetByte("ShareAvatar", buddy_icon ); + setByte("ShareAvatar", buddy_icon ); } void CYahooProto::reset_avatar(HANDLE hContact) @@ -586,7 +586,7 @@ void CYahooProto::request_avatar(const char* who) HANDLE hContact = 0; //char szFile[MAX_PATH]; - if (!GetByte("ShowAvatars", 1 )) { + if (!getByte("ShowAvatars", 1 )) { LOG(("Avatars disabled, but available for: %s", who)); return; } @@ -665,14 +665,14 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) DBVARIANT dbv; int avtType; - if (!GetString(AI->hContact, YAHOO_LOGINID, &dbv)) { + if (!getString(AI->hContact, YAHOO_LOGINID, &dbv)) { DebugLog("[YAHOO_GETAVATARINFO] For: %s", dbv.pszVal); db_free(&dbv); }else { DebugLog("[YAHOO_GETAVATARINFO]"); } - if (!GetByte("ShowAvatars", 1 ) || !m_bLoggedIn) { + if (!getByte("ShowAvatars", 1 ) || !m_bLoggedIn) { DebugLog("[YAHOO_GETAVATARINFO] %s", m_bLoggedIn ? "We are not using/showing avatars!" : "We are not logged in. Can't load avatars now!"); return GAIR_NOAVATAR; @@ -700,14 +700,14 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) if (( wParam & GAIF_FORCE ) != 0 && AI->hContact != NULL) { /* need to request it again? */ - if (GetDword(AI->hContact, "PictLoading", 0) != 0 && - (time(NULL) - GetDword(AI->hContact, "PictLastCheck", 0) < 500)) { + if (getDword(AI->hContact, "PictLoading", 0) != 0 && + (time(NULL) - getDword(AI->hContact, "PictLastCheck", 0) < 500)) { DebugLog("[YAHOO_GETAVATARINFO] Waiting for avatar to load!"); return GAIR_WAITFOR; } else if ( m_bLoggedIn ) { DBVARIANT dbv; - if (!GetString(AI->hContact, YAHOO_LOGINID, &dbv)) { + if (!getString(AI->hContact, YAHOO_LOGINID, &dbv)) { DebugLog("[YAHOO_GETAVATARINFO] Requesting avatar!"); request_avatar(dbv.pszVal); @@ -754,7 +754,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam) case AF_ENABLED: LOG(("[YahooGetAvatarCaps] AF_ENABLED")); - res = (GetByte("ShowAvatars", 1 )) ? 1 : 0; + res = (getByte("ShowAvatars", 1 )) ? 1 : 0; break; case AF_DONTNEEDDELAYS: @@ -792,13 +792,13 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) if (buffer == NULL || size <= 0) return -1; - if (!GetByte("ShowAvatars", 1 )) + if (!getByte("ShowAvatars", 1 )) return -2; DBVARIANT dbv; int ret = -3; - if (GetDword("AvatarHash", 0)) { + if (getDword("AvatarHash", 0)) { if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv)) { if (_taccess(dbv.ptszVal, 0) == 0) { lstrcpyn(buffer, dbv.ptszVal, size-1); @@ -839,7 +839,7 @@ INT_PTR __cdecl CYahooProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) /* Send a Yahoo packet saying we don't got an avatar anymore */ yahoo_send_picture_status(m_id, 0); - SetByte("ShareAvatar",0); + setByte("ShareAvatar",0); DeleteFile(tszMyFile); } else { @@ -886,13 +886,13 @@ INT_PTR __cdecl CYahooProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) LOG(("[YAHOO_SetAvatar] File: '%s' CK: %d", tszMyFile, hash)); /* now check and make sure we don't reupload same thing over again */ - if (hash != GetDword("AvatarHash", 0)) { - SetStringT(NULL, "AvatarFile", tszMyFile); + if (hash != getDword("AvatarHash", 0)) { + setTString(NULL, "AvatarFile", tszMyFile); db_set_dw(NULL, m_szModuleName, "TMPAvatarHash", hash); /* Set Sharing to ON if it's OFF */ - if (GetByte("ShareAvatar", 0) != 2) { - SetByte("ShareAvatar", 2 ); + if (getByte("ShareAvatar", 0) != 2) { + setByte("ShareAvatar", 2 ); yahoo_send_picture_status(m_id, 2); } diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index 638d669de7..11eb0e44f8 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -440,7 +440,7 @@ static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, YList* &who, cha else { DBVARIANT dbv; - if (!ppro->GetString(hItem, YAHOO_LOGINID, &dbv)) + if (!ppro->getString(hItem, YAHOO_LOGINID, &dbv)) who = y_list_append(who, dbv.pszVal); } } @@ -469,8 +469,8 @@ static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, YList* &who, cha static void ClistValidateContact(HANDLE hItem, HWND hwndList, CYahooProto* ppro) { - if (!ppro->IsMyContact(hItem) || ppro->GetByte(hItem, "ChatRoom", 0) || - ppro->GetWord(hItem, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE) + if (!ppro->IsMyContact(hItem) || ppro->getByte(hItem, "ChatRoom", 0) || + ppro->getWord(hItem, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE) SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0); } diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index b1cdd00da8..6e463ff6af 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -723,7 +723,7 @@ HANDLE __cdecl CYahooProto::SendFile( HANDLE hContact, const PROTOCHAR* szDescri DebugLog("Getting Yahoo ID"); */ - if (!GetString(hContact, YAHOO_LOGINID, &dbv)) { + if (!getString(hContact, YAHOO_LOGINID, &dbv)) { long tFileSize = 0; struct _stat statbuf; struct yahoo_file_info *fi; diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 65232c733a..e2800095cf 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -23,7 +23,7 @@ void CYahooProto::send_msg(const char *id, int protocol, const char *msg, int ut { LOG(("[send_msg] Who: %s: protocol: %d Msg: '%s', utf: %d", id, protocol, msg, utf8)); - int buddy_icon = (GetDword("AvatarHash", 0) != 0) ? 2: 0; + int buddy_icon = (getDword("AvatarHash", 0) != 0) ? 2: 0; yahoo_send_im(m_id, NULL, id, protocol, msg, utf8, buddy_icon); } @@ -51,7 +51,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons return; } - if (GetByte("IgnoreUnknown", 0)) { + if (getByte("IgnoreUnknown", 0)) { /* * Check our buddy list to see if we have it there. And if it's not on the list then we don't accept any IMs. @@ -101,7 +101,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons LOG(("%s: %s", who, umsg)); HANDLE hContact = add_buddy(who, who, protocol, PALF_TEMPORARY); - //SetWord(hContact, "yprotoid", protocol); + //setWord(hContact, "yprotoid", protocol); Set_Protocol(hContact, protocol); PROTORECVEVENT pre; @@ -194,8 +194,8 @@ int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc } DBVARIANT dbv; - if (!GetString( hContact, YAHOO_LOGINID, &dbv)) { - send_msg(dbv.pszVal, GetWord( hContact, "yprotoid", 0), msg, 1); + if (!getString( hContact, YAHOO_LOGINID, &dbv)) { + send_msg(dbv.pszVal, getWord( hContact, "yprotoid", 0), msg, 1); ForkThread( &CYahooProto::im_sendacksuccess, hContact ); @@ -239,8 +239,8 @@ INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam) } DBVARIANT dbv; - if (!GetString(hContact, YAHOO_LOGINID, &dbv)) { - send_msg(dbv.pszVal, GetWord(hContact, "yprotoid", 0), "", 0); + if (!getString(hContact, YAHOO_LOGINID, &dbv)) { + send_msg(dbv.pszVal, getWord(hContact, "yprotoid", 0), "", 0); db_free(&dbv); ForkThread( &CYahooProto::im_sendacksuccess, hContact ); diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index 1cc64865da..d7f2e539ea 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -36,29 +36,29 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ppro = (CYahooProto*)lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - if ( !ppro->GetString( YAHOO_LOGINID, &dbv )) { + if ( !ppro->getString( YAHOO_LOGINID, &dbv )) { SetDlgItemTextA(hwndDlg,IDC_HANDLE,dbv.pszVal); db_free(&dbv); } - if ( !ppro->GetString("Nick", &dbv )) { + 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 ); } - //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; @@ -67,7 +67,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, switch ( LOWORD( wParam )) { case IDC_NEWYAHOOACCOUNTLINK: CallService(MS_UTILS_OPENURL, 1, - ppro->GetByte("YahooJapan", 0) ? + ppro->getByte("YahooJapan", 0) ? (LPARAM)"http://edit.yahoo.co.jp/config/eval_register" : (LPARAM)"http://edit.yahoo.com/config/eval_register"); return TRUE; @@ -101,23 +101,23 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, 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 ); - ppro->SetString( YAHOO_LOGINID, str ); + ppro->setString( YAHOO_LOGINID, 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 ); - ppro->SetString( YAHOO_PASSWORD, str ); + ppro->setString( YAHOO_PASSWORD, str ); GetDlgItemTextA( hwndDlg, IDC_NICK, str, sizeof( str )); @@ -126,15 +126,15 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, db_unset( NULL, ppro->m_szModuleName, "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("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 )); if (reconnectRequired ) { db_unset(NULL, ppro->m_szModuleName, YAHOO_PWTOKEN); @@ -169,18 +169,18 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar ppro = ( CYahooProto* )lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - if ( !ppro->GetString( YAHOO_LOGINSERVER, &dbv )) { + if ( !ppro->getString( YAHOO_LOGINSERVER, &dbv )) { SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, dbv.pszVal ); db_free( &dbv ); } else SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, - ppro->GetByte("YahooJapan", 0) + ppro->getByte("YahooJapan", 0) ? 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( NULL, 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: @@ -221,21 +221,21 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar GetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, str, sizeof( str )); - if ( ppro->GetString( YAHOO_LOGINSERVER, &dbv ) || lstrcmpA( str, dbv.pszVal )) + if ( ppro->getString( YAHOO_LOGINSERVER, &dbv ) || lstrcmpA( str, dbv.pszVal )) reconnectRequired = TRUE; if ( dbv.pszVal != NULL) 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) + if ( ppro->getWord(NULL, YAHOO_LOGINPORT, -1) != port) reconnectRequired = TRUE; - ppro->SetWord( NULL, YAHOO_LOGINPORT, port); + ppro->setWord( NULL, 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 ); @@ -265,7 +265,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP ppro = ( CYahooProto* )lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - if ( ppro->GetByte("IgnoreUnknown", 0)) { + if ( ppro->getByte("IgnoreUnknown", 0)) { CheckDlgButton(hwndDlg, IDC_OPT_IGN_UNKNOWN, 1); EnableWindow( GetDlgItem(hwndDlg, IDC_IGN_ADD), 0); @@ -352,7 +352,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 35444e3486..fee84eaccd 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -210,7 +210,7 @@ int CYahooProto::Authorize( HANDLE hdbe ) if (who) { ptrA myid( db_get_sa(hContact, m_szModuleName, "MyIdentity")); DebugLog("Accepting buddy:%s", who); - accept(myid, who, GetWord(hContact, "yprotoid", 0)); + accept(myid, who, getWord(hContact, "yprotoid", 0)); } } @@ -257,7 +257,7 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) ptrA u_reason( mir_utf8encodeT(reason)); DebugLog("Rejecting buddy:%s msg: %s", who, u_reason); - reject(myid, who, GetWord(hContact, "yprotoid", 0), u_reason); + reject(myid, who, getWord(hContact, "yprotoid", 0), u_reason); CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); } } @@ -412,9 +412,9 @@ int __cdecl CYahooProto::SetApparentMode( HANDLE hContact, int mode ) if (mode && mode != ID_STATUS_OFFLINE) return 1; - int oldMode = GetWord(hContact, "ApparentMode", 0); + int oldMode = getWord(hContact, "ApparentMode", 0); if (mode != oldMode) - SetWord(hContact, "ApparentMode", mode); + setWord(hContact, "ApparentMode", mode); return 1; } @@ -442,7 +442,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) /* * Load Yahoo ID from the database. */ - if (!GetString(YAHOO_LOGINID, &dbv)) { + if (!getString(YAHOO_LOGINID, &dbv)) { if (lstrlenA(dbv.pszVal) > 0) { lstrcpynA(m_yahoo_id, dbv.pszVal, 255); } else @@ -456,7 +456,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) if (err) { lstrcpynA(errmsg, Translate("Please enter your yahoo id in Options/Network/Yahoo"), 80); } else { - if (!GetString(YAHOO_PASSWORD, &dbv)) { + if (!getString(YAHOO_PASSWORD, &dbv)) { CallService(MS_DB_CRYPT_DECODESTRING, lstrlenA(dbv.pszVal) + 1, (LPARAM) dbv.pszVal); if (lstrlenA(dbv.pszVal) > 0) { lstrcpynA(m_password, dbv.pszVal, 255); @@ -485,7 +485,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) FREE(m_pw_token); // No Token yet. - if (!GetString(YAHOO_PWTOKEN, &dbv)) { + if (!getString(YAHOO_PWTOKEN, &dbv)) { if (lstrlenA(dbv.pszVal) > 0) { m_pw_token = strdup(dbv.pszVal); } @@ -531,7 +531,7 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact) Sleep( 150 ); /* Check Yahoo Games Message */ - if (!GetString(hContact, "YGMsg", &dbv)) { + if (!getString(hContact, "YGMsg", &dbv)) { gm = strdup(dbv.pszVal); db_free( &dbv ); @@ -543,7 +543,7 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact) db_free( &dbv ); } else { - WORD status = GetWord(hContact, "YStatus", YAHOO_STATUS_OFFLINE); + WORD status = getWord(hContact, "YStatus", YAHOO_STATUS_OFFLINE); sm = yahoo_status_code( yahoo_status( status )); if (sm) sm = strdup(sm); /* we need this to go global FREE later */ } @@ -588,7 +588,7 @@ HANDLE __cdecl CYahooProto::GetAwayMsg( HANDLE hContact ) DebugLog("[YahooGetAwayMessage] "); if (hContact && m_bLoggedIn) { - if (GetWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) + if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0; /* user offline, what Status message? */ ForkThread(&CYahooProto::get_status_thread, hContact); @@ -688,9 +688,9 @@ int __cdecl CYahooProto::UserIsTyping( HANDLE hContact, int type ) return 0; DBVARIANT dbv; - if (!GetString(hContact, YAHOO_LOGINID, &dbv)) { + if (!getString(hContact, YAHOO_LOGINID, &dbv)) { if (type == PROTOTYPE_SELFTYPING_OFF || type == PROTOTYPE_SELFTYPING_ON) { - sendtyping(dbv.pszVal, GetWord(hContact, "yprotoid", 0), type == PROTOTYPE_SELFTYPING_ON?1:0); + sendtyping(dbv.pszVal, getWord(hContact, "yprotoid", 0), type == PROTOTYPE_SELFTYPING_ON?1:0); } db_free(&dbv); } @@ -741,20 +741,20 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); DBVARIANT dbv; - if ( !ppro->GetString(YAHOO_LOGINID, &dbv)) + if ( !ppro->getString(YAHOO_LOGINID, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_HANDLE, dbv.pszVal); db_free(&dbv); } - if ( !ppro->GetString(YAHOO_PASSWORD, &dbv)) + if ( !ppro->getString(YAHOO_PASSWORD, &dbv)) { CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal); SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal); db_free(&dbv); } - SetButtonCheck( hwndDlg, IDC_YAHOO_JAPAN, ppro->GetByte("YahooJapan", 0)); + SetButtonCheck( hwndDlg, IDC_YAHOO_JAPAN, ppro->getByte("YahooJapan", 0)); return TRUE; } @@ -792,17 +792,17 @@ 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 ); - ppro->SetString(YAHOO_LOGINID, str); + 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 ); @@ -812,8 +812,8 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM) str); - ppro->SetString(YAHOO_PASSWORD, str); - ppro->SetByte("YahooJapan", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_YAHOO_JAPAN )); + ppro->setString(YAHOO_PASSWORD, str); + 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 ); diff --git a/protocols/Yahoo/src/proto.h b/protocols/Yahoo/src/proto.h index c7f139743b..468165d1bd 100644 --- a/protocols/Yahoo/src/proto.h +++ b/protocols/Yahoo/src/proto.h @@ -224,28 +224,9 @@ struct CYahooProto : public PROTO int __cdecl OnUserInfoInit( WPARAM wParam, LPARAM lParam ); //====| util.cpp |==================================================================== - int GetByte( const char* valueName, int parDefltValue ); - int SetByte( const char* valueName, int parValue ); - int GetByte( HANDLE hContact, const char* valueName, int parDefltValue ); - int SetByte( HANDLE hContact, const char* valueName, int parValue ); - - int GetString( const char* name, DBVARIANT* ); - int GetString( HANDLE hContact, const char* name, DBVARIANT* ); int GetStringUtf( HANDLE hContact, const char* name, DBVARIANT* ); - - void SetString( const char* name, const char* value ); - void SetString( HANDLE hContact, const char* name, const char* value ); - void SetStringT( HANDLE hContact, const char* name, const TCHAR* value ); DWORD SetStringUtf( HANDLE hContact, const char* valueName, const char* parValue ); - DWORD GetDword( const char* valueName, DWORD parDefltValue ); - DWORD SetDword( const char* valueName, DWORD parValue ); - DWORD GetDword( HANDLE hContact, const char* valueName, DWORD parDefltValue ); - DWORD SetDword( HANDLE hContact, const char* valueName, DWORD parValue ); - - WORD GetWord( HANDLE hContact, const char* valueName, int parDefltValue ); - WORD SetWord( HANDLE hContact, const char* valueName, int parValue ); - DWORD Set_Protocol( HANDLE hContact, int protocol ); int ShowNotification(const TCHAR *title, const TCHAR *info, DWORD flags); diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 5c6f90433c..b78d380f05 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -31,10 +31,10 @@ void CYahooProto::logoff_buddies() { //set all contacts to 'offline' for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { - SetWord( hContact, "Status", ID_STATUS_OFFLINE ); - SetDword(hContact, "IdleTS", 0); - SetDword(hContact, "PictLastCheck", 0); - SetDword(hContact, "PictLoading", 0); + setWord( hContact, "Status", ID_STATUS_OFFLINE ); + setDword(hContact, "IdleTS", 0); + 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"); @@ -97,9 +97,9 @@ int __cdecl CYahooProto::OnContactDeleted( WPARAM wParam, LPARAM lParam ) return 0; } - if (!GetString(hContact, YAHOO_LOGINID, &dbv)) { + if (!getString(hContact, YAHOO_LOGINID, &dbv)) { DebugLog("[YahooContactDeleted] Removing %s", dbv.pszVal); - remove_buddy(dbv.pszVal, GetWord(hContact, "yprotoid", 0)); + remove_buddy(dbv.pszVal, getWord(hContact, "yprotoid", 0)); db_free( &dbv ); } else { @@ -136,7 +136,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow( GetDlgItem( hwndDlg, IDOK ), FALSE ); } - CheckDlgButton( hwndDlg, IDC_CUSTSTATBUSY, ppro->GetByte("BusyCustStat", 0)); + CheckDlgButton( hwndDlg, IDC_CUSTSTATBUSY, ppro->getByte("BusyCustStat", 0)); } return TRUE; @@ -151,8 +151,8 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam 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->setString( YAHOO_CUSTSTATDB, str ); + ppro->setByte("BusyCustStat", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_CUSTSTATBUSY )); /* set for Idle/AA */ if (ppro->m_startMsg) mir_free(ppro->m_startMsg); @@ -220,7 +220,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin) DebugLog("[YahooOpenURL] url: %s Auto Login: %d", url, autoLogin); - if (autoLogin && GetByte("MailAutoLogin", 0) && m_bLoggedIn && m_id > 0) { + if (autoLogin && getByte("MailAutoLogin", 0) && m_bLoggedIn && m_id > 0) { char *y, *t, *u; y = yahoo_urlencode(yahoo_get_cookie(m_id, "y")); @@ -253,11 +253,11 @@ INT_PTR __cdecl CYahooProto::OnShowProfileCommand( WPARAM wParam, LPARAM lParam /** * We don't show profile for users using other IM clients through the IM server bridge */ - if (GetWord(( HANDLE )wParam, "yprotoid", 0) != 0) { + if (getWord(( HANDLE )wParam, "yprotoid", 0) != 0) { return 0; } - if (GetString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) + if (getString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) return 0; _snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal ); @@ -280,7 +280,7 @@ 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; } @@ -298,7 +298,7 @@ INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand( WPARAM wParam, LPARAM lPara //======================================================= INT_PTR __cdecl CYahooProto::OnGotoMailboxCommand( WPARAM wParam, LPARAM lParam ) { - if (GetByte("YahooJapan", 0)) + if (getByte("YahooJapan", 0)) OpenURL("http://mail.yahoo.co.jp/", 1); else OpenURL("http://mail.yahoo.com/", 1); @@ -502,7 +502,7 @@ int __cdecl CYahooProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) return 0; } - Menu_ShowItem(hShowProfileMenuItem, GetWord(hContact, "yprotoid", 0) == 0); + Menu_ShowItem(hShowProfileMenuItem, getWord(hContact, "yprotoid", 0) == 0); return 0; } diff --git a/protocols/Yahoo/src/user_info.cpp b/protocols/Yahoo/src/user_info.cpp index 05def506b0..4f3bc291b3 100644 --- a/protocols/Yahoo/src/user_info.cpp +++ b/protocols/Yahoo/src/user_info.cpp @@ -62,7 +62,7 @@ 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 ); } else { @@ -71,7 +71,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa 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 ); } else { @@ -80,7 +80,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa 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 ); } else { diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 9813d2c825..f2e3ecda7a 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -54,63 +54,11 @@ int DebugLog( const char *fmt, ... ) return CallService(MS_NETLIB_LOG, (WPARAM)g_hNetlibUser, (LPARAM)str); } -int CYahooProto::GetByte( const char* valueName, int parDefltValue ) -{ - return db_get_b( NULL, m_szModuleName, valueName, parDefltValue ); -} - -int CYahooProto::SetByte( const char* valueName, int parValue ) -{ - return db_set_b( NULL, m_szModuleName, valueName, parValue ); -} - -int CYahooProto::GetByte( HANDLE hContact, const char* valueName, int parDefltValue ) -{ - return db_get_b( hContact, m_szModuleName, valueName, parDefltValue ); -} - -int CYahooProto::SetByte( HANDLE hContact, const char* valueName, int parValue ) -{ - return db_set_b( hContact, m_szModuleName, valueName, parValue ); -} - - -DWORD CYahooProto::GetDword( HANDLE hContact, const char* valueName, DWORD parDefltValue ) -{ - return db_get_dw( hContact, m_szModuleName, valueName, parDefltValue ); -} - -DWORD CYahooProto::SetDword( const char* valueName, DWORD parValue ) -{ - return db_set_dw( NULL, m_szModuleName, valueName, parValue); -} - -DWORD CYahooProto::GetDword( const char* valueName, DWORD parDefltValue ) -{ - return db_get_dw( NULL, m_szModuleName, valueName, parDefltValue ); -} - -DWORD CYahooProto::SetDword( HANDLE hContact, const char* valueName, DWORD parValue ) -{ - return db_set_dw( hContact, m_szModuleName, valueName, parValue); -} - - -WORD CYahooProto::SetWord( HANDLE hContact, const char* valueName, int parValue ) -{ - return db_set_w( hContact, m_szModuleName, valueName, parValue ); -} - -WORD CYahooProto::GetWord( HANDLE hContact, const char* valueName, int parDefltValue ) -{ - return db_get_w( hContact, m_szModuleName, valueName, parDefltValue ); -} - DWORD CYahooProto::Set_Protocol( HANDLE hContact, int protocol ) { char *s=NULL; - SetWord(hContact, "yprotoid", protocol); + setWord(hContact, "yprotoid", protocol); switch (protocol) { case YAHOO_IM_YAHOO: s = "Yahoo"; break; /* Yahoo, nothing special here */ @@ -120,36 +68,16 @@ DWORD CYahooProto::Set_Protocol( HANDLE hContact, int protocol ) } if (protocol != YAHOO_IM_YAHOO) - SetString(hContact, "MirVer", s); + setString(hContact, "MirVer", s); - SetString(hContact, "Transport", s); + setString(hContact, "Transport", s); return 0; } -int CYahooProto::GetString(const char* name, DBVARIANT* result) -{ return db_get_s(NULL, m_szModuleName, name, result); -} - -int CYahooProto::GetString(HANDLE hContact, const char* name, DBVARIANT* result) -{ return db_get_s(hContact, m_szModuleName, name, result); -} - int CYahooProto::GetStringUtf(HANDLE hContact, const char* name, DBVARIANT* result) { return db_get_utf(hContact, m_szModuleName, name, result); } -void CYahooProto::SetString(const char* name, const char* value) -{ db_set_s(NULL, m_szModuleName, name, value); -} - -void CYahooProto::SetString( HANDLE hContact, const char* name, const char* value) -{ db_set_s(hContact, m_szModuleName, name, value); -} - -void CYahooProto::SetStringT( HANDLE hContact, const char* name, const TCHAR* value) -{ db_set_ts(hContact, m_szModuleName, name, value); -} - DWORD CYahooProto::SetStringUtf(HANDLE hContact, const char* valueName, const char* parValue) { return db_set_utf(hContact, m_szModuleName, valueName, parValue); } @@ -234,7 +162,7 @@ int CYahooProto::ShowNotification(const TCHAR *title, const TCHAR *info, DWORD f void CYahooProto::ShowError(const TCHAR *title, const TCHAR *buff) { - if ( GetByte("ShowErrors", 1)) + if ( getByte("ShowErrors", 1)) if ( !ShowPopup(title, buff, NULL)) ShowNotification(title, buff, NIIF_ERROR); } @@ -249,8 +177,8 @@ int __cdecl CYahooProto::OnSettingChanged(WPARAM wParam, LPARAM lParam) DebugLog("DB Setting changed. YAHOO user's visible setting changed."); DBVARIANT dbv; - if (!GetString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) { - int iAdd = (ID_STATUS_OFFLINE == GetWord((HANDLE) wParam, "ApparentMode", 0)); + if (!getString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) { + int iAdd = (ID_STATUS_OFFLINE == getWord((HANDLE) wParam, "ApparentMode", 0)); stealth(dbv.pszVal, iAdd); db_free(&dbv); } diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 1b6fafa066..e67eb052ef 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -181,7 +181,7 @@ void CYahooProto::stealth(const char *buddy, int add) /* Safety check, don't dereference Invalid pointers */ if (m_id > 0) - yahoo_set_stealth(m_id, buddy, GetWord(getbuddyH(buddy), "yprotoid", 0), add); + yahoo_set_stealth(m_id, buddy, getWord(getbuddyH(buddy), "yprotoid", 0), add); } void CYahooProto::remove_buddy(const char *who, int protocol) @@ -241,7 +241,7 @@ void CYahooProto::AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg) No refresh needed. */ - if (!GetString(hContact, YAHOO_LOGINID, &dbv)) + if (!getString(hContact, YAHOO_LOGINID, &dbv)) { who = strdup(dbv.pszVal); db_free(&dbv); @@ -249,10 +249,10 @@ void CYahooProto::AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg) else return; - protocol = GetWord(hContact, "yprotoid", 0); + protocol = getWord(hContact, "yprotoid", 0); u_msg = mir_utf8encodeT(msg); - if (!GetString(hContact, "MyIdentity", &dbv)) + if (!getString(hContact, "MyIdentity", &dbv)) { ident = strdup(dbv.pszVal); db_free(&dbv); @@ -286,7 +286,7 @@ HANDLE CYahooProto::getbuddyH(const char *yahoo_id) { for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; - if (GetString(hContact, YAHOO_LOGINID, &dbv)) + if (getString(hContact, YAHOO_LOGINID, &dbv)) continue; int tCompareResult = lstrcmpiA( dbv.pszVal, yahoo_id ); @@ -321,7 +321,7 @@ HANDLE CYahooProto::add_buddy( const char *yahoo_id, const char *yahoo_name, int LOG(("[add_buddy] Adding buddy id: %s (Nick: %s), flags: %lu", yid, yahoo_name, flags)); hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact,(LPARAM)m_szModuleName); - SetString( hContact, YAHOO_LOGINID, yid ); + setString( hContact, YAHOO_LOGINID, yid ); Set_Protocol( hContact, protocol ); if (lstrlenA(yahoo_name) > 0) @@ -378,13 +378,13 @@ void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, co } if (!mobile) - SetWord(hContact, "Status", yahoo_to_miranda_status(stat,away)); + setWord(hContact, "Status", yahoo_to_miranda_status(stat,away)); else - SetWord(hContact, "Status", ID_STATUS_ONTHEPHONE); + setWord(hContact, "Status", ID_STATUS_ONTHEPHONE); - SetWord(hContact, "YStatus", stat); - SetWord(hContact, "YAway", away); - SetWord(hContact, "Mobile", mobile); + setWord(hContact, "YStatus", stat); + setWord(hContact, "YAway", away); + setWord(hContact, "Mobile", mobile); if (msg) { YAHOO_DEBUGLOG("[ext_status_changed] %s custom message '%s'", who, msg); @@ -517,7 +517,7 @@ void CYahooProto::ext_status_logon(const char *who, int protocol, int stat, cons } if (s != NULL) - SetString( hContact, "MirVer", s); + setString( hContact, "MirVer", s); else db_unset( hContact, m_szModuleName, "MirVer"); @@ -604,7 +604,7 @@ void CYahooProto::ext_got_stealth(char *stealthlist) for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; - if (GetString( hContact, YAHOO_LOGINID, &dbv)) + if (getString( hContact, YAHOO_LOGINID, &dbv)) continue; found = 0; @@ -622,13 +622,13 @@ void CYahooProto::ext_got_stealth(char *stealthlist) if (found) { /* we have him on our Stealth List */ YAHOO_DEBUGLOG("Setting STEALTH for id = %s", dbv.pszVal); /* need to set the ApparentMode thingy */ - if (ID_STATUS_OFFLINE != GetWord(hContact, "ApparentMode", 0)) - GetWord(hContact, "ApparentMode", ID_STATUS_OFFLINE); + if (ID_STATUS_OFFLINE != getWord(hContact, "ApparentMode", 0)) + getWord(hContact, "ApparentMode", ID_STATUS_OFFLINE); } else { /* he is not on the Stealth List */ //LOG(("Resetting STEALTH for id = %s", dbv.pszVal)); /* need to delete the ApparentMode thingy */ - if (GetWord(hContact, "ApparentMode", 0)) + if (getWord(hContact, "ApparentMode", 0)) db_unset(hContact, m_szModuleName, "ApparentMode"); } @@ -670,19 +670,19 @@ void CYahooProto::ext_got_buddies(YList * buds) if (bud->stealth) { /* we have him on our Stealth List */ YAHOO_DEBUGLOG("Setting STEALTH for id = %s", bud->id); /* need to set the ApparentMode thingy */ - if (ID_STATUS_OFFLINE != GetWord(hContact, "ApparentMode", 0)) - SetWord(hContact, "ApparentMode", (WORD) ID_STATUS_OFFLINE); + if (ID_STATUS_OFFLINE != getWord(hContact, "ApparentMode", 0)) + setWord(hContact, "ApparentMode", (WORD) ID_STATUS_OFFLINE); } else { /* he is not on the Stealth List */ //LOG(("Resetting STEALTH for id = %s", dbv.pszVal)); /* need to delete the ApparentMode thingy */ - if (GetWord(hContact, "ApparentMode", 0)) + if (getWord(hContact, "ApparentMode", 0)) db_unset(hContact, m_szModuleName, "ApparentMode"); } //if (bud->auth) // YAHOO_DEBUGLOG("Auth request waiting for: %s", bud->id ); - SetByte(hContact, "YAuth", bud->auth); + setByte(hContact, "YAuth", bud->auth); if (bud->real_name) { YAHOO_DEBUGLOG("id = %s name = %s", bud->id, bud->real_name); @@ -699,18 +699,18 @@ void CYahooProto::ext_got_buddies(YList * buds) SetStringUtf( hContact, "LastName", bud->yab_entry->lname); if (bud->yab_entry->email) - SetString( hContact, "e-mail", bud->yab_entry->email); + setString( hContact, "e-mail", bud->yab_entry->email); if (bud->yab_entry->mphone) - SetString( hContact, "Cellular", bud->yab_entry->mphone); + setString( hContact, "Cellular", bud->yab_entry->mphone); if (bud->yab_entry->hphone) - SetString( hContact, "Phone", bud->yab_entry->hphone); + setString( hContact, "Phone", bud->yab_entry->hphone); if (bud->yab_entry->wphone) - SetString( hContact, "CompanyPhone", bud->yab_entry->wphone); + setString( hContact, "CompanyPhone", bud->yab_entry->wphone); - SetWord( hContact, "YabID", bud->yab_entry->dbid); + setWord( hContact, "YabID", bud->yab_entry->dbid); } } @@ -812,11 +812,11 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha SetStringUtf(hContact, "Nick", nick); if (strcmp(myid, m_yahoo_id)) - SetString(hContact, "MyIdentity", myid); + setString(hContact, "MyIdentity", myid); else db_unset(hContact, m_szModuleName, "MyIdentity"); - //SetWord(hContact, "yprotoid", protocol); + //setWord(hContact, "yprotoid", protocol); Set_Protocol(hContact, protocol); pre.flags = PREF_UTF; @@ -911,7 +911,7 @@ void CYahooProto::ext_game_notify(const char *me, const char *who, int stat, con return; if (stat == 2) - SetString(hContact, "YGMsg", ""); + setString(hContact, "YGMsg", ""); else if (msg) { const char *l = msg, *u = NULL; char *z, *c; @@ -970,7 +970,7 @@ void CYahooProto::ext_game_notify(const char *me, const char *who, int stat, con } else { /* ? no information / reset custom message */ - SetString(hContact, "YGMsg", ""); + setString(hContact, "YGMsg", ""); } } @@ -981,7 +981,7 @@ void CYahooProto::ext_mail_notify(const char *from, const char *subj, int cnt) if (cnt > 0) { SkinPlaySound("mail"); - if (!GetByte("DisableYahoomail", 0)) { + if (!getByte("DisableYahoomail", 0)) { TCHAR z[MAX_SECONDLINE], title[MAX_CONTACTNAME]; if (from == NULL) { @@ -1092,7 +1092,7 @@ void CYahooProto::ext_got_ping(const char *errormsg) /** * Now load the YAB. */ - if (GetByte("UseYAB", 1 )) { + if (getByte("UseYAB", 1 )) { LOG(("[ext_got_ping] GET YAB")); if (m_iStatus != ID_STATUS_OFFLINE) mir_forkthread(yahoo_get_yab_thread, (void *)m_id); @@ -1116,7 +1116,7 @@ void CYahooProto::ext_login_response(int succ, const char *url) c = yahoo_get_pw_token(m_id); - SetString(YAHOO_PWTOKEN, c); + setString(YAHOO_PWTOKEN, c); LOG(("PW Token-> %s", c)); return; @@ -1513,7 +1513,7 @@ void CYahooProto::ext_login(enum yahoo_status login_mode) NETLIBHTTPREQUEST nlhr={0},*nlhrReply; char z[4096]; - wsprintfA(z, "http://%s%s", GetByte("YahooJapan",0) != 0 ? "cs1.msg.vip.ogk.yahoo.co.jp" : "vcs.msg.yahoo.com", "/capacity"); + wsprintfA(z, "http://%s%s", getByte("YahooJapan",0) != 0 ? "cs1.msg.vip.ogk.yahoo.co.jp" : "vcs.msg.yahoo.com", "/capacity"); nlhr.cbSize = sizeof(nlhr); nlhr.requestType= REQUEST_GET; nlhr.flags = NLHRF_HTTP11; @@ -1545,21 +1545,21 @@ void CYahooProto::ext_login(enum yahoo_status login_mode) } if (host[0] == '\0') { - if (!GetString(YAHOO_LOGINSERVER, &dbv)) { + if (!getString(YAHOO_LOGINSERVER, &dbv)) { mir_snprintf(host, sizeof(host), "%s", dbv.pszVal); db_free(&dbv); } else { snprintf(host, sizeof(host), "%s", - GetByte("YahooJapan",0) != 0 ? YAHOO_DEFAULT_JAPAN_LOGIN_SERVER : + getByte("YahooJapan",0) != 0 ? YAHOO_DEFAULT_JAPAN_LOGIN_SERVER : YAHOO_DEFAULT_LOGIN_SERVER ); } } - lstrcpynA(fthost,GetByte("YahooJapan",0)?"filetransfer.msg.yahoo.co.jp":"filetransfer.msg.yahoo.com" , sizeof(fthost)); - lstrcpynA(login_host,GetByte("YahooJapan",0)?"login.yahoo.co.jp":"login.yahoo.com" , sizeof(login_host)); - port = GetWord(NULL, YAHOO_LOGINPORT, YAHOO_DEFAULT_PORT); + lstrcpynA(fthost,getByte("YahooJapan",0)?"filetransfer.msg.yahoo.co.jp":"filetransfer.msg.yahoo.com" , sizeof(fthost)); + lstrcpynA(login_host,getByte("YahooJapan",0)?"login.yahoo.co.jp":"login.yahoo.com" , sizeof(login_host)); + port = getWord(NULL, YAHOO_LOGINPORT, YAHOO_DEFAULT_PORT); #ifdef HTTP_GATEWAY nlus.cbSize = sizeof( nlus ); @@ -1575,7 +1575,7 @@ void CYahooProto::ext_login(enum yahoo_status login_mode) "pager_host", host, "pager_port", port, "filetransfer_host", fthost, - "picture_checksum", GetDword("AvatarHash", -1), + "picture_checksum", getDword("AvatarHash", -1), #ifdef HTTP_GATEWAY "web_messenger", iHTTPGateway, #endif -- cgit v1.2.3