From 683c656dd87e82ec9e2d05f72a7b7e1c7269bfd6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 15 Jun 2013 18:21:33 +0000 Subject: ProtoBroadcastAck - unified helper for all protocols git-svn-id: http://svn.miranda-ng.org/main/trunk@4962 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Twitter/src/connection.cpp | 20 ++++++++++---------- protocols/Twitter/src/contacts.cpp | 12 ++++++------ protocols/Twitter/src/proto.cpp | 6 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'protocols/Twitter/src') diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 27c46541e3..b0111012e1 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -234,12 +234,12 @@ bool TwitterProto::NegotiateConnection() LOG( _T("**NegotiateConnection - We don't have a PIN? this doesn't make sense. Resetting OAuth keys and setting offline.")); resetOAuthKeys(); - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_STATUS,ACKRESULT_FAILED,(HANDLE)old_status,m_iStatus); + ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_FAILED,(HANDLE)old_status,m_iStatus); // Set to offline old_status = m_iStatus; m_iDesiredStatus = m_iStatus = ID_STATUS_OFFLINE; - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); + ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); return false; } @@ -261,12 +261,12 @@ bool TwitterProto::NegotiateConnection() resetOAuthKeys(); - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_STATUS,ACKRESULT_FAILED,(HANDLE)old_status,m_iStatus); + ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_FAILED,(HANDLE)old_status,m_iStatus); // Set to offline old_status = m_iStatus; m_iDesiredStatus = m_iStatus = ID_STATUS_OFFLINE; - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); + ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); return false; } @@ -337,19 +337,19 @@ bool TwitterProto::NegotiateConnection() LOG( _T("**NegotiateConnection - Verifying credentials failed! No internet maybe?")); //resetOAuthKeys(); - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_STATUS,ACKRESULT_FAILED,(HANDLE)old_status,m_iStatus); + ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_FAILED,(HANDLE)old_status,m_iStatus); // Set to offline old_status = m_iStatus; m_iDesiredStatus = m_iStatus = ID_STATUS_OFFLINE; - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); + ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); return false; } else { m_iStatus = m_iDesiredStatus; - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); + ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); return true; } } @@ -458,10 +458,10 @@ void TwitterProto::UpdateAvatarWorker(void *p) if(save_url(hAvatarNetlib_,data->url,filename)) { db_set_s(data->hContact,m_szModuleName,TWITTER_KEY_AV_URL,data->url.c_str()); - ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_AVATAR,ACKRESULT_SUCCESS,&ai,0); + ProtoBroadcastAck(data->hContact,ACKTYPE_AVATAR,ACKRESULT_SUCCESS,&ai,0); } else - ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_AVATAR,ACKRESULT_FAILED, &ai,0); + ProtoBroadcastAck(data->hContact,ACKTYPE_AVATAR,ACKRESULT_FAILED, &ai,0); ReleaseMutex(avatar_lock_); LOG( _T("***** Done avatar: %s"),data->url.c_str()); } @@ -482,7 +482,7 @@ void TwitterProto::UpdateAvatar(HANDLE hContact,const std::string &url,bool forc PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai),hContact}; db_set_s(hContact,m_szModuleName,TWITTER_KEY_AV_URL,url.c_str()); - ProtoBroadcastAck(m_szModuleName,hContact,ACKTYPE_AVATAR,ACKRESULT_SUCCESS,&ai,0); + ProtoBroadcastAck(hContact,ACKTYPE_AVATAR,ACKRESULT_SUCCESS,&ai,0); } else { diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index f5568c9a9a..00dd6c66a8 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -74,7 +74,7 @@ void TwitterProto::UpdateInfoWorker(void *hContact) } UpdateAvatar(hContact,user.profile_image_url,true); - ProtoBroadcastAck(m_szModuleName,hContact,ACKTYPE_GETINFO,ACKRESULT_SUCCESS,0,0); + ProtoBroadcastAck(hContact,ACKTYPE_GETINFO,ACKRESULT_SUCCESS,0,0); } int TwitterProto::GetInfo(HANDLE hContact,int info_type) @@ -136,15 +136,15 @@ void TwitterProto::DoSearch(void *p) psr.nick = mir_a2t(info.username. c_str()); psr.firstName = mir_a2t(info.real_name.c_str()); - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_SEARCH,ACKRESULT_DATA,(HANDLE)1, (LPARAM)&psr); - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_SEARCH,ACKRESULT_SUCCESS,(HANDLE)1,0); + ProtoBroadcastAck(0,ACKTYPE_SEARCH,ACKRESULT_DATA,(HANDLE)1, (LPARAM)&psr); + ProtoBroadcastAck(0,ACKTYPE_SEARCH,ACKRESULT_SUCCESS,(HANDLE)1,0); mir_free(psr.nick); mir_free(psr.firstName); } else { - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_SEARCH,ACKRESULT_SUCCESS,(HANDLE)1,0); + ProtoBroadcastAck(0,ACKTYPE_SEARCH,ACKRESULT_SUCCESS,(HANDLE)1,0); } delete query; @@ -171,10 +171,10 @@ void TwitterProto::GetAwayMsgWorker(void *hContact) DBVARIANT dbv; if( !db_get_ts(hContact,"CList","StatusMsg",&dbv)) { - ProtoBroadcastAck(m_szModuleName,hContact,ACKTYPE_AWAYMSG,ACKRESULT_SUCCESS, (HANDLE)1,(LPARAM)dbv.ptszVal); + ProtoBroadcastAck(hContact,ACKTYPE_AWAYMSG,ACKRESULT_SUCCESS, (HANDLE)1,(LPARAM)dbv.ptszVal); db_free(&dbv); } - else ProtoBroadcastAck(m_szModuleName,hContact,ACKTYPE_AWAYMSG,ACKRESULT_FAILED, (HANDLE)1,0); + else ProtoBroadcastAck(hContact,ACKTYPE_AWAYMSG,ACKRESULT_FAILED, (HANDLE)1,0); } HANDLE TwitterProto::GetAwayMsg(HANDLE hContact) diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 105210bf4d..d39ba23371 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -152,7 +152,7 @@ void TwitterProto::SendSuccess(void *p) ScopedLock s(twitter_lock_); twit_.send_direct(dbv.pszVal,data->msg); - ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_MESSAGE,ACKRESULT_SUCCESS,(HANDLE)data->msgid,0); + ProtoBroadcastAck(data->hContact,ACKTYPE_MESSAGE,ACKRESULT_SUCCESS,(HANDLE)data->msgid,0); db_free(&dbv); } @@ -203,7 +203,7 @@ int TwitterProto::SetStatus(int new_status) // i think here we tell the proto interface struct that we're connecting, just so it knows m_iStatus = ID_STATUS_CONNECTING; // ok.. here i think we're telling the core that this protocol something.. but why? - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); + ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); ForkThread(&TwitterProto::SignOn,this); } @@ -213,7 +213,7 @@ int TwitterProto::SetStatus(int new_status) m_iStatus = m_iDesiredStatus; SetAllContactStatuses(ID_STATUS_OFFLINE); - ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); + ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); } return 0; -- cgit v1.2.3