diff options
author | René Schümann <white06tiger@gmail.com> | 2014-04-03 02:39:49 +0000 |
---|---|---|
committer | René Schümann <white06tiger@gmail.com> | 2014-04-03 02:39:49 +0000 |
commit | 0719417f2521293437b4e4b205985dc16479bcc0 (patch) | |
tree | 0fa80bc069a7c28402e4c8f5dd657fb1b3186713 /plugins/SendScreenshotPlus | |
parent | cf2713fd362cfeeeda946ead18e6b88abdff9c93 (diff) |
SendSS
+ Dropbox support (by Wishmaster)
git-svn-id: http://svn.miranda-ng.org/main/trunk@8836 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SendScreenshotPlus')
-rw-r--r-- | plugins/SendScreenshotPlus/SendSS_10.vcxproj | 2 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/SendSS_10.vcxproj.filters | 6 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendDropbox.cpp | 70 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendDropbox.h | 49 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/Main.cpp | 1 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UMainForm.cpp | 8 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UMainForm.h | 3 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/global.h | 3 |
8 files changed, 141 insertions, 1 deletions
diff --git a/plugins/SendScreenshotPlus/SendSS_10.vcxproj b/plugins/SendScreenshotPlus/SendSS_10.vcxproj index 0768029ab7..9194610445 100644 --- a/plugins/SendScreenshotPlus/SendSS_10.vcxproj +++ b/plugins/SendScreenshotPlus/SendSS_10.vcxproj @@ -171,6 +171,7 @@ </ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="src\CSendDropbox.cpp" />
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
@@ -190,6 +191,7 @@ <ClCompile Include="src\Main.cpp" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="src\CSendDropbox.h" />
<ClInclude Include="src\DevKey.h" />
<ClInclude Include="src\UAboutForm.h" />
<ClInclude Include="src\UMainForm.h" />
diff --git a/plugins/SendScreenshotPlus/SendSS_10.vcxproj.filters b/plugins/SendScreenshotPlus/SendSS_10.vcxproj.filters index 8b1b385dcb..28ac622f09 100644 --- a/plugins/SendScreenshotPlus/SendSS_10.vcxproj.filters +++ b/plugins/SendScreenshotPlus/SendSS_10.vcxproj.filters @@ -58,6 +58,9 @@ <ClCompile Include="src\UMainForm.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\CSendDropbox.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\resource.h">
@@ -114,6 +117,9 @@ <ClInclude Include="src\DevKey.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\CSendDropbox.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc">
diff --git a/plugins/SendScreenshotPlus/src/CSendDropbox.cpp b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp new file mode 100644 index 0000000000..c2debbdb85 --- /dev/null +++ b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp @@ -0,0 +1,70 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-09 Miranda ICQ/IM project, + +This file is part of Send Screenshot Plus, a Miranda IM plugin. +Copyright (c) 2010 Ing.U.Horn + +Parts of this file based on original sorce code +(c) 2004-2006 Sérgio Vieira Rolanski (portet from Borland C++) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +//--------------------------------------------------------------------------- +#include "global.h" + +//--------------------------------------------------------------------------- +CSendDropbox::CSendDropbox(HWND Owner, MCONTACT hContact, bool bAsync) +: CSend(Owner, hContact, bAsync){ + m_EnableItem = SS_DLG_DESCRIPTION | SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; + m_pszSendTyp = LPGENT("Dropbox transfer"); +} + +CSendDropbox::~CSendDropbox(){ +} + +//--------------------------------------------------------------------------- +int CSendDropbox::Send() { + if(!m_bAsync){ + SendThread(); + return 1; + } + mir_forkthread(&CSendDropbox::SendThreadWrapper, this); + return 0; +} + +//--------------------------------------------------------------------------- + + +void CSendDropbox::SendThread() { + INT_PTR ret=0; + if(!m_hContact) + SetContact(db_find_first("Dropbox")); + if(m_hContact) + ret = CallService(MS_DROPBOX_SEND_FILE, (WPARAM)m_hContact, (LPARAM)m_pszFile); + if(!ret) { + Error(TranslateT("%s (%i):\nCould not add a share to the Dropbox plugin."),TranslateTS(m_pszSendTyp),ret); + Exit(ACKRESULT_FAILED); return; + } + Exit(ACKRESULT_SUCCESS); +} + +void CSendDropbox::SendThreadWrapper(void * Obj) { + reinterpret_cast<CSendDropbox*>(Obj)->SendThread(); +} diff --git a/plugins/SendScreenshotPlus/src/CSendDropbox.h b/plugins/SendScreenshotPlus/src/CSendDropbox.h new file mode 100644 index 0000000000..33a6985d59 --- /dev/null +++ b/plugins/SendScreenshotPlus/src/CSendDropbox.h @@ -0,0 +1,49 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-09 Miranda ICQ/IM project, + +This file is part of Send Screenshot Plus, a Miranda IM plugin. +Copyright (c) 2010 Ing.U.Horn + +Parts of this file based on original sorce code +(c) 2004-2006 Sérgio Vieira Rolanski (portet from Borland C++) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef _CSEND_DROPBOX_FILE_H +#define _CSEND_DROPBOX_FILE_H + +//--------------------------------------------------------------------------- +class CSendDropbox : public CSend { + public: + CSendDropbox(HWND Owner, MCONTACT hContact, bool bAsync); + ~CSendDropbox(); + + int Send(); + + protected: + char* m_pszFileName; + char* m_URL; + void SendThread(); + static void SendThreadWrapper(void *Obj); +}; + +//--------------------------------------------------------------------------- + +#endif diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index e2cfc37f9a..fd7a895090 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -133,6 +133,7 @@ int hook_ModulesLoaded(WPARAM, LPARAM) myGlobals.PopupActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS); myGlobals.PluginHTTPExist = ServiceExists(MS_HTTP_ACCEPT_CONNECTIONS); myGlobals.PluginFTPExist = ServiceExists(MS_FTPFILE_SHAREFILE); + myGlobals.PluginDropboxExist = ServiceExists(MS_DROPBOX_SEND_FILE); // Netlib register NetlibInit(); diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index da7ca17cb6..0356361da0 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -311,6 +311,11 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) { }else if(m_opt_cboxSendBy == SS_FILESEND || m_opt_cboxSendBy == SS_EMAIL || m_opt_cboxSendBy == SS_HTTPSERVER || m_opt_cboxSendBy == SS_FTPFILE) { m_opt_cboxSendBy = SS_IMAGESHACK; } + if (myGlobals.PluginDropboxExist) { + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Dropbox")), SS_DROPBOX); + }else if(m_opt_cboxSendBy == SS_DROPBOX) { + m_opt_cboxSendBy = SS_IMAGESHACK; + } ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("ImageShack")), SS_IMAGESHACK); ComboBox_SelectItemData (hCtrl, -1, m_opt_cboxSendBy); //use Workaround for MS bug ComboBox_SelectItemData } @@ -828,6 +833,9 @@ void TfrmMain::cboxSendByChange() { case SS_FTPFILE: //"FTP File" m_cSend = new CSendFTPFile(m_hWnd, m_hContact, true); break; + case SS_DROPBOX: //"Dropbox" + m_cSend = new CSendDropbox(m_hWnd, m_hContact, false); + break; case SS_IMAGESHACK: //"ImageShack" m_cSend = new CSendImageShack(m_hWnd, m_hContact, true); break; diff --git a/plugins/SendScreenshotPlus/src/UMainForm.h b/plugins/SendScreenshotPlus/src/UMainForm.h index 21a0519691..5aa35e484e 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.h +++ b/plugins/SendScreenshotPlus/src/UMainForm.h @@ -34,7 +34,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SS_EMAIL 2 #define SS_HTTPSERVER 3 #define SS_FTPFILE 4 -#define SS_IMAGESHACK 5 +#define SS_DROPBOX 5 +#define SS_IMAGESHACK 6 // Used for our own cheap TrackMouseEvent #define BUTTON_POLLDELAY 50 diff --git a/plugins/SendScreenshotPlus/src/global.h b/plugins/SendScreenshotPlus/src/global.h index b643f94c15..37d08e61c1 100644 --- a/plugins/SendScreenshotPlus/src/global.h +++ b/plugins/SendScreenshotPlus/src/global.h @@ -76,6 +76,7 @@ using namespace std; #include <m_popup2.h> #include <m_sendss.h> #include <m_userinfoex.h> +#include <m_dropbox.h> #include "mir_string.h" #include "mir_icolib.h" @@ -85,6 +86,7 @@ using namespace std; #include "version.h" #include "main.h" #include "CSend.h" +#include "CSendDropbox.h" #include "CSendEmail.h" #include "CSendFile.h" #include "CSendFTPFile.h" @@ -108,6 +110,7 @@ typedef struct _MGLOBAL { BOOLEAN PopupActionsExist : 1; // Popup++ or MS_POPUP_REGISTERACTIONS exist BOOLEAN PluginHTTPExist : 1; // HTTPServer or MS_HTTP_ACCEPT_CONNECTIONS exist BOOLEAN PluginFTPExist : 1; // FTPFile or MS_FTPFILE_SHAREFILE exist + BOOLEAN PluginDropboxExist : 1; // Dropbox or MS_DROPBOX_SEND_FILE exists } MGLOBAL, *LPMGLOBAL; |