diff options
-rw-r--r-- | protocols/Yahoo/src/avatar.cpp | 14 | ||||
-rw-r--r-- | protocols/Yahoo/src/im.cpp | 2 | ||||
-rw-r--r-- | protocols/Yahoo/src/options.cpp | 4 | ||||
-rw-r--r-- | protocols/Yahoo/src/proto.cpp | 13 | ||||
-rw-r--r-- | protocols/Yahoo/src/services.cpp | 8 | ||||
-rw-r--r-- | protocols/Yahoo/src/util.cpp | 4 | ||||
-rw-r--r-- | protocols/Yahoo/src/yahoo.cpp | 47 |
7 files changed, 40 insertions, 52 deletions
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 20429bcf66..69d771ee94 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -421,7 +421,7 @@ 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));
- DBDeleteContactSetting(NULL, m_szModuleName, "AvatarURL");
+ db_unset(NULL, m_szModuleName, "AvatarURL");
if (!DBGetContactSettingTString(NULL, m_szModuleName, "AvatarFile", &dbv2)) {
db_set_s(NULL, m_szModuleName, "AvatarInv", who);
@@ -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);
- DBDeleteContactSetting(NULL, m_szModuleName, "TMPAvatarHash");
+ db_unset(NULL, m_szModuleName, "TMPAvatarHash");
// This is only meant for message sessions, but we don't got those in miranda yet
//YAHOO_bcast_picture_checksum(cksum);
@@ -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);
- DBDeleteContactSetting(NULL, m_szModuleName, "AvatarInv");
+ db_unset(NULL, m_szModuleName, "AvatarInv");
DBFreeVariant(&dbv);
}
}
@@ -832,10 +832,10 @@ INT_PTR __cdecl CYahooProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) DebugLog("[Deleting Avatar Info]");
/* remove ALL our Avatar Info Keys */
- DBDeleteContactSetting(NULL, m_szModuleName, "AvatarFile");
- DBDeleteContactSetting(NULL, m_szModuleName, "AvatarHash");
- DBDeleteContactSetting(NULL, m_szModuleName, "AvatarURL");
- DBDeleteContactSetting(NULL, m_szModuleName, "AvatarTS");
+ db_unset(NULL, m_szModuleName, "AvatarFile");
+ db_unset(NULL, m_szModuleName, "AvatarHash");
+ db_unset(NULL, m_szModuleName, "AvatarURL");
+ db_unset(NULL, m_szModuleName, "AvatarTS");
/* Send a Yahoo packet saying we don't got an avatar anymore */
yahoo_send_picture_status(m_id, 0);
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 9f5e94bf9e..1c07e73903 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -222,7 +222,7 @@ int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc int __cdecl CYahooProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* pre )
{
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
// NUDGES
if ( !lstrcmpA(pre->szMessage, "<ding>") && ServiceExists("NUDGE/Send")) {
diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index f377fa6fdd..08b5cbcfda 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -123,7 +123,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (str[0] == '\0') {
/* Check for empty Nick, if so delete the key in the DB */
- DBDeleteContactSetting( NULL, ppro->m_szModuleName, "Nick");
+ db_unset( NULL, ppro->m_szModuleName, "Nick");
} else {
/* otherwise save the new Nick */
ppro->SetString("Nick", str );
@@ -137,7 +137,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ppro->SetByte("ShowErrors", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_SHOW_ERRORS ));
if (reconnectRequired ) {
- DBDeleteContactSetting(NULL, ppro->m_szModuleName, YAHOO_PWTOKEN);
+ db_unset(NULL, ppro->m_szModuleName, YAHOO_PWTOKEN);
}
/*if ( restartRequired )
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 46616b1d46..05d6484548 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -136,7 +136,7 @@ HANDLE CYahooProto::AddToList( int flags, PROTOSEARCHRESULT* psr ) mir_free(id);
return 0;
}
- } else if (flags & PALF_TEMPORARY ) { /* not on our list */
+ } else if (flags & PALF_TEMPORARY) { /* not on our list */
DebugLog("[YahooAddToList] Adding Temporary Buddy:%s ", id);
}
@@ -237,10 +237,7 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) if ( !m_bLoggedIn )
return 1;
- DBEVENTINFO dbei;
- memset( &dbei, 0, sizeof( dbei ));
- dbei.cbSize = sizeof( dbei );
-
+ DBEVENTINFO dbei = { sizeof( dbei ) };
if (( dbei.cbBlob = CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hdbe, 0)) == -1 ) {
DebugLog("[YahooAuthDeny] ERROR: Can't get blob size");
return 1;
@@ -288,7 +285,7 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) int __cdecl CYahooProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre)
{
DebugLog("[YahooRecvAuth] ");
- DBDeleteContactSetting(hContact,"CList","Hidden");
+ db_unset(hContact,"CList","Hidden");
Proto_AuthRecv(m_szModuleName, pre);
return 0;
@@ -416,7 +413,7 @@ int __cdecl CYahooProto::RecvContacts( HANDLE /*hContact*/, PROTORECVEVENT* ) int __cdecl CYahooProto::RecvFile( HANDLE hContact, PROTORECVFILET* evt )
{
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
return Proto_RecvFile(hContact, evt);
}
@@ -849,7 +846,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM DBFreeVariant( &dbv );
if (reconnectRequired ) {
- DBDeleteContactSetting(NULL, ppro->m_szModuleName, YAHOO_PWTOKEN);
+ db_unset(NULL, ppro->m_szModuleName, YAHOO_PWTOKEN);
}
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM) str);
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 2193aec50a..e28d9f08fd 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -39,10 +39,10 @@ void CYahooProto::logoff_buddies() SetDword(hContact, "IdleTS", 0);
SetDword(hContact, "PictLastCheck", 0);
SetDword(hContact, "PictLoading", 0);
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
- DBDeleteContactSetting(hContact, m_szModuleName, "YMsg");
- DBDeleteContactSetting(hContact, m_szModuleName, "YGMsg");
- //DBDeleteContactSetting(hContact, m_szModuleName, "MirVer");
+ db_unset(hContact, "CList", "StatusMsg");
+ db_unset(hContact, m_szModuleName, "YMsg");
+ db_unset(hContact, m_szModuleName, "YGMsg");
+ //db_unset(hContact, m_szModuleName, "MirVer");
}
hContact = db_find_next(hContact);
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 5b315fc0df..aa5aa7803e 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -125,12 +125,12 @@ DWORD CYahooProto::SetDword( HANDLE hContact, const char* valueName, DWORD parVa WORD CYahooProto::SetWord( HANDLE hContact, const char* valueName, int parValue )
{
- return db_get_w( hContact, m_szModuleName, valueName, parValue );
+ return db_set_w( hContact, m_szModuleName, valueName, parValue );
}
WORD CYahooProto::GetWord( HANDLE hContact, const char* valueName, int parDefltValue )
{
- return db_set_w( hContact, m_szModuleName, valueName, parDefltValue );
+ return db_get_w( hContact, m_szModuleName, valueName, parDefltValue );
}
DWORD CYahooProto::Set_Protocol( HANDLE hContact, int protocol )
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 1e3a0984ad..29eadd3304 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -312,23 +312,18 @@ HANDLE CYahooProto::getbuddyH(const char *yahoo_id) HANDLE CYahooProto::add_buddy( const char *yahoo_id, const char *yahoo_name, int protocol, DWORD flags )
{
- HANDLE hContact;
- char *yid = strdup(yahoo_id);
-
+ char *yid = NEWSTR_ALLOCA(yahoo_id);
strlwr(yid);
- hContact = getbuddyH(yid);
+ HANDLE hContact = getbuddyH(yid);
if (hContact != NULL) {
LOG(("[add_buddy] Found buddy id: %s, handle: %p", yid, hContact));
- if ( !( flags & PALF_TEMPORARY ) && db_get_b( hContact, "CList", "NotOnList", 1 ))
- {
+ if ( !(flags & PALF_TEMPORARY) && db_get_b(hContact, "CList", "NotOnList", 1)) {
LOG(("[add_buddy] Making Perm id: %s, flags: %lu", yahoo_id, flags));
- DBDeleteContactSetting( hContact, "CList", "NotOnList");
- DBDeleteContactSetting( hContact, "CList", "Hidden");
-
+ db_unset( hContact, "CList", "NotOnList");
+ db_unset( hContact, "CList", "Hidden");
}
- FREE(yid);
return hContact;
}
@@ -344,12 +339,11 @@ HANDLE CYahooProto::add_buddy( const char *yahoo_id, const char *yahoo_name, int else
SetStringUtf( hContact, "Nick", yahoo_id );
- if (flags & PALF_TEMPORARY ) {
+ if (flags & PALF_TEMPORARY) {
db_set_b( hContact, "CList", "NotOnList", 1 );
db_set_b( hContact, "CList", "Hidden", 1 );
}
- FREE(yid);
return hContact;
}
@@ -377,9 +371,6 @@ const char* CYahooProto::find_buddy( const char *yahoo_id) /* Other handlers */
void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, const char *msg, int away, int idle, int mobile, int utf8)
{
- HANDLE hContact = 0;
- time_t idlets = 0;
-
YAHOO_DEBUGLOG("[ext_status_changed] %s (prot: %d) with msg %s utf8: %d, stat: %s (%d), away: %d, idle: %d seconds",
who,
protocol,
@@ -390,12 +381,10 @@ void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, co away,
idle);
- hContact = getbuddyH(who);
+ HANDLE hContact = getbuddyH(who);
if (hContact == NULL) {
YAHOO_DEBUGLOG("Buddy Not Found. Adding...");
hContact = add_buddy(who, who, protocol, 0);
-/* } else {
- YAHOO_DEBUGLOG("Buddy Found On My List! Buddy %p", hContact);*/
}
if (!mobile)
@@ -415,14 +404,16 @@ void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, co else
db_set_s( hContact, "CList", "StatusMsg", msg);
}
- else DBDeleteContactSetting(hContact, "CList", "StatusMsg");
+ else db_unset(hContact, "CList", "StatusMsg");
if (stat == YAHOO_STATUS_OFFLINE) {
/*
* Delete the IdleTS if the user went offline
*/
- DBDeleteContactSetting(hContact, m_szModuleName, "IdleTS");
- } else {
+ db_unset(hContact, m_szModuleName, "IdleTS");
+ }
+ else {
+ time_t idlets = 0;
if ( (away == 2) || (stat == YAHOO_STATUS_IDLE) || (idle > 0)) {
/* TODO: set Idle=-1, because of key 138=1 and don't set idlets then */
if (stat > 0) {
@@ -538,7 +529,7 @@ void CYahooProto::ext_status_logon(const char *who, int protocol, int stat, cons if (s != NULL)
SetString( hContact, "MirVer", s);
else
- DBDeleteContactSetting( hContact, m_szModuleName, "MirVer");
+ db_unset( hContact, m_szModuleName, "MirVer");
} else {
Set_Protocol(hContact, protocol);
@@ -653,7 +644,7 @@ 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))
- DBDeleteContactSetting(hContact, m_szModuleName, "ApparentMode");
+ db_unset(hContact, m_szModuleName, "ApparentMode");
}
DBFreeVariant( &dbv );
@@ -702,7 +693,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))
- DBDeleteContactSetting(hContact, m_szModuleName, "ApparentMode");
+ db_unset(hContact, m_szModuleName, "ApparentMode");
}
//if (bud->auth)
@@ -774,8 +765,8 @@ void CYahooProto::ext_buddy_added(char *myid, char *who, char *group, int status case 0: /* we are ok */
case 2: /* seems that we ok, not sure what this means.. we already on buddy list? */
case 40: /* When adding MSN Live contacts we get this one? */
- DBDeleteContactSetting( hContact, "CList", "NotOnList");
- DBDeleteContactSetting( hContact, "CList", "Hidden");
+ db_unset( hContact, "CList", "NotOnList");
+ db_unset( hContact, "CList", "Hidden");
break;
case 1: /* invalid ID? */
@@ -839,7 +830,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
- DBDeleteContactSetting(hContact, m_szModuleName, "MyIdentity");
+ db_unset(hContact, m_szModuleName, "MyIdentity");
//SetWord(hContact, "yprotoid", protocol);
Set_Protocol(hContact, protocol);
@@ -1176,7 +1167,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);
- DBDeleteContactSetting(NULL, m_szModuleName, YAHOO_PWTOKEN);
+ db_unset(NULL, m_szModuleName, YAHOO_PWTOKEN);
YAHOO_DEBUGLOG("ERROR: %s", buff);
|