diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-31 17:34:45 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-31 17:34:45 +0000 |
commit | 9f32f113a011e34338b76eef83da6f006d528e61 (patch) | |
tree | e5b37d4a1c7073288556b7e2526561230acf96d9 /plugins/SecureIM | |
parent | d57b6799dac75f3c428393666d079fe59361c4b5 (diff) |
fixes for the file sending
git-svn-id: http://svn.miranda-ng.org/main/trunk@13940 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SecureIM')
-rw-r--r-- | plugins/SecureIM/src/main.cpp | 2 | ||||
-rw-r--r-- | plugins/SecureIM/src/svcs_proto.cpp | 149 | ||||
-rw-r--r-- | plugins/SecureIM/src/svcs_proto.h | 2 |
3 files changed, 0 insertions, 153 deletions
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index feb7457e77..3c77fe47c2 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -221,7 +221,6 @@ static int onModulesLoaded(WPARAM, LPARAM) HookEvent(ME_OPT_INITIALISE, onRegisterOptions);
if (bPopupExists)
HookEvent(ME_OPT_INITIALISE, onRegisterPopOptions);
- HookEvent(ME_PROTO_ACK, onProtoAck);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
HookEvent(ME_DB_CONTACT_ADDED, onContactAdded);
HookEvent(ME_DB_CONTACT_DELETED, onContactDeleted);
@@ -229,7 +228,6 @@ static int onModulesLoaded(WPARAM, LPARAM) // hook message transport
CreateProtoServiceFunction(MODULENAME, PSR_MESSAGE, onRecvMsg);
CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE, onSendMsg);
- CreateProtoServiceFunction(MODULENAME, PSS_FILE, onSendFile);
// create a menu item for creating a secure im connection to the user.
g_hMenu[0] = AddMenuItem(sim301, 110000, g_hICO[ICO_CM_EST], MODULENAME"/SIM_EST", CMIF_NOTOFFLINE);
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index e254f7b81e..e1b9d45e13 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -749,152 +749,3 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) Sent_NetLog("onSendMsg: pass unchanged to chain");
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
-
-int file_idx = 0;
-
-INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam)
-{
- CCSDATA *pccsd = (CCSDATA*)lParam;
-
- pUinKey ptr = getUinKey(pccsd->hContact);
- if (!ptr || !bSFT)
- return CallService(PSS_FILE, wParam, lParam);
-
- if (isContactSecured(pccsd->hContact)&SECURED) {
- char **file = (char **)pccsd->lParam;
- if (file_idx == 100) file_idx = 0;
- int i;
- for (i = 0; file[i]; i++) {
-
- if (strstr(file[i], ".AESHELL")) continue;
-
- char *name = strrchr(file[i], '\\');
- if (!name) name = file[i];
- else name++;
-
- int size = TEMP_SIZE + (int)mir_strlen(name) + 20;
- char *file_out = (char *)mir_alloc(size);
- mir_snprintf(file_out, size, "%s\\%s.AESHELL(%d)", TEMP, name, file_idx++);
-
- char buf[MAX_PATH];
- mir_snprintf(buf, SIZEOF(buf), "%s\n%s", Translate(sim011), file[i]);
- showPopup(buf, NULL, g_hPOP[POP_PU_MSS], 2);
-
- if (ptr->mode == MODE_RSAAES)
- exp->rsa_encrypt_file(ptr->cntx, file[i], file_out);
- else
- cpp_encrypt_file(ptr->cntx, file[i], file_out);
-
- mir_free(file[i]);
- file[i] = file_out;
- }
- if (ptr->fileSend) { // очистим сохраненный список
- for (int j = 0; ptr->fileSend[j]; j++)
- mir_free(ptr->fileSend[j]);
-
- SAFE_FREE(ptr->fileSend);
- }
- if (i) { // скопируем новый список
- ptr->fileSend = (char **)mir_alloc(sizeof(char*)*(i + 1));
- for (i = 0; file[i]; i++)
- ptr->fileSend[i] = mir_strdup(file[i]);
-
- ptr->fileSend[i] = NULL;
- }
- }
- return CallService(PSS_FILE, wParam, lParam);
-}
-
-int __cdecl onProtoAck(WPARAM wParam, LPARAM lParam)
-{
- ACKDATA *ack = (ACKDATA*)lParam;
- if (ack->type != ACKTYPE_FILE) return 0; //quit if not file transfer event
- PROTOFILETRANSFERSTATUS *f = (PROTOFILETRANSFERSTATUS*)ack->lParam;
- if (!f)
- return 0;
-
- pUinKey ptr = getUinKey(ack->hContact);
- if (!ptr || ((f->flags & PFTS_SENDING) && !bSFT)) return 0;
-
- if (isContactSecured(ack->hContact)&SECURED) {
- switch (ack->result) {
- case ACKRESULT_DATA:
- if (f->flags & PFTS_SENDING) {
- ptr->finFileSend = (f->currentFileSize == f->currentFileProgress);
- if (!ptr->lastFileSend)
- ptr->lastFileSend = mir_strdup(f->szCurrentFile);
- }
- else {
- ptr->finFileRecv = (f->currentFileSize == f->currentFileProgress);
- if (!ptr->lastFileRecv)
- ptr->lastFileRecv = mir_strdup(f->szCurrentFile);
- }
- break;
-
- case ACKRESULT_DENIED:
- case ACKRESULT_FAILED:
- if (ptr->lastFileRecv) {
- if (strstr(ptr->lastFileRecv, ".AESHELL")) mir_unlink(ptr->lastFileRecv);
- SAFE_FREE(ptr->lastFileRecv);
- }
- if (ptr->lastFileSend) {
- if (strstr(ptr->lastFileSend, ".AESHELL")) mir_unlink(ptr->lastFileSend);
- SAFE_FREE(ptr->lastFileSend);
- }
- if (ptr->fileSend) {
- char **file = ptr->fileSend;
- for (int j = 0; file[j]; j++) {
- if (strstr(file[j], ".AESHELL")) mir_unlink(file[j]);
- mir_free(file[j]);
- }
- SAFE_FREE(ptr->fileSend);
- }
- return 0;
-
- case ACKRESULT_NEXTFILE:
- case ACKRESULT_SUCCESS:
- if (ptr->finFileRecv && ptr->lastFileRecv) {
- if (strstr(ptr->lastFileRecv, ".AESHELL")) {
- char buf[MAX_PATH];
- LPSTR file_out = mir_strdup(ptr->lastFileRecv);
- LPSTR pos = strrchr(file_out, '.'); //find last .
- if (pos) *pos = '\0'; //remove AESHELL from name
-
- if (isFileExist(file_out)) {
- buf[0] = '\0';
- LPSTR p = strrchr(file_out, '.');
- LPSTR x = strrchr(file_out, '\\');
- if (p > x) {
- strncpy(buf, p, sizeof(buf)-1);
- pos = p;
- }
- for (int i = 1; i < 10000; i++) {
- sprintf(pos, " (%d)%s", i, buf); //!!!!!!!!!!!!!
- if (!isFileExist(file_out)) break;
- }
- }
-
- mir_snprintf(buf, SIZEOF(buf), "%s\n%s", Translate(sim012), file_out);
- showPopup(buf, NULL, g_hPOP[POP_PU_MSR], 2);
-
- if (ptr->mode == MODE_RSAAES)
- exp->rsa_decrypt_file(ptr->cntx, ptr->lastFileRecv, file_out);
- else
- cpp_decrypt_file(ptr->cntx, ptr->lastFileRecv, file_out);
-
- mir_free(file_out);
- mir_unlink(ptr->lastFileRecv);
- }
- SAFE_FREE(ptr->lastFileRecv);
- ptr->finFileRecv = false;
- }
- if (ptr->finFileSend && ptr->lastFileSend) {
- if (strstr(ptr->lastFileSend, ".AESHELL")) mir_unlink(ptr->lastFileSend);
- SAFE_FREE(ptr->lastFileSend);
- ptr->finFileSend = false;
- }
- break;
- }
- }
- return 0;
-}
diff --git a/plugins/SecureIM/src/svcs_proto.h b/plugins/SecureIM/src/svcs_proto.h index 8b7aa6e398..f679c12f9c 100644 --- a/plugins/SecureIM/src/svcs_proto.h +++ b/plugins/SecureIM/src/svcs_proto.h @@ -3,9 +3,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM,LPARAM);
INT_PTR __cdecl onSendMsg(WPARAM,LPARAM);
-INT_PTR __cdecl onSendFile(WPARAM,LPARAM);
-int __cdecl onProtoAck(WPARAM,LPARAM);
int __cdecl onContactSettingChanged(WPARAM,LPARAM);
#endif
|