diff options
author | René Schümann <white06tiger@gmail.com> | 2014-04-03 02:35:29 +0000 |
---|---|---|
committer | René Schümann <white06tiger@gmail.com> | 2014-04-03 02:35:29 +0000 |
commit | cf2713fd362cfeeeda946ead18e6b88abdff9c93 (patch) | |
tree | 5c697c37b29aab31ea056d0ad94e0c05d816c506 /plugins/SendScreenshotPlus/src/CSend.h | |
parent | b87686ce677be209f6923fc8b2f11edcff7f98a0 (diff) |
SendSS
!*+ re-factored CSend a bit, fixes some bugs and improved re-usability
+ CSend got a new dialog to display URL created if there's no target contact (used by ImageShack when called from main menu
* m_bDeleteAfterSend is now m_bAsync
* CSend::Send now returns 1 if sent (sync, caller deletes) and 0 if sending is in progress (class self deletes, async)
* ImageShack got new method SendSilent() (we used m_SendSync before, now renamed to m_bSilent for internal use)
! fixed memory leaks and using "delete" on already deleted CSend which caused a crash
! fixed graphical issue with wrongly initialized state buttons (delete after send, add description etc)
git-svn-id: http://svn.miranda-ng.org/main/trunk@8835 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SendScreenshotPlus/src/CSend.h')
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSend.h | 72 |
1 files changed, 34 insertions, 38 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSend.h b/plugins/SendScreenshotPlus/src/CSend.h index 9026f72fe7..d6972028cd 100644 --- a/plugins/SendScreenshotPlus/src/CSend.h +++ b/plugins/SendScreenshotPlus/src/CSend.h @@ -48,55 +48,51 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //--------------------------------------------------------------------------- class CSend { public: - CSend(HWND Owner, MCONTACT hContact, bool bFreeOnExit); // oder (TfrmMain & Owner) + CSend(HWND Owner, MCONTACT hContact, bool bAsync); // oder (TfrmMain & Owner) virtual ~CSend(); - virtual void Send() = 0; -// void SendSync(bool Sync) {m_SendSync = Sync;}; - bool m_bFreeOnExit; // need to "delete object;" on exit ? - void SetContact(MCONTACT hContact); - BYTE GetEnableItem() {return m_EnableItem;}; - LPTSTR GetErrorMsg() {return m_ErrorMsg;}; - - LPTSTR m_pszFile; - LPTSTR m_pszFileDesc; - - BOOL m_bDeleteAfterSend; - - private: + virtual int Send() = NULL; // returns 1 if sent (you must delete class) and 0 when still sending (class deletes itself) + + void SetFile(TCHAR* file){mir_free(m_pszFile), m_pszFile=mir_tstrdup(file);}; + void SetFile(char* file){mir_free(m_pszFile), m_pszFile=mir_a2t(file);}; + void SetDescription(TCHAR* descr){mir_free(m_pszFileDesc), m_pszFileDesc=mir_tstrdup(descr);}; + void SetContact(MCONTACT hContact); + BYTE GetEnableItem() {return m_EnableItem;}; + TCHAR* GetErrorMsg() {return m_ErrorMsg;}; + bool m_bDeleteAfterSend; protected: - LPTSTR m_pszSendTyp; //hold string for error mess - HWND m_hWndO; //window handle of caller - MCONTACT m_hContact; //Contact handle - char *m_pszProto; //Contact Proto Modul - BYTE m_EnableItem; //hold flag for send type - BYTE m_ChatRoom; //is Contact chatroom - void AfterSendDelete(); - - bool hasCap(unsigned int Flag); - unsigned int m_PFflag; - - void svcSendFile(); - void svcSendUrl (const char* url); - void svcSendMsg (const char* szMessage); - void svcSendChat(); //main GC service - void svcSendChat(const char* szMessage); //GC ansi wrapper + bool m_bAsync; + TCHAR* m_pszFile; + TCHAR* m_pszFileDesc; + static int OnSend(void *obj, WPARAM wParam, LPARAM lParam); + TCHAR* m_pszSendTyp; //hold string for error mess + char* m_pszProto; //Contact Proto Modul + MCONTACT m_hContact; //Contact handle + BYTE m_EnableItem; //hold flag for send type + BYTE m_ChatRoom; //is Contact chatroom + + bool hasCap(unsigned int Flag); +// unsigned int m_PFflag; + + void Error(LPCTSTR pszFormat, ...); + void svcSendFileExit(); + void svcSendMsgExit(const char* szMessage); + void Exit(unsigned int Result); DWORD m_cbEventMsg; //sizeof EventMsg(T) buffer char* m_szEventMsg; //EventMsg char* - LPTSTR m_szEventMsgT; //EventMsg TCHAR* HANDLE m_hSend; //protocol send handle HANDLE m_hOnSend; //HookEventObj on ME_PROTO_ACK - int __cdecl OnSend(WPARAM wParam, LPARAM lParam); - void Unhook(){if(m_hOnSend) {UnhookEvent(m_hOnSend);m_hOnSend = NULL;}} - void DB_EventAdd(WORD EventType); - void Exit(unsigned int Result); MSGBOX m_box; - LPTSTR m_ErrorMsg; - LPTSTR m_ErrorTitle; - void Error(LPCTSTR pszFormat, ...); + TCHAR* m_ErrorMsg; + TCHAR* m_ErrorTitle; + + void Unhook(){if(m_hOnSend) {UnhookEvent(m_hOnSend);m_hOnSend = NULL;}} + void DB_EventAdd(WORD EventType); + + static INT_PTR CALLBACK ResultDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam); }; #endif |