diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-11 17:13:29 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-11 17:13:29 +0000 |
commit | 9418930c2d211feca1ddeaafa160c3d8ca9a581a (patch) | |
tree | 827695e66cc8403f295c56f68fd39c07b38f9543 | |
parent | e8ab90ab839ce55a399280f1920e1afd0fb28424 (diff) |
- protocol icon is used in all menus & buttons;
- code formatting
git-svn-id: http://svn.miranda-ng.org/main/trunk@13551 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Dropbox/src/dropbox.cpp | 57 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox.h | 6 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_commands.cpp | 53 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_dialogs.cpp | 53 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_events.cpp | 34 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_icons.cpp | 49 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_menus.cpp | 4 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_services.cpp | 38 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_transfers.cpp | 142 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_utils.cpp | 11 | ||||
-rw-r--r-- | plugins/Dropbox/src/http_request.h | 21 | ||||
-rw-r--r-- | plugins/Dropbox/src/main.cpp | 7 | ||||
-rw-r--r-- | plugins/Dropbox/src/stdafx.h | 5 |
13 files changed, 168 insertions, 312 deletions
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp index b75d5a877d..f537148e88 100644 --- a/plugins/Dropbox/src/dropbox.cpp +++ b/plugins/Dropbox/src/dropbox.cpp @@ -24,11 +24,9 @@ CDropbox::CDropbox() CreateProtoServiceFunctionObj(PSS_MESSAGE, ProtoSendMessage, this);
CreateProtoServiceFunctionObj(PSR_MESSAGE, ProtoReceiveMessage, this);
- InitializeIcons();
InitializeMenus();
hFileProcess = hMessageProcess = 1;
- hDefaultContact = hTransferContact = 0;
}
CDropbox::~CDropbox()
@@ -41,11 +39,9 @@ MCONTACT CDropbox::GetDefaultContact() if (!hDefaultContact)
hDefaultContact = db_find_first(MODULE);
- if (!hDefaultContact)
- {
+ if (!hDefaultContact) {
hDefaultContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
- if (!CallService(MS_PROTO_ADDTOCONTACT, hDefaultContact, (LPARAM)MODULE))
- {
+ if (!CallService(MS_PROTO_ADDTOCONTACT, hDefaultContact, (LPARAM)MODULE)) {
db_set_s(NULL, MODULE, "Nick", MODULE);
db_set_s(hDefaultContact, MODULE, "Nick", MODULE);
db_set_ws(hDefaultContact, "CList", "MyHandle", L"Dropbox");
@@ -74,46 +70,38 @@ void CDropbox::RequestAccountInfo() MCONTACT hContact = CDropbox::GetDefaultContact();
- if (response && response->resultCode == HTTP_STATUS_OK)
- {
+ if (response && response->resultCode == HTTP_STATUS_OK) {
JSONROOT root(response->pData);
- if (root)
- {
+ if (root) {
JSONNODE *node = json_get(root, "referral_link");
- if (node)
- {
+ if (node) {
ptrW referral_link = ptrW(json_as_string(node));
db_set_ws(hContact, MODULE, "Homepage", referral_link);
}
node = json_get(root, "display_name");
- if (node)
- {
+ if (node) {
ptrW display_name = ptrW(json_as_string(node));
wchar_t *sep = wcsrchr(display_name, L' ');
- if (sep)
- {
+ if (sep) {
db_set_ws(hContact, MODULE, "LastName", sep + 1);
display_name[wcslen(display_name) - wcslen(sep)] = '\0';
db_set_ws(hContact, MODULE, "FirstName", display_name);
}
- else
- {
+ else {
db_set_ws(hContact, MODULE, "FirstName", display_name);
db_unset(hContact, MODULE, "LastName");
}
}
node = json_get(root, "country");
- if (node)
- {
+ if (node) {
ptrW isocodeW(json_as_string(node));
ptrA isocode(mir_u2a(isocodeW));
if (!strlen(isocode))
db_unset(hContact, MODULE, "Country");
- else
- {
+ else {
char *country = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)isocode, 0);
db_set_s(hContact, MODULE, "Country", country);
}
@@ -121,8 +109,7 @@ void CDropbox::RequestAccountInfo() node = json_get(root, "quota_info");
JSONNODE *nroot = json_as_node(node);
- if (nroot)
- {
+ if (nroot) {
node = json_get(nroot, "shared");
if (node)
db_set_dw(hContact, MODULE, "SharedQuota", json_as_int(node));
@@ -150,10 +137,8 @@ void CDropbox::DestroyAcceessToken() db_unset(NULL, MODULE, "TokenSecret");
if (hContact)
- {
if (db_get_w(hContact, MODULE, "Status", ID_STATUS_ONLINE) == ID_STATUS_ONLINE)
db_set_w(hContact, MODULE, "Status", ID_STATUS_OFFLINE);
- }
}
UINT CDropbox::RequestAcceessTokenAsync(void *owner, void* param)
@@ -189,19 +174,15 @@ UINT CDropbox::RequestAcceessTokenAsync(void *owner, void* param) MCONTACT hContact = instance->GetDefaultContact();
- if (response)
- {
+ if (response) {
JSONROOT root(response->pData);
- if (root)
- {
- if (response->resultCode == HTTP_STATUS_OK)
- {
+ if (root) {
+ if (response->resultCode == HTTP_STATUS_OK) {
JSONNODE *node = json_get(root, "access_token");
ptrA access_token = ptrA(mir_u2a(json_as_string(node)));
db_set_s(NULL, MODULE, "TokenSecret", access_token);
- if (hContact)
- {
+ if (hContact) {
if (db_get_w(hContact, MODULE, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
db_set_w(hContact, MODULE, "Status", ID_STATUS_ONLINE);
}
@@ -213,8 +194,7 @@ UINT CDropbox::RequestAcceessTokenAsync(void *owner, void* param) /*else
ShowNotification(TranslateT("you have been authorized"), MB_ICONINFORMATION);*/
}
- else
- {
+ else {
JSONNODE *node = json_get(root, "error_description");
ptrW error_description(json_as_string(node));
@@ -225,8 +205,7 @@ UINT CDropbox::RequestAcceessTokenAsync(void *owner, void* param) }
}
}
- else
- {
+ else {
if (hwndDlg)
SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("server does not respond"));
@@ -236,4 +215,4 @@ UINT CDropbox::RequestAcceessTokenAsync(void *owner, void* param) SetDlgItemTextA(hwndDlg, IDC_REQUEST_CODE, "");
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/Dropbox/src/dropbox.h b/plugins/Dropbox/src/dropbox.h index ab4d72697c..c3e55057f7 100644 --- a/plugins/Dropbox/src/dropbox.h +++ b/plugins/Dropbox/src/dropbox.h @@ -23,7 +23,7 @@ enum CMI_MAX // this item shall be the last one
};
-class CDropbox
+class CDropbox : public MZeroedObject
{
struct CommandParam
{
@@ -110,10 +110,6 @@ private: // contacts
MCONTACT GetDefaultContact();
- // icons
- void InitializeIcons();
- static HICON LoadIconEx(const char *name, bool big);
-
// menus
void InitializeMenus();
static void Menu_DisableItem(HGENMENU hMenuItem, BOOL bDisable);
diff --git a/plugins/Dropbox/src/dropbox_commands.cpp b/plugins/Dropbox/src/dropbox_commands.cpp index 52422ea779..2e8963caa1 100644 --- a/plugins/Dropbox/src/dropbox_commands.cpp +++ b/plugins/Dropbox/src/dropbox_commands.cpp @@ -4,7 +4,7 @@ void CDropbox::CommandHelp(void *arg) {
CommandParam *param = (CommandParam*)arg;
- CMStringA help = Translate("Dropbox supports the following commands:"); help += "\n";
+ CMStringA help(Translate("Dropbox supports the following commands:")); help += "\n";
help += "\"/content [dir]\" - "; help += Translate("shows all files in folder \"dir\" (\"dir\" can be omitted for root folder)"); help += "\n";
help += "\"/share <path>\" - "; help += Translate("returns download link for file or folder with specified path (\"path\" is relative from root folder)"); help += "\n";
help += "\"/delete <path>\" - "; help += Translate("deletes file or folder with specified path (\"path\" is relative from root folder)");
@@ -19,7 +19,7 @@ void CDropbox::CommandContent(void *arg) char *name = (char*)param->data;
- CMStringA url = DROPBOX_API_URL "/metadata/" DROPBOX_API_ROOT;
+ CMStringA url(DROPBOX_API_URL "/metadata/" DROPBOX_API_ROOT);
if (name)
url.AppendFormat("/%s", ptrA(mir_utf8encode(name)));
@@ -30,25 +30,20 @@ void CDropbox::CommandContent(void *arg) delete request;
- if (response && response->resultCode == HTTP_STATUS_OK)
- {
+ if (response && response->resultCode == HTTP_STATUS_OK) {
CMStringA message;
JSONROOT root(response->pData);
- if (root)
- {
+ if (root) {
JSONNODE *node = json_get(root, "is_dir");
bool isDir = json_as_bool(node) > 0;
if (!isDir)
message.AppendFormat("\"%s\" %s", name, Translate("is file"));
- else
- {
+ else {
JSONNODE *content = json_as_array(json_get(root, "contents"));
- for (int i = 0;; i++)
- {
+ for (int i = 0;; i++) {
JSONNODE *item = json_at(content, i);
- if (item == NULL)
- {
+ if (item == NULL) {
if (i == 0)
message.AppendFormat("\"%s\" %s", name, Translate("is empty"));
break;
@@ -74,9 +69,8 @@ void CDropbox::CommandShare(void *arg) CommandParam *param = (CommandParam*)arg;
char *name = (char*)param->data;
- if (name)
- {
- CMStringA url = DROPBOX_API_URL "/shares/" DROPBOX_API_ROOT;
+ if (name) {
+ CMStringA url(DROPBOX_API_URL "/shares/" DROPBOX_API_ROOT);
if (name)
url.AppendFormat("/%s", ptrA(mir_utf8encode(name)));
@@ -87,13 +81,11 @@ void CDropbox::CommandShare(void *arg) delete request;
- if (response && response->resultCode == HTTP_STATUS_OK)
- {
+ if (response && response->resultCode == HTTP_STATUS_OK) {
CMStringA link;
JSONROOT root(response->pData);
- if (root)
- {
+ if (root) {
JSONNODE *node = json_get(root, "url");
link = mir_u2a(json_as_string(node));
ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0);
@@ -103,9 +95,8 @@ void CDropbox::CommandShare(void *arg) }
}
}
- else
- {
- CMStringA error; error.AppendFormat(Translate("\"%s\" command has invalid parameter.\nUse \"/help\" for more info."), "/share");
+ else {
+ CMStringA error(FORMAT, Translate("\"%s\" command has invalid parameter.\nUse \"/help\" for more info."), "/share");
ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0);
CallContactService(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)error.GetBuffer());
@@ -120,8 +111,7 @@ void CDropbox::CommandDelete(void *arg) CommandParam *param = (CommandParam*)arg;
char *name = (char*)param->data;
- if (name)
- {
+ if (name) {
CMStringA pparam = CMStringA("root=" DROPBOX_API_ROOT "&path=") + ptrA(mir_utf8encode(name));
HttpRequest *request = new HttpRequest(param->instance->hNetlibUser, REQUEST_POST, DROPBOX_API_URL "/fileops/delete");
@@ -134,25 +124,20 @@ void CDropbox::CommandDelete(void *arg) delete request;
- if (response && response->resultCode == HTTP_STATUS_OK)
- {
+ if (response && response->resultCode == HTTP_STATUS_OK) {
JSONROOT root(response->pData);
- if (root)
- {
+ if (root) {
JSONNODE *node = json_get(root, "is_deleted");
bool isDeleted = json_as_bool(node) > 0;
- CMStringA message;
- message.AppendFormat("%s %s", name, !isDeleted ? Translate("is not deleted") : Translate("is deleted"));
+ CMStringA message(FORMAT, "%s %s", name, !isDeleted ? Translate("is not deleted") : Translate("is deleted"));
ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0);
CallContactService(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)message.GetBuffer());
-
return;
}
}
}
- else
- {
- CMStringA error; error.AppendFormat(Translate("\"%s\" command has invalid parameter.\nUse \"/help\" for more info."), "/delete");
+ else {
+ CMStringA error(FORMAT, Translate("\"%s\" command has invalid parameter.\nUse \"/help\" for more info."), "/delete");
ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0);
CallContactService(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)error.GetBuffer());
}
diff --git a/plugins/Dropbox/src/dropbox_dialogs.cpp b/plugins/Dropbox/src/dropbox_dialogs.cpp index a57afbae5b..0639bad285 100644 --- a/plugins/Dropbox/src/dropbox_dialogs.cpp +++ b/plugins/Dropbox/src/dropbox_dialogs.cpp @@ -4,54 +4,48 @@ INT_PTR CALLBACK CDropbox::MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam {
CDropbox *instance = (CDropbox*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg)
- {
+ switch (msg) {
case WM_INITDIALOG:
- {
TranslateDialogDefault(hwndDlg);
-
instance = (CDropbox*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
EnableWindow(GetDlgItem(hwndDlg, IDC_AUTHORIZE), FALSE);
+ {
+ LOGFONT lf;
+ HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_AUTH_STATUS, WM_GETFONT, 0, 0);
+ GetObject(hFont, sizeof(lf), &lf);
+ lf.lfWeight = FW_BOLD;
+ SendDlgItemMessage(hwndDlg, IDC_AUTH_STATUS, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), 0);
- LOGFONT lf;
- HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_AUTH_STATUS, WM_GETFONT, 0, 0);
- GetObject(hFont, sizeof(lf), &lf);
- lf.lfWeight = FW_BOLD;
- SendDlgItemMessage(hwndDlg, IDC_AUTH_STATUS, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), 0);
-
- if (instance->HasAccessToken())
- SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("you are already authorized"));
- else
- SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("you are not authorized yet"));
+ if (instance->HasAccessToken())
+ SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("you are already authorized"));
+ else
+ SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("you are not authorized yet"));
- CheckDlgButton(hwndDlg, IDC_USE_SHORT_LINKS, db_get_b(NULL, MODULE, "UseSortLinks", 1) ? BST_CHECKED : BST_UNCHECKED);
- if (db_get_b(NULL, MODULE, "UrlAutoSend", 1))
- CheckDlgButton(hwndDlg, IDC_URL_AUTOSEND, BST_CHECKED);
- else if (db_get_b(NULL, MODULE, "UrlPasteToMessageInputArea", 1))
- CheckDlgButton(hwndDlg, IDC_URL_COPYTOMIA, BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_URL_COPYTOCB, db_get_b(NULL, MODULE, "UrlCopyToClipboard", 0) ? BST_CHECKED : BST_UNCHECKED);
- }
- return TRUE;
+ CheckDlgButton(hwndDlg, IDC_USE_SHORT_LINKS, db_get_b(NULL, MODULE, "UseSortLinks", 1) ? BST_CHECKED : BST_UNCHECKED);
+ if (db_get_b(NULL, MODULE, "UrlAutoSend", 1))
+ CheckDlgButton(hwndDlg, IDC_URL_AUTOSEND, BST_CHECKED);
+ else if (db_get_b(NULL, MODULE, "UrlPasteToMessageInputArea", 1))
+ CheckDlgButton(hwndDlg, IDC_URL_COPYTOMIA, BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_URL_COPYTOCB, db_get_b(NULL, MODULE, "UrlCopyToClipboard", 0) ? BST_CHECKED : BST_UNCHECKED);
+ }
+ return TRUE;
case WM_COMMAND:
- switch (LOWORD(wParam))
- {
+ switch (LOWORD(wParam)) {
case IDC_GETAUTH:
CallService(MS_UTILS_OPENURL, 0, (LPARAM)DROPBOX_WWW_URL DROPBOX_API_VER "/oauth2/authorize?response_type=code&client_id=" DROPBOX_API_KEY);
SetFocus(GetDlgItem(hwndDlg, IDC_REQUEST_CODE));
break;
case IDC_REQUEST_CODE:
- {
if ((HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
char requestToken[128];
GetDlgItemTextA(hwndDlg, IDC_REQUEST_CODE, requestToken, SIZEOF(requestToken));
EnableWindow(GetDlgItem(hwndDlg, IDC_AUTHORIZE), strlen(requestToken) != 0);
- }
- break;
+ break;
case IDC_AUTHORIZE:
mir_forkthreadowner(CDropbox::RequestAcceessTokenAsync, instance, hwndDlg, 0);
@@ -68,8 +62,7 @@ INT_PTR CALLBACK CDropbox::MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam break;
case WM_NOTIFY:
- if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY)
- {
+ if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY) {
db_set_b(NULL, MODULE, "UseSortLinks", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USE_SHORT_LINKS));
db_set_b(NULL, MODULE, "UrlAutoSend", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_URL_AUTOSEND));
db_set_b(NULL, MODULE, "UrlPasteToMessageInputArea", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_URL_COPYTOMIA));
@@ -78,4 +71,4 @@ INT_PTR CALLBACK CDropbox::MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam break;
}
return FALSE;
-}
\ No newline at end of file +}
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp index a73844469b..4c555b95d5 100644 --- a/plugins/Dropbox/src/dropbox_events.cpp +++ b/plugins/Dropbox/src/dropbox_events.cpp @@ -22,14 +22,13 @@ int CDropbox::OnModulesLoaded(void *obj, WPARAM, LPARAM) instance->GetDefaultContact();
- if (ServiceExists(MS_BB_ADDBUTTON))
- {
+ if (ServiceExists(MS_BB_ADDBUTTON)) {
BBButton bbd = { sizeof(bbd) };
bbd.pszModuleName = MODULE;
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON;
bbd.ptszTooltip = TranslateT("Send files to Dropbox");
- bbd.hIcon = LoadSkinnedIconHandle(SKINICON_EVENT_FILE);
+ bbd.hIcon = GetIconHandle(IDI_DROPBOX);
bbd.dwButtonID = BBB_ID_FILE_SEND;
bbd.dwDefPos = 100 + bbd.dwButtonID;
CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
@@ -42,8 +41,7 @@ int CDropbox::OnModulesLoaded(void *obj, WPARAM, LPARAM) int CDropbox::OnPreShutdown(void *, WPARAM, LPARAM)
{
- if (ServiceExists(MS_BB_ADDBUTTON))
- {
+ if (ServiceExists(MS_BB_ADDBUTTON)) {
BBButton bbd = { sizeof(bbd) };
bbd.pszModuleName = MODULE;
@@ -58,8 +56,7 @@ int CDropbox::OnContactDeleted(void *obj, WPARAM hContact, LPARAM) {
CDropbox *instance = (CDropbox*)obj;
- if (mir_strcmpi(GetContactProto(hContact), MODULE) == 0)
- {
+ if (mir_strcmpi(GetContactProto(hContact), MODULE) == 0) {
if (instance->HasAccessToken())
instance->DestroyAcceessToken();
}
@@ -87,8 +84,7 @@ int CDropbox::OnOptionsInitialized(void *obj, WPARAM wParam, LPARAM) int CDropbox::OnSrmmWindowOpened(void *obj, WPARAM, LPARAM lParam)
{
MessageWindowEventData *ev = (MessageWindowEventData*)lParam;
- if (ev->uType == MSG_WINDOW_EVT_OPENING && ev->hContact)
- {
+ if (ev->uType == MSG_WINDOW_EVT_OPENING && ev->hContact) {
CDropbox *instance = (CDropbox*)obj;
char *proto = GetContactProto(ev->hContact);
bool isProtoOnline = CallProtoService(proto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE;
@@ -115,8 +111,7 @@ int CDropbox::OnTabSrmmButtonPressed(void *obj, WPARAM, LPARAM lParam) CDropbox *instance = (CDropbox*)obj;
CustomButtonClickData *cbc = (CustomButtonClickData *)lParam;
- if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == BBB_ID_FILE_SEND && cbc->hContact)
- {
+ if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == BBB_ID_FILE_SEND && cbc->hContact) {
instance->hTransferContact = cbc->hContact;
instance->hTransferWindow = (HWND)CallService(MS_FILE_SENDFILE, instance->GetDefaultContact(), 0);
@@ -150,8 +145,7 @@ int CDropbox::OnFileDialogCancelled(void *obj, WPARAM, LPARAM lParam) CDropbox *instance = (CDropbox*)obj;
HWND hwnd = (HWND)lParam;
- if (instance->hTransferWindow == hwnd)
- {
+ if (instance->hTransferWindow == hwnd) {
CallFunctionAsync(EnableTabSrmmButtonAsync, (void*)instance->hTransferContact);
instance->hTransferWindow = 0;
}
@@ -164,8 +158,7 @@ int CDropbox::OnFileDialogSuccessed(void *obj, WPARAM, LPARAM lParam) CDropbox *instance = (CDropbox*)obj;
HWND hwnd = (HWND)lParam;
- if (instance->hTransferWindow == hwnd)
- {
+ if (instance->hTransferWindow == hwnd) {
CallFunctionAsync(EnableTabSrmmButtonAsync, (void*)instance->hTransferContact);
instance->hTransferWindow = 0;
}
@@ -180,23 +173,20 @@ int CDropbox::OnProtoAck(void *, WPARAM, LPARAM lParam) if (!strcmp(ack->szModule, MODULE))
return 0; // don't rebroadcast our own acks
- if (ack->type == ACKTYPE_STATUS/* && ((int)ack->lParam != (int)ack->hProcess)*/)
- {
+ if (ack->type == ACKTYPE_STATUS/* && ((int)ack->lParam != (int)ack->hProcess)*/) {
WORD status = ack->lParam;
bool canSendOffline = (CallProtoService(ack->szModule, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDOFFLINE) > 0;
MessageWindowInputData msgwi = { sizeof(msgwi) };
msgwi.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
- for (MCONTACT hContact = db_find_first(ack->szModule); hContact; hContact = db_find_next(hContact, ack->szModule))
- {
+ for (MCONTACT hContact = db_find_first(ack->szModule); hContact; hContact = db_find_next(hContact, ack->szModule)) {
msgwi.hContact = hContact;
MessageWindowData msgw;
msgw.cbSize = sizeof(msgw);
- if (!CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgwi, (LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS)
- {
+ if (!CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgwi, (LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
BBButton bbd = { sizeof(bbd) };
bbd.pszModuleName = MODULE;
bbd.dwButtonID = BBB_ID_FILE_SEND;
@@ -211,4 +201,4 @@ int CDropbox::OnProtoAck(void *, WPARAM, LPARAM lParam) }
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/Dropbox/src/dropbox_icons.cpp b/plugins/Dropbox/src/dropbox_icons.cpp index 97bb2e4884..881c41e7db 100644 --- a/plugins/Dropbox/src/dropbox_icons.cpp +++ b/plugins/Dropbox/src/dropbox_icons.cpp @@ -1,40 +1,29 @@ #include "stdafx.h"
-void CDropbox::InitializeIcons()
+static IconItem iconList[] =
{
- wchar_t filePath[MAX_PATH];
- GetModuleFileName(g_hInstance, filePath, MAX_PATH);
+ { LPGEN("Protocol icon"), "main", IDI_DROPBOX }
+};
- wchar_t sectionName[100];
- mir_sntprintf(
- sectionName,
- SIZEOF(sectionName),
- _T("%s/%s"),
- LPGENT("Protocols"),
- LPGENT(MODULE));
+void InitializeIcons()
+{
+ Icon_Register(g_hInstance, "Protocols/" MODULE, iconList, SIZEOF(iconList), MODULE);
+}
- char settingName[100];
- mir_snprintf(
- settingName,
- SIZEOF(settingName),
- "%s_%s",
- MODULE,
- "main");
+HANDLE GetIconHandle(int iconId)
+{
+ for (unsigned i = 0; i < SIZEOF(iconList); i++)
+ if (iconList[i].defIconID == iconId)
+ return iconList[i].hIcolib;
- SKINICONDESC sid = { 0 };
- sid.cbSize = sizeof(SKINICONDESC);
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszDefaultFile = filePath;
- sid.pszName = settingName;
- sid.ptszSection = sectionName;
- sid.ptszDescription = LPGENT("Protocol icon");
- sid.iDefaultIndex = -IDI_DROPBOX;
- /*HANDLE hIcon = */Skin_AddIcon(&sid);
+ return NULL;
}
-HICON CDropbox::LoadIconEx(const char *name, bool big)
+HICON LoadIconEx(int iconId, bool big)
{
- char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, name);
- return Skin_GetIcon(szSettingName, big);
+ for (int i = 0; i < SIZEOF(iconList); i++)
+ if (iconList[i].defIconID == iconId)
+ return Skin_GetIconByHandle(iconList[i].hIcolib, big);
+
+ return NULL;
}
diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp index 7255d80ff3..cec9cc2988 100644 --- a/plugins/Dropbox/src/dropbox_menus.cpp +++ b/plugins/Dropbox/src/dropbox_menus.cpp @@ -22,7 +22,7 @@ void CDropbox::InitializeMenus() mi.pszService = MODULE"/SendFilesToDropbox";
mi.ptszName = LPGENT("Send files to Dropbox");
mi.position = -2000020000 + CMI_SEND_FILES;
- mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_FILE);
+ mi.icolibItem = GetIconHandle(IDI_DROPBOX);
contactMenuItems[CMI_SEND_FILES] = Menu_AddContactMenuItem(&mi);
CreateServiceFunctionObj(mi.pszService, SendFilesToDropboxCommand, this);
}
@@ -48,4 +48,4 @@ int CDropbox::OnPrebuildContactMenu(void *obj, WPARAM hContact, LPARAM) Menu_ShowItem(instance->contactMenuItems[CMI_SEND_FILES], TRUE);
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp index 4667998633..fa823c3726 100644 --- a/plugins/Dropbox/src/dropbox_services.cpp +++ b/plugins/Dropbox/src/dropbox_services.cpp @@ -12,8 +12,7 @@ HANDLE CDropbox::CreateProtoServiceFunctionObj(const char *szService, MIRANDASER INT_PTR CDropbox::ProtoGetCaps(WPARAM wParam, LPARAM)
{
- switch (wParam)
- {
+ switch (wParam) {
case PFLAGNUM_1:
return PF1_IM | PF1_FILESEND;
case PFLAGNUM_2:
@@ -37,7 +36,7 @@ INT_PTR CDropbox::ProtoGetName(WPARAM wParam, LPARAM lParam) INT_PTR CDropbox::ProtoLoadIcon(WPARAM wParam, LPARAM)
{
- return (LOWORD(wParam) == PLI_PROTOCOL) ? (INT_PTR)CopyIcon(LoadIconEx("main", FALSE)) : 0;
+ return (LOWORD(wParam) == PLI_PROTOCOL) ? (INT_PTR)CopyIcon(LoadIconEx(IDI_DROPBOX)) : 0;
}
INT_PTR CDropbox::ProtoGetStatus(WPARAM, LPARAM)
@@ -80,8 +79,7 @@ INT_PTR CDropbox::ProtoSendFile(void *obj, WPARAM, LPARAM lParam) wchar_t **paths = (wchar_t**)pccsd->lParam;
- for (int i = 0; paths[i]; i++)
- {
+ for (int i = 0; paths[i]; i++) {
if (PathIsDirectory(paths[i]))
ftp->totalFolders++;
else
@@ -94,12 +92,9 @@ INT_PTR CDropbox::ProtoSendFile(void *obj, WPARAM, LPARAM lParam) ftp->pfts.pwszFiles = (wchar_t**)mir_alloc(sizeof(wchar_t*) * (ftp->pfts.totalFiles + 1));
ftp->pfts.pwszFiles[ftp->pfts.totalFiles] = NULL;
- for (int i = 0, j = 0, k = 0; paths[i]; i++)
- {
- if (PathIsDirectory(paths[i]))
- {
- if (!ftp->relativePathStart)
- {
+ for (int i = 0, j = 0, k = 0; paths[i]; i++) {
+ if (PathIsDirectory(paths[i])) {
+ if (!ftp->relativePathStart) {
wchar_t *rootFolder = paths[j];
wchar_t *relativePath = wcsrchr(rootFolder, '\\') + 1;
ftp->relativePathStart = relativePath - rootFolder;
@@ -109,10 +104,8 @@ INT_PTR CDropbox::ProtoSendFile(void *obj, WPARAM, LPARAM lParam) j++;
}
- else
- {
- if (!ftp->pfts.wszWorkingDir)
- {
+ else {
+ if (!ftp->pfts.wszWorkingDir) {
wchar_t *path = paths[j];
int length = wcsrchr(path, '\\') - path;
ftp->pfts.wszWorkingDir = (wchar_t*)mir_alloc(sizeof(wchar_t) * (length + 1));
@@ -124,8 +117,7 @@ INT_PTR CDropbox::ProtoSendFile(void *obj, WPARAM, LPARAM lParam) ftp->pfts.pwszFiles[k] = mir_wstrdup(paths[i]);
FILE *file = _wfopen(paths[i], L"rb");
- if (file != NULL)
- {
+ if (file != NULL) {
fseek(file, 0, SEEK_END);
ftp->pfts.totalBytes += ftell(file);
fseek(file, 0, SEEK_SET);
@@ -174,14 +166,14 @@ INT_PTR CDropbox::ProtoSendMessage(void *obj, WPARAM, LPARAM lParam) }
static commands[] =
{
- { "help", &CDropbox::CommandHelp },
+ { "help", &CDropbox::CommandHelp },
{ "content", &CDropbox::CommandContent },
- { "share", &CDropbox::CommandShare },
- { "delete", &CDropbox::CommandDelete }
+ { "share", &CDropbox::CommandShare },
+ { "delete", &CDropbox::CommandDelete }
};
- for (int i=0; i < SIZEOF(commands); i++) {
- if (!strcmp(message+1, commands[i].szCommand)) {
+ for (int i = 0; i < SIZEOF(commands); i++) {
+ if (!strcmp(message + 1, commands[i].szCommand)) {
ULONG messageId = InterlockedIncrement(&instance->hMessageProcess);
CommandParam *param = new CommandParam();
@@ -253,4 +245,4 @@ INT_PTR CDropbox::SendFileToDropbox(void *obj, WPARAM hContact, LPARAM lParam) mir_forkthreadowner(CDropbox::SendFilesAndEventAsync, obj, ftp, 0);
return fileId;
-}
\ No newline at end of file +}
diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp index 4bc57c097b..de361d853e 100644 --- a/plugins/Dropbox/src/dropbox_transfers.cpp +++ b/plugins/Dropbox/src/dropbox_transfers.cpp @@ -2,16 +2,9 @@ int CDropbox::SendFile(const char *fileName, const char *data, int length)
{
- char *utf8_fileName = mir_utf8encode(fileName);
-
- CMStringA url;
- url.AppendFormat(DROPBOX_APICONTENT_URL "/files_put/%s/%s",
- DROPBOX_API_ROOT,
- utf8_fileName);
+ CMStringA url(FORMAT, DROPBOX_APICONTENT_URL "/files_put/%s/%s", DROPBOX_API_ROOT, ptrA(mir_utf8encode(fileName)));
url.Replace('\\', '/');
- mir_free(utf8_fileName);
-
HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_PUT, DROPBOX_APICONTENT_URL "/files_put");
request->AddBearerAuthHeader(db_get_sa(NULL, MODULE, "TokenSecret"));
request->pData = (char*)mir_alloc(sizeof(char)* length);
@@ -38,11 +31,9 @@ int CDropbox::SendFileChunkedFirst(const char *data, int length, char *uploadId, delete request;
- if (response && response->resultCode == HTTP_STATUS_OK)
- {
+ if (response && response->resultCode == HTTP_STATUS_OK) {
JSONROOT root(response->pData);
- if (root)
- {
+ if (root) {
JSONNODE *node = json_get(root, "upload_id");
strcpy(uploadId, mir_u2a(json_as_string(node)));
@@ -56,7 +47,7 @@ int CDropbox::SendFileChunkedFirst(const char *data, int length, char *uploadId, int CDropbox::SendFileChunkedNext(const char *data, int length, const char *uploadId, size_t &offset)
{
- CMStringA url = DROPBOX_APICONTENT_URL "/chunked_upload";
+ CMStringA url(DROPBOX_APICONTENT_URL "/chunked_upload");
url.AppendFormat("?upload_id=%s&offset=%i", uploadId, offset);
HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_PUT, url);
@@ -70,11 +61,9 @@ int CDropbox::SendFileChunkedNext(const char *data, int length, const char *uplo delete request;
- if (response && response->resultCode == HTTP_STATUS_OK)
- {
+ if (response && response->resultCode == HTTP_STATUS_OK) {
JSONROOT root(response->pData);
- if (root)
- {
+ if (root) {
JSONNODE *node = json_get(root, "offset");
offset = json_as_int(node);
}
@@ -85,12 +74,7 @@ int CDropbox::SendFileChunkedNext(const char *data, int length, const char *uplo int CDropbox::SendFileChunkedLast(const char *fileName, const char *uploadId)
{
- CMStringA url;
- url.AppendFormat(
- "%s/commit_chunked_upload/%s/%s",
- DROPBOX_APICONTENT_URL,
- DROPBOX_API_ROOT,
- fileName);
+ CMStringA url(FORMAT, "%s/commit_chunked_upload/%s/%s", DROPBOX_APICONTENT_URL, DROPBOX_API_ROOT, fileName);
url.Replace('\\', '/');
CMStringA param = CMStringA("upload_id=") + uploadId;
@@ -110,13 +94,10 @@ int CDropbox::SendFileChunkedLast(const char *fileName, const char *uploadId) int CDropbox::CreateFolder(const char *folderName)
{
- CMStringA folder = folderName;
+ CMStringA folder(folderName);
folder.Replace('\\', '/');
- CMStringA param;
- param.AppendFormat("root=%s&path=%s",
- DROPBOX_API_ROOT,
- folder);
+ CMStringA param(FORMAT, "root=%s&path=%s", DROPBOX_API_ROOT, folder);
HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_POST, DROPBOX_API_URL "/fileops/create_folder");
request->AddBearerAuthHeader(db_get_sa(NULL, MODULE, "TokenSecret"));
@@ -137,10 +118,8 @@ int CDropbox::CreateFolder(const char *folderName) int CDropbox::CreateDownloadUrl(const char *path, wchar_t *url)
{
- CMStringA api_url = DROPBOX_API_URL;
- api_url.AppendFormat("/shares/%s/%s",
- DROPBOX_API_ROOT,
- path);
+ CMStringA api_url(DROPBOX_API_URL);
+ api_url.AppendFormat("/shares/%s/%s", DROPBOX_API_ROOT, path);
if (!db_get_b(NULL, MODULE, "UseSortLinks", 1))
api_url += "?short_url=false";
@@ -152,11 +131,9 @@ int CDropbox::CreateDownloadUrl(const char *path, wchar_t *url) delete request;
- if (response && response->resultCode == HTTP_STATUS_OK)
- {
+ if (response && response->resultCode == HTTP_STATUS_OK) {
JSONROOT root(response->pData);
- if (root)
- {
+ if (root) {
JSONNODE *node = json_get(root, "url");
wcscpy(url, json_as_string(node));
}
@@ -173,41 +150,32 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg) ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, ftp->hProcess, 0);
- if (ftp->pwszFolders)
- {
- for (int i = 0; ftp->pwszFolders[i]; i++)
- {
+ if (ftp->pwszFolders) {
+ for (int i = 0; ftp->pwszFolders[i]; i++) {
ptrA utf8_folderName(mir_utf8encodeW(ftp->pwszFolders[i]));
- if (!instance->CreateFolder(utf8_folderName))
- {
- if (!strchr(utf8_folderName, '\\'))
- {
+ if (!instance->CreateFolder(utf8_folderName)) {
+ if (!strchr(utf8_folderName, '\\')) {
wchar_t url[MAX_PATH];
if (!instance->CreateDownloadUrl(utf8_folderName, url))
ftp->AddUrl(url);
- else
- {
+ else {
error = true;
break;
}
}
}
- else
- {
+ else {
error = true;
break;
}
}
}
- if (!error)
- {
- for (int i = 0; ftp->pfts.pwszFiles[i]; i++)
- {
+ if (!error) {
+ for (int i = 0; ftp->pfts.pwszFiles[i]; i++) {
FILE *file = _wfopen(ftp->pfts.pwszFiles[i], L"rb");
- if (file)
- {
+ if (file) {
const wchar_t *fileName = NULL;
if (!ftp->relativePathStart)
fileName = wcsrchr(ftp->pfts.pwszFiles[i], L'\\') + 1;
@@ -235,10 +203,8 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg) else if (fileSize > 20 * 1024 * 1024)
chunkSize = DROPBOX_FILE_CHUNK_SIZE;
- while (!feof(file) && fileSize != offset)
- {
- if (ferror(file))
- {
+ while (!feof(file) && fileSize != offset) {
+ if (ferror(file)) {
error = true;
break;
}
@@ -246,18 +212,14 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg) char *data = new char[chunkSize + 1];
int count = (int)fread(data, sizeof(char), chunkSize, file);
- if (!offset)
- {
- if (instance->SendFileChunkedFirst(data, count, uploadId, offset))
- {
+ if (!offset) {
+ if (instance->SendFileChunkedFirst(data, count, uploadId, offset)) {
error = true;
break;
}
}
- else
- {
- if (instance->SendFileChunkedNext(data, count, uploadId, offset))
- {
+ else {
+ if (instance->SendFileChunkedNext(data, count, uploadId, offset)) {
error = true;
break;
}
@@ -271,24 +233,19 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg) fclose(file);
- if (!error)
- {
+ if (!error) {
ptrA utf8_fileName(mir_utf8encodeW(fileName));
- if (instance->SendFileChunkedLast(utf8_fileName, uploadId))
- {
+ if (instance->SendFileChunkedLast(utf8_fileName, uploadId)) {
error = true;
break;
}
- else
- {
- if (!wcschr(fileName, L'\\'))
- {
+ else {
+ if (!wcschr(fileName, L'\\')) {
wchar_t url[MAX_PATH];
if (!instance->CreateDownloadUrl(utf8_fileName, url))
ftp->AddUrl(url);
- else
- {
+ else {
error = true;
break;
}
@@ -301,16 +258,14 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg) }
}
}
- else
- {
+ else {
error = true;
break;
}
}
}
- if (error)
- {
+ if (error) {
ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ftp->hProcess, 0);
return 1;
@@ -327,20 +282,16 @@ UINT CDropbox::SendFilesAndReportAsync(void *owner, void *arg) FileTransferParam *ftp = (FileTransferParam*)arg;
int res = SendFilesAsync(owner, arg);
- if (!res)
- {
+ if (!res) {
CMString urls;
for (int i = 0; ftp->pwszUrls[i]; i++)
urls.AppendFormat(L"%s\r\n", ftp->pwszUrls[i]);
wchar_t *data = urls.GetBuffer();
- if (db_get_b(NULL, MODULE, "UrlAutoSend", 1))
- {
+ if (db_get_b(NULL, MODULE, "UrlAutoSend", 1)) {
char *message = mir_utf8encodeW(data);
- if (ftp->hContact != instance->GetDefaultContact())
- {
- if (CallContactService(ftp->hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)message) != ACKRESULT_FAILED)
- {
+ if (ftp->hContact != instance->GetDefaultContact()) {
+ if (CallContactService(ftp->hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)message) != ACKRESULT_FAILED) {
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.flags = DBEF_UTF | DBEF_SENT/* | DBEF_READ*/;
dbei.szModule = MODULE;
@@ -352,8 +303,7 @@ UINT CDropbox::SendFilesAndReportAsync(void *owner, void *arg) }
else CallServiceSync(MS_MSG_SENDMESSAGEW, (WPARAM)ftp->hContact, (LPARAM)data);
}
- else
- {
+ else {
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.flags = DBEF_UTF;
dbei.szModule = MODULE;
@@ -368,18 +318,14 @@ UINT CDropbox::SendFilesAndReportAsync(void *owner, void *arg) if (db_get_b(NULL, MODULE, "UrlPasteToMessageInputArea", 0))
CallServiceSync(MS_MSG_SENDMESSAGEW, (WPARAM)ftp->hContact, (LPARAM)data);
- if (db_get_b(NULL, MODULE, "UrlCopyToClipboard", 0))
- {
- if (OpenClipboard(NULL))
- {
+ if (db_get_b(NULL, MODULE, "UrlCopyToClipboard", 0)) {
+ if (OpenClipboard(NULL)) {
EmptyClipboard();
size_t size = sizeof(wchar_t) * (urls.GetLength() + 1);
HGLOBAL hClipboardData = GlobalAlloc(NULL, size);
- if (hClipboardData)
- {
+ if (hClipboardData) {
wchar_t *pchData = (wchar_t*)GlobalLock(hClipboardData);
- if (pchData)
- {
+ if (pchData) {
memcpy(pchData, (wchar_t*)data, size);
GlobalUnlock(hClipboardData);
SetClipboardData(CF_UNICODETEXT, hClipboardData);
diff --git a/plugins/Dropbox/src/dropbox_utils.cpp b/plugins/Dropbox/src/dropbox_utils.cpp index ba7fec2ee4..401ba75693 100644 --- a/plugins/Dropbox/src/dropbox_utils.cpp +++ b/plugins/Dropbox/src/dropbox_utils.cpp @@ -2,8 +2,7 @@ wchar_t *CDropbox::HttpStatusToText(HTTP_STATUS status)
{
- switch (status)
- {
+ switch (status) {
case HTTP_STATUS_OK:
return L"OK";
case HTTP_STATUS_BAD_REQUEST:
@@ -29,17 +28,15 @@ wchar_t *CDropbox::HttpStatusToText(HTTP_STATUS status) int CDropbox::HandleHttpResponseError(HANDLE hNetlibUser, NETLIBHTTPREQUEST *response)
{
- if (!response)
- {
+ if (!response) {
Netlib_Logf(hNetlibUser, "%s: %s", MODULE, "Server does not respond");
return ACKRESULT_FAILED;
}
- if (response->resultCode != HTTP_STATUS_OK)
- {
+ if (response->resultCode != HTTP_STATUS_OK) {
Netlib_Logf(hNetlibUser, "%s: %s", MODULE, HttpStatusToText((HTTP_STATUS)response->resultCode));
return response->resultCode;
}
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/Dropbox/src/http_request.h b/plugins/Dropbox/src/http_request.h index 7332975291..108b244c6f 100644 --- a/plugins/Dropbox/src/http_request.h +++ b/plugins/Dropbox/src/http_request.h @@ -29,8 +29,7 @@ public: ~HttpRequest()
{
- for (int i = 0; i < headersCount; i++)
- {
+ for (int i = 0; i < headersCount; i++) {
mir_free(headers[i].szName);
mir_free(headers[i].szValue);
}
@@ -89,27 +88,9 @@ public: headersCount++;
}
- /*void AddParameter(LPCSTR szName, LPCSTR szValue)
- {
- if (m_szUrl.Find('?') == -1)
- m_szUrl.AppendFormat("?%s=%s", szName, szValue);
- else
- m_szUrl.AppendFormat("&%s=%s", szName, szValue);
- }
-
- void AddParameter(LPCSTR szName, int value)
- {
- if (m_szUrl.Find('?') == -1)
- m_szUrl.AppendFormat("?%s=%i", szName, value);
- else
- m_szUrl.AppendFormat("&%s=%i", szName, value);
- }*/
-
NETLIBHTTPREQUEST *Send()
{
szUrl = m_szUrl.GetBuffer();
- /*CMStringA message; message.AppendFormat("Send request to %s", szUrl);
- CallService(MS_NETLIB_LOG, (WPARAM)m_hNetlibUser, (LPARAM)message.GetBuffer());*/
return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)this);
}
diff --git a/plugins/Dropbox/src/main.cpp b/plugins/Dropbox/src/main.cpp index 590b9802c4..632464ce33 100644 --- a/plugins/Dropbox/src/main.cpp +++ b/plugins/Dropbox/src/main.cpp @@ -1,5 +1,7 @@ #include "stdafx.h"
+void InitializeIcons();
+
int hLangpack;
CDropbox *dropbox;
HINSTANCE g_hInstance;
@@ -16,7 +18,7 @@ PLUGININFOEX pluginInfo = __AUTHORWEB,
UNICODE_AWARE,
// {B908773A-86F7-4A91-8674-6A20BA0E67D1}
- {0xb908773a, 0x86f7, 0x4a91, {0x86, 0x74, 0x6a, 0x20, 0xba, 0xe, 0x67, 0xd1}}
+ { 0xb908773a, 0x86f7, 0x4a91, { 0x86, 0x74, 0x6a, 0x20, 0xba, 0xe, 0x67, 0xd1 } }
};
@@ -36,8 +38,9 @@ extern "C" int __declspec(dllexport) Load(void) {
mir_getLP(&pluginInfo);
- dropbox = new CDropbox();
+ InitializeIcons();
+ dropbox = new CDropbox();
return 0;
}
diff --git a/plugins/Dropbox/src/stdafx.h b/plugins/Dropbox/src/stdafx.h index 6e736ded62..a575db9b9c 100644 --- a/plugins/Dropbox/src/stdafx.h +++ b/plugins/Dropbox/src/stdafx.h @@ -39,4 +39,9 @@ extern HINSTANCE g_hInstance; #include "dropbox.h"
+// icons
+void InitializeIcons();
+HANDLE GetIconHandle(int iconId);
+HICON LoadIconEx(int iconId, bool big = false);
+
#endif //_COMMON_H_
\ No newline at end of file |