summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-02-23 19:43:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-02-23 19:43:21 +0000
commitaa387fa04aa096d163932d3f5f9711a2f146c6f0 (patch)
tree7efe5dabf5bf5b9a78f8f991522487814bfc8cb0 /protocols/FacebookRM/src
parent139c2c1a61d9f765704a2001199c2712d6587fb4 (diff)
- PROTO_INTERFACE::GetIcon removed and replaced with the standard implementation;
- PS_LOADICON also replaced with the standard function; - ProtoConstructor() & ProtoDestructor() macroses are introduced to simplify protocols' code; - GetIcon() method implementation removed from all protocols git-svn-id: http://svn.miranda-ng.org/main/trunk@3739 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src')
-rw-r--r--protocols/FacebookRM/src/events.cpp6
-rw-r--r--protocols/FacebookRM/src/proto.cpp50
-rw-r--r--protocols/FacebookRM/src/proto.h1
3 files changed, 21 insertions, 36 deletions
diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp
index 22fe3e70a8..ee99787029 100644
--- a/protocols/FacebookRM/src/events.cpp
+++ b/protocols/FacebookRM/src/events.cpp
@@ -63,7 +63,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
PUDeletePopUp(hwnd);
} break;
- case WM_CONTEXTMENU:
+ case WM_CONTEXTMENU:
PUDeletePopUp(hwnd);
break;
@@ -76,7 +76,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
} return FALSE;
default:
- break;
+ break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
@@ -149,7 +149,7 @@ void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD
pd.colorText = colorText;
pd.iSeconds = timeout;
pd.lchContact = contact;
- pd.lchIcon = GetIcon(1); // TODO: Icon test
+ pd.lchIcon = Skin_GetIconByHandle(m_hProtoIcon); // TODO: Icon test
pd.PluginData = szUrl;
pd.PluginWindowProc = (WNDPROC)PopupDlgProc;
lstrcpy(pd.lptzContactName, title);
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 136073f306..eb4971b77e 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -24,10 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username)
{
- m_iVersion = 2;
- m_szProtoName = mir_strdup( proto_name );
- m_szModuleName = mir_strdup( proto_name );
- m_tszUserName = mir_tstrdup( username );
+ ProtoConstructor(this, proto_name, username);
+ m_szProtoName = mir_strdup(proto_name);
facy.parent = this;
@@ -100,9 +98,8 @@ FacebookProto::~FacebookProto( )
CloseHandle( facy.send_message_lock_ );
CloseHandle( facy.fcb_conn_lock_ );
- mir_free( m_tszUserName );
- mir_free( m_szModuleName );
mir_free( m_szProtoName );
+ ProtoDestructor(this);
}
//////////////////////////////////////////////////////////////////////////////
@@ -114,7 +111,7 @@ DWORD_PTR FacebookProto::GetCaps( int type, HANDLE hContact )
case PFLAGNUM_1:
{
DWORD_PTR flags = PF1_IM | PF1_CHAT | PF1_SERVERCLIST | PF1_AUTHREQ | /*PF1_ADDED |*/ PF1_BASICSEARCH | PF1_USERIDISEMAIL | PF1_SEARCHBYEMAIL | PF1_SEARCHBYNAME | PF1_ADDSEARCHRES; // | PF1_VISLIST | PF1_INVISLIST;
-
+
if ( getByte( FACEBOOK_KEY_SET_MIRANDA_STATUS, 0 ))
return flags |= PF1_MODEMSG;
else
@@ -141,28 +138,17 @@ DWORD_PTR FacebookProto::GetCaps( int type, HANDLE hContact )
return 0;
}
-HICON FacebookProto::GetIcon(int index)
-{
- if (LOWORD(index) == PLI_PROTOCOL)
- {
- HICON ico = Skin_GetIcon("Facebook_facebook");
- return CopyIcon(ico);
- } else {
- return 0;
- }
-}
-
//////////////////////////////////////////////////////////////////////////////
int FacebookProto::SetStatus( int new_status )
{
LOG("===== Beginning SetStatus process");
-
+
// Routing statuses not supported by Facebook
switch ( new_status )
{
case ID_STATUS_INVISIBLE:
- case ID_STATUS_OFFLINE:
+ case ID_STATUS_OFFLINE:
m_iDesiredStatus = new_status;
break;
@@ -171,7 +157,7 @@ int FacebookProto::SetStatus( int new_status )
m_iDesiredStatus = ID_STATUS_OFFLINE;
break;
- case ID_STATUS_IDLE:
+ case ID_STATUS_IDLE:
default:
m_iDesiredStatus = ID_STATUS_INVISIBLE;
if (DBGetContactSettingByte(NULL,m_szModuleName,FACEBOOK_KEY_MAP_STATUSES, DEFAULT_MAP_STATUSES))
@@ -195,7 +181,7 @@ int FacebookProto::SetStatus( int new_status )
}
facy.invisible_ = ( new_status == ID_STATUS_INVISIBLE );
-
+
ForkThread( &FacebookProto::ChangeStatus, this );
return 0;
@@ -230,7 +216,7 @@ HANDLE FacebookProto::SearchBasic( const PROTOCHAR* id )
{
if (isOffline())
return 0;
-
+
TCHAR* email = mir_tstrdup(id);
ForkThread(&FacebookProto::SearchAckThread, this, (void*)email);
@@ -298,12 +284,12 @@ int FacebookProto::Authorize(HANDLE hDbEvent)
return ApproveFriendship((WPARAM)hContact, NULL);
}
- return 1;
+ return 1;
}
int FacebookProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason)
{
-
+
if (!isOffline() && hDbEvent)
{
HANDLE hContact = HContactFromAuthEvent(hDbEvent);
@@ -370,7 +356,7 @@ int FacebookProto::OnEvent(PROTOEVENTTYPE event,WPARAM wParam,LPARAM lParam)
case EV_PROTO_ONEXIT:
return OnPreShutdown(wParam,lParam);
-
+
case EV_PROTO_ONOPTIONS:
return OnOptionsInit(wParam,lParam);
@@ -386,7 +372,7 @@ int FacebookProto::OnEvent(PROTOEVENTTYPE event,WPARAM wParam,LPARAM lParam)
int FacebookProto::SvcCreateAccMgrUI(WPARAM wParam,LPARAM lParam)
{
- return (int)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_FACEBOOKACCOUNT),
+ return (int)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_FACEBOOKACCOUNT),
(HWND)lParam, FBAccountProc, (LPARAM)this );
}
@@ -425,7 +411,7 @@ int FacebookProto::OnOptionsInit(WPARAM wParam,LPARAM lParam)
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = FBOptionsProc;
Options_AddPage(wParam, &odp);
-
+
odp.position = 271829;
odp.ptszTab = LPGENT("Advanced");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_ADVANCED);
@@ -480,8 +466,8 @@ int FacebookProto::RefreshBuddyList(WPARAM, LPARAM)
int FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam)
-{
- HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
+{
+ HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
std::string url = FACEBOOK_URL_PROFILE;
DBVARIANT dbv;
@@ -531,7 +517,7 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam)
}
if (MessageBox( 0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 ) == IDYES) {
-
+
if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
std::string* id = new std::string(dbv.pszVal);
@@ -546,7 +532,7 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam)
ForkThread( &FacebookProto::DeleteContactFromServer, this, ( void* )id );
DBFreeVariant(&dbv);
}
-
+
}
return 0;
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index 2c989891ce..d7dd494c95 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -66,7 +66,6 @@ public:
virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename );
virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL );
- virtual HICON __cdecl GetIcon( int iconIndex );
virtual int __cdecl GetInfo( HANDLE hContact, int infoType );
virtual HANDLE __cdecl SearchBasic( const PROTOCHAR* id );