summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/delphi/m_helpers.inc9
-rw-r--r--include/delphi/m_netlib.inc29
-rw-r--r--include/m_core.h2
-rw-r--r--include/m_netlib.h53
-rw-r--r--include/m_protoint.h4
5 files changed, 22 insertions, 75 deletions
diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc
index 0c98ecd947..dd81e8e534 100644
--- a/include/delphi/m_helpers.inc
+++ b/include/delphi/m_helpers.inc
@@ -16,8 +16,6 @@ function CreateVersionStringPlugin(pluginInfo:PPluginInfoEx;buf:PAnsiChar):PAnsi
function PLUGIN_MAKE_VERSION(a,b,c,d: Cardinal): int;
function PLUGIN_CMP_VERSION(verA: LongInt; verB: LongInt): int;
-procedure Netlib_Log(hNetLib: THANDLE; const sz: PAnsiChar);
-
function mir_hashstr (const key:PAnsiChar):uint; {inline;}
function mir_hashstrW(const key:PWideChar):uint; {inline;}
function lrtrim (str:PAnsiChar):PAnsiChar; {inline}
@@ -173,13 +171,6 @@ begin
Inc(Result, (verA and $FF000000) - (verB and $FF000000));
end;
-procedure Netlib_Log(hNetLib: THANDLE; const sz: PAnsiChar);
- {$IFDEF AllowInline}inline;{$ENDIF}
-begin
- CallService(MS_NETLIB_LOG, hNetLib, lParam(sz));
-end;
-
-
function mir_hashstr(const key:PAnsiChar):uint; {inline;}
var
len:int;
diff --git a/include/delphi/m_netlib.inc b/include/delphi/m_netlib.inc
index 3a9512cb49..7772113a94 100644
--- a/include/delphi/m_netlib.inc
+++ b/include/delphi/m_netlib.inc
@@ -187,7 +187,6 @@ type
PNETLIBUSER = ^TNETLIBUSER;
TNETLIBUSER = record
- cbSize: int;
szSettingsModule: PAnsiChar; // used for DB settings and log, 'NL' stuff
szDescriptiveName: TChar; // shows a descriptive name for which different proxy settings can be defined
flags: dword; // see NUF_* constants above
@@ -293,10 +292,7 @@ type
buffer : PByte; // contains the read data
end;
-const
{
- wParam : 0
- lParam : Pointer to an initalised TNETLIBUSER structure
Affects: Initialises the netlib for a set of connections, see notes
Returns: Returns a handle for future netlib calls, NULL on failure.
Notes : Netlib is loaded AFTER all plugins, thus a call to this service
@@ -311,8 +307,8 @@ const
Version: v0.1.2.2+
Errors : ERROR_INVALID_PARAMETER, ERROR_OUTOFMEMORY, ERROR_DUP_NAME
}
- MS_NETLIB_REGISTERUSER:PAnsiChar = 'Netlib/RegisterUser';
+function Netlib_RegisterUser(pInfo:PNETLIBUSER) : THANDLE; stdcall; external AppDll;
{
wParam : HANDLE
@@ -326,10 +322,11 @@ const
Version: v0.1.2.2+
Errors : ERROR_INVALID_PARAMETER
}
+
+const
MS_NETLIB_GETUSERSETTINGS:PAnsiChar = 'Netlib/GetUserSettings';
+
{
- wParam : HANDLE / SOCKET
- lParam : 0
Affects: Closes a handle, see notes
Returns: Returns [non zero] on success, NULL(0) on failure
Notes : All netlib handles should be closed once they're finished with,
@@ -681,8 +678,6 @@ const
MS_NETLIB_GETMOREPACKETS:PAnsiChar = 'Netlib/GetMorePackets';
{
- wParam : HANDLE
- lParam : Pointer to null terminated string to uh, log.
Affect : Add a message to the log (if it's running) see notes
Returns: non zeror on success, NULL(0) on failure
Notes : Don't include \r\n or #13#10 it's not needed,
@@ -692,17 +687,9 @@ const
if you want that.
Errors : ERROR_INVALID_PARAMETER
}
- MS_NETLIB_LOG:PAnsiChar = 'Netlib/Log';
- MS_NETLIB_LOGW:PAnsiChar = 'Netlib/LogW';
- {
- Sets a gateway polling timeout interval
- wParam=(WPARAM)(HANDLE)hConn
- lParam=(LPARAM)timeout
- Returns previous timeout value
- Errors: -1
- }
- MS_NETLIB_SETPOLLINGTIMEOUT:PAnsiChar = 'Netlib/SetPollingTimeout';
+function Netlib_Log(nlu:THANDLE; str:PAnsiChar) : int; stdcall; external AppDll;
+function Netlib_LogW(nlu:THANDLE; str:PWideChar) : int; stdcall; external AppDll;
{
Makes connection SSL
@@ -710,6 +697,8 @@ const
lParam=0
Returns 0 on failure 1 on success
}
+
+const
MS_NETLIB_STARTSSL:PAnsiChar = 'Netlib/StartSsl';
type
@@ -719,7 +708,7 @@ type
flags :int; // Reserved
end;
- const
+const
/////////////////////////////////////////////////////////////////////////////////////////
// Security providers (0.6+)
diff --git a/include/m_core.h b/include/m_core.h
index 30ba841309..efd7e6ba7c 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -43,8 +43,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef MIR_APP_EXPORTS
#define MIR_APP_EXPORT __declspec(dllexport)
+ typedef struct NetlibUser* HNETLIBUSER;
#else
#define MIR_APP_EXPORT __declspec(dllimport)
+ DECLARE_HANDLE(HNETLIBUSER);
#endif
#define MIR_APP_DLL(T) MIR_APP_EXPORT T __stdcall
diff --git a/include/m_netlib.h b/include/m_netlib.h
index 51b18adc48..99a728ec0a 100644
--- a/include/m_netlib.h
+++ b/include/m_netlib.h
@@ -46,9 +46,7 @@ struct NETLIBOPENCONNECTION;
/////////////////////////////////////////////////////////////////////////////////////////
// Initialises the netlib for a set of connections
-// wParam = 0
-// lParam = (LPARAM)(NETLIBUSER*)&nu
-// Returns a HANDLE to be used for future netlib calls, NULL on failure
+// Returns a HNETLIBUSER to be used for future netlib calls, NULL on failure
// NOTE: Netlib is loaded after any plugins, so you need to wait until
// ME_SYSTEM_MODULESLOADED before calling this function
// Netlib settings are stored under the module szSettingsModule
@@ -66,7 +64,6 @@ typedef PBYTE (*NETLIBHTTPGATEWAYUNWRAPRECVPROC)(NETLIBHTTPREQUEST *nlhr, PBYTE
struct NETLIBUSER
{
- int cbSize;
char *szSettingsModule; // used for db settings and log
union {
char *szDescriptiveName; // used in options dialog, already translated
@@ -88,8 +85,9 @@ struct NETLIBUSER
#define NUF_NOOPTIONS 0x08 // don't create an options page for this. szDescriptiveName is never used.
#define NUF_HTTPCONNS 0x10 // at least some connections are made for HTTP communication. Enables the HTTP proxy option in options.
#define NUF_NOHTTPSOPTION 0x20 // disable the HTTPS proxy option in options. Use this if all communication is HTTP.
-#define NUF_UNICODE 0x40 // if set ptszDescriptiveName points to Unicode, otherwise it points to ANSI string
-#define MS_NETLIB_REGISTERUSER "Netlib/RegisterUser"
+#define NUF_UNICODE 0x40 // if set ptszDescriptiveName points to Unicode, otherwise it points to ANSI string
+
+EXTERN_C MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *pDescr);
/////////////////////////////////////////////////////////////////////////////////////////
// Assign a Netlib user handle a set of dynamic HTTP headers to be used with all
@@ -735,17 +733,6 @@ struct NETLIBPACKETRECVER
#define MS_NETLIB_GETMOREPACKETS "Netlib/GetMorePackets"
/////////////////////////////////////////////////////////////////////////////////////////
-// Add a message to the log (if it's running)
-// wParam = (WPARAM)(HANDLE)hUser
-// lParam = (LPARAM)(const char *)szMessage
-// Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
-// Do not include a final line ending in szMessage.
-// Errors: ERROR_INVALID_PARAMETER
-
-#define MS_NETLIB_LOG "Netlib/Log"
-#define MS_NETLIB_LOGW "Netlib/LogW"
-
-/////////////////////////////////////////////////////////////////////////////////////////
// Sets a gateway polling timeout interval
// wParam = (WPARAM)(HANDLE)hConn
// lParam = (LPARAM)timeout
@@ -770,35 +757,13 @@ struct NETLIBSSL
};
/////////////////////////////////////////////////////////////////////////////////////////
-// here's a handy piece of code to let you log using printf-style specifiers:
-// #include <stdarg.h> and <stdio.h> before including this header in order to
-// use it.
-
-#if defined va_start && (defined _STDIO_DEFINED || defined _STDIO_H_ || defined _INC_STDIO) && (!defined NETLIB_NOLOGGING)
-#pragma warning(disable:4505)
+// netlib log funcitons
-__inline INT_PTR Netlib_Logf(HANDLE hUser, const char *fmt, ...)
-{
- va_list va;
- va_start(va, fmt);
- char szText[1024];
- mir_vsnprintf(szText, _countof(szText), fmt, va);
- va_end(va);
- return CallService(MS_NETLIB_LOG, (WPARAM)hUser, (LPARAM)szText);
-}
-
-__inline INT_PTR Netlib_LogfW(HANDLE hUser, const wchar_t *fmt, ...)
-{
- va_list va;
- va_start(va, fmt);
- wchar_t szText[1024];
- mir_vsnwprintf(szText, _countof(szText), fmt, va);
- va_end(va);
- return CallService(MS_NETLIB_LOGW, (WPARAM)hUser, (LPARAM)szText);
-}
+EXTERN_C MIR_APP_DLL(int) Netlib_Log(HNETLIBUSER hUser, const char *pszStr);
+EXTERN_C MIR_APP_DLL(int) Netlib_LogW(HNETLIBUSER hUser, const wchar_t *pwszStr);
-#define Netlib_LogfT Netlib_LogfW
-#endif // defined va_start
+EXTERN_C MIR_APP_DLL(int) Netlib_Logf(HNETLIBUSER hUser, const char *fmt, ...);
+EXTERN_C MIR_APP_DLL(int) Netlib_LogfW(HNETLIBUSER hUser, const wchar_t *fmt, ...);
/////////////////////////////////////////////////////////////////////////////////////////
// Security providers (0.6+)
diff --git a/include/m_protoint.h b/include/m_protoint.h
index 0f33c206b0..bef636a157 100644
--- a/include/m_protoint.h
+++ b/include/m_protoint.h
@@ -89,10 +89,10 @@ struct MIR_APP_EXPORT PROTO_INTERFACE : public MZeroedObject
m_iDesiredStatus, // status to be set after logging in
m_iXStatus, // extanded status
m_iVersion; // version 2 or higher designate support of Unicode services
- wchar_t* m_tszUserName; // human readable protocol's name
+ wchar_t* m_tszUserName; // human readable protocol's name
char* m_szModuleName; // internal protocol name, also its database module name
HANDLE m_hProtoIcon; // icon to be displayed in the account manager
- HANDLE m_hNetlibUser; // network agent
+ HNETLIBUSER m_hNetlibUser; // network agent
MWindowList m_hWindowList; // list of all windows which belong to this protocol's instance
HGENMENU m_hMainMenuItem; // if protocol menus are displayed in the main menu, this is the root