diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2009-11-18 03:09:47 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2009-11-18 03:09:47 +0200 |
commit | 95f46008d2884934fb3186291fceb34f11bf5f0e (patch) | |
tree | d7d19a95500f96fdc890e55d540990bd2b4c307e /watrack_mpd/utilities.c | |
parent | 647648108393008bfa96987d44628b99c602abf0 (diff) |
modified: commonheaders.h
modified: constants.h
new file: globals.h
modified: init.c
modified: main.c
modified: main.h
modified: utilities.c
new file: utilities.h
modified: watrack_mpd.vcproj
Diffstat (limited to 'watrack_mpd/utilities.c')
-rwxr-xr-x | watrack_mpd/utilities.c | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/watrack_mpd/utilities.c b/watrack_mpd/utilities.c index 0d5327a..a01450c 100755 --- a/watrack_mpd/utilities.c +++ b/watrack_mpd/utilities.c @@ -17,7 +17,7 @@ #include "commonheaders.h"
-/*HANDLE CreateThreadEx(pThreadFuncEx AFunc, void* arg, DWORD* pThreadID)
+HANDLE CreateThreadEx(pThreadFuncEx AFunc, void* arg, DWORD* pThreadID)
{
FORK_THREADEX_PARAMS params;
DWORD dwThreadId;
@@ -32,9 +32,9 @@ *pThreadID = dwThreadId;
return hThread;
-}*/
+}
-/*TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef)
+TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef)
{
DBVARIANT dbv = {DBVT_DELETED};
TCHAR* szRes;
@@ -44,7 +44,7 @@ szRes = _tcsdup(dbv.ptszVal);
DBFreeVariant(&dbv);
return szRes;
-}*/
+}
// case-insensitive _tcsstr
/*#define NEWTSTR_ALLOCA(A) (A==NULL)?NULL:_tcscpy((TCHAR*)alloca(sizeof(TCHAR)*(_tcslen(A)+1)),A)
@@ -107,3 +107,52 @@ char *date() d[9]=tmp[5];
return d;
}
+
+int Send(char* data)
+{
+ NETLIBBUFFER nlb;
+ nlb.buf = data;
+ nlb.flags = MSG_DUMPASTEXT;
+ nlb.len = strlen(data)+1;
+ return CallService(MS_NETLIB_SEND,(WPARAM)ghNetlibUser,(LPARAM)&nlb);
+}
+
+int Recv(char *buf)
+{
+ NETLIBBUFFER nlb;
+ nlb.buf = buf;
+ nlb.flags = MSG_DUMPASTEXT;
+ nlb.len = strlen(buf)+1;
+ return CallService(MS_NETLIB_RECV,(WPARAM)ghNetlibUser,(LPARAM)&nlb);
+}
+HANDLE CreatePacketReciever()
+{
+ return (HANDLE)CallService(MS_NETLIB_RECV,(WPARAM)ghNetlibUser,(LPARAM)4096);
+}
+
+NETLIBPACKETRECVER *RecivePackets(int bytesUsed)
+{
+ static NETLIBPACKETRECVER nlpr;
+ nlpr.bytesUsed = bytesUsed;
+ nlpr.dwTimeout = INFINITE;
+ nlpr.cbSize = sizeof(NETLIBPACKETRECVER);
+ CallService(MS_NETLIB_RECV,(WPARAM)ghPacketReciever,(LPARAM)&nlpr);
+ return &nlpr;
+}
+HANDLE NetLib_CreateConnection(HANDLE hUser, NETLIBOPENCONNECTION* nloc) //from icq )
+{
+ HANDLE hConnection;
+
+ nloc->cbSize = sizeof(NETLIBOPENCONNECTION);
+ nloc->flags |= NLOCF_V2;
+
+ hConnection = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hUser, (LPARAM)nloc);
+ if (!hConnection && (GetLastError() == 87))
+ { // this ensures, an old Miranda will be able to connect also
+ nloc->cbSize = NETLIBOPENCONNECTION_V1_SIZE;
+ hConnection = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hUser, (LPARAM)nloc);
+ }
+ return hConnection;
+}
+
+
|