summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-08-29 18:56:24 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-08-29 18:56:24 +0000
commitd49df717ef089662383a271b45937aafda6399d8 (patch)
treecd8b8a9909209de93d6fc2bc8bc4ebd5bdef1f24
parent38200b7236c5c290d75a36cb431c78beeb98dbbd (diff)
PF4_SINGLEFILEONLY - protocol can require sending files only one by one
git-svn-id: http://svn.miranda-ng.org/main/trunk@10337 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/delphi/m_protosvc.inc22
-rw-r--r--include/m_protosvc.h22
-rw-r--r--src/core/stdfile/filesenddlg.cpp22
3 files changed, 39 insertions, 27 deletions
diff --git a/include/delphi/m_protosvc.inc b/include/delphi/m_protosvc.inc
index fff2e30ad6..7477f4000e 100644
--- a/include/delphi/m_protosvc.inc
+++ b/include/delphi/m_protosvc.inc
@@ -116,19 +116,21 @@ const
PFLAGNUM_3 = 3; //the status modes that the protocol supports
//away-style messages for. Uses the PF2_ flags.
- PFLAGNUM_4 = 4; // v0.3+: flag asking a protocol plugin how auths are handled
+ PFLAGNUM_4 = 4; // another bunch of flags
+
PF4_FORCEAUTH = $00000001; // protocol has to send auth's for things to work
PF4_FORCEADDED = $00000002; // protocol has to tell people that they were added (otherwise things don't work)
PF4_NOCUSTOMAUTH = $00000004; // protocol can't send a custom message while asking others for auth
- PF4_SUPPORTTYPING = $00000008; // protocol supports user is typing messages v0.3.3+
- PF4_SUPPORTIDLE = $00000010; // protocol understands idle, added during v0.3.4+ (2004/09/13)
- PF4_AVATARS = $00000020; // protocol has avatar support, added during v0.3.4 (2004/09/13)
- PF4_OFFLINEFILES = $00000040; // protocols supports sending files to offline users (v0.5.2)
- PF4_IMSENDUTF = $00000080; // protocol is able to process messages in utf-8 (v.0.7.0+)
- PF4_IMSENDOFFLINE = $00000100; // protocol supports sending offline messages (v0.8.0+)
- PF4_INFOSETTINGSVC = $00000200; // protocol supports user info translation services (v0.8.0+)
- PF4_NOAUTHDENYREASON = $00000400; // protocol doesn't support authorization deny reason (v0.9.0+)
- PF4_GROUPCHATFILES = $00000800; // protocol supports sending files to group chats (v0.95.2+)
+ PF4_SUPPORTTYPING = $00000008; // protocol supports user is typing messages
+ PF4_SUPPORTIDLE = $00000010; // protocol understands idle
+ PF4_AVATARS = $00000020; // protocol has avatar support
+ PF4_OFFLINEFILES = $00000040; // protocols supports sending files to offline users
+ PF4_IMSENDUTF = $00000080; // protocol is able to process messages in utf-8
+ PF4_IMSENDOFFLINE = $00000100; // protocol supports sending offline messages
+ PF4_INFOSETTINGSVC = $00000200; // protocol supports user info translation services
+ PF4_NOAUTHDENYREASON = $00000400; // protocol doesn't support authorization deny reason
+ PF4_GROUPCHATFILES = $00000800; // protocol supports sending files to group chats
+ PF4_SINGLEFILEONLY = $00001000; // protocol supports sending files one by one only
PFLAG_UNIQUEIDTEXT = 100; // returns a static buffer of text describing the unique field by which this protocol identifies users (already translated), or NULL
PFLAG_MAXCONTACTSPERPACKET = 200; // v0.1.2.2+: returns the maximum number of contacts which can be sent in a single PSS_CONTACTS. lParam=(LPARAM)hContact.
diff --git a/include/m_protosvc.h b/include/m_protosvc.h
index fa5c3cb3ad..c216ad1a98 100644
--- a/include/m_protosvc.h
+++ b/include/m_protosvc.h
@@ -131,19 +131,21 @@ static __inline unsigned long Proto_Status2Flag(int status)
return 0;
}
-#define PFLAGNUM_4 4 //misc options
+#define PFLAGNUM_4 4 // another bunch of flags
+
#define PF4_FORCEAUTH 0x00000001 // forces auth requests to be sent when adding users
#define PF4_FORCEADDED 0x00000002 // forces "you were added" requests to be sent
#define PF4_NOCUSTOMAUTH 0x00000004 // protocol doesn't support custom auth text (doesn't show auth text box)
-#define PF4_SUPPORTTYPING 0x00000008 // protocol supports user is typing messages v0.3.3+
-#define PF4_SUPPORTIDLE 0x00000010 // protocol understands idle, added during v0.3.4+ (2004/09/13)
-#define PF4_AVATARS 0x00000020 // protocol has avatar support, added during v0.3.4 (2004/09/13)
-#define PF4_OFFLINEFILES 0x00000040 // protocols supports sending files to offline users (v0.5.2)
-#define PF4_IMSENDUTF 0x00000080 // protocol is able to process messages in utf-8 (v.0.7.0+)
-#define PF4_IMSENDOFFLINE 0x00000100 // protocol supports sending offline messages (v0.8.0+)
-#define PF4_INFOSETTINGSVC 0x00000200 // protocol supports user info translation services (v0.8.0+)
-#define PF4_NOAUTHDENYREASON 0x00000400 // protocol doesn't support authorization deny reason (v0.9.0+)
-#define PF4_GROUPCHATFILES 0x00000800 // protocol supports sending files to group chats (v0.95.2+)
+#define PF4_SUPPORTTYPING 0x00000008 // protocol supports user is typing messages
+#define PF4_SUPPORTIDLE 0x00000010 // protocol understands idle
+#define PF4_AVATARS 0x00000020 // protocol has avatar support
+#define PF4_OFFLINEFILES 0x00000040 // protocols supports sending files to offline users
+#define PF4_IMSENDUTF 0x00000080 // protocol is able to process messages in utf-8
+#define PF4_IMSENDOFFLINE 0x00000100 // protocol supports sending offline messages
+#define PF4_INFOSETTINGSVC 0x00000200 // protocol supports user info translation services
+#define PF4_NOAUTHDENYREASON 0x00000400 // protocol doesn't support authorization deny reason
+#define PF4_GROUPCHATFILES 0x00000800 // protocol supports sending files to group chats
+#define PF4_SINGLEFILEONLY 0x00001000 // protocol supports sending files one by one only
#define PFLAG_UNIQUEIDTEXT 100 //returns a static buffer of text describing the unique field by which this protocol identifies users (already translated), or NULL
diff --git a/src/core/stdfile/filesenddlg.cpp b/src/core/stdfile/filesenddlg.cpp
index 7a9fc85a4c..2772e9503c 100644
--- a/src/core/stdfile/filesenddlg.cpp
+++ b/src/core/stdfile/filesenddlg.cpp
@@ -138,26 +138,34 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf)
void __cdecl ChooseFilesThread(void* param)
{
HWND hwndDlg = (HWND)param;
- TCHAR filter[128], *pfilter;
- TCHAR *buf = (TCHAR*)mir_alloc(sizeof(TCHAR)* 32767);
+ FileDlgData *dat = (FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ TCHAR *buf = (TCHAR*)mir_alloc(sizeof(TCHAR) * 32767);
if (buf == NULL) {
PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, (LPARAM)(TCHAR*)NULL);
return;
}
- OPENFILENAME ofn = { 0 };
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- ofn.hwndOwner = hwndDlg;
+ TCHAR filter[128];
lstrcpy(filter, TranslateT("All files"));
lstrcat(filter, _T(" (*)"));
- pfilter = filter + lstrlen(filter) + 1;
+ TCHAR *pfilter = filter + lstrlen(filter) + 1;
lstrcpy(pfilter, _T("*"));
pfilter = filter + lstrlen(filter) + 1;
pfilter[0] = '\0';
+
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ ofn.hwndOwner = hwndDlg;
ofn.lpstrFilter = filter;
ofn.lpstrFile = buf; *buf = 0;
ofn.nMaxFile = 32767;
- ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
+ ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
+
+ char *szProto = GetContactProto(dat->hContact);
+ if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SINGLEFILEONLY))
+ ofn.Flags |= OFN_ALLOWMULTISELECT;
+
if (GetOpenFileName(&ofn))
PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, (LPARAM)buf);
else {