summaryrefslogtreecommitdiff
path: root/plugins/SecureIM/src/svcs_proto.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SecureIM/src/svcs_proto.cpp')
-rw-r--r--plugins/SecureIM/src/svcs_proto.cpp149
1 files changed, 0 insertions, 149 deletions
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;
-}