diff options
Diffstat (limited to 'plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda')
8 files changed, 0 insertions, 1795 deletions
diff --git a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/imoproxy.c b/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/imoproxy.c deleted file mode 100644 index 195f479ea6..0000000000 --- a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/imoproxy.c +++ /dev/null @@ -1,882 +0,0 @@ -/* Module: imoproxy.c
- Purpose: Proxy-DLL for Miranda IM to load imo2sproxy as plugin
- Author: leecher
- Date: 26.10.2009
-*/
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <winsock2.h>
-#include <prsht.h>
-#include <commdlg.h>
-#include <stdlib.h>
-#include <io.h>
-#include <fcntl.h>
-#include <process.h>
-#pragma comment (lib, "Ws2_32.lib")
-#include <stdio.h>
-#include "io_layer.h"
-#include "imo2sproxy.h"
-#include "imo_request.h"
-#include "socksproxy.h"
-#include "w32skypeemu.h"
-#include "skypepluginlink.h"
-#include "include/newpluginapi.h"
-#include "include/m_langpack.h"
-#include "include/m_options.h"
-#include "include/m_database.h"
-#include "include/m_system.h"
-#include "sdk/m_updater.h"
-#include "resource.h"
-
-// Crash dumper
-#ifdef _DEBUG
-void CrashLog (const char *pszFormat, ...)
-{
- static FILE *fpLog = NULL;
- char szLine[1024];
- va_list ap;
-
- if (!fpLog) fpLog=fopen("imoproxy.log", "a");
- va_start(ap, pszFormat);
- _vsnprintf(szLine, sizeof(szLine), pszFormat, ap);
- va_end(ap);
-
- if (fpLog)
- {
- fprintf (fpLog, "%s", szLine);
- fflush (fpLog);
- }
-}
-#define LOG(_args_) CrashLog _args_
-#ifndef _WIN64
-#include "crash.c"
-#endif
-#endif
-
-
-PLUGINLINK *pluginLink;
-HINSTANCE m_hInst;
-static HANDLE m_hOptHook=NULL, m_hPreShutdownHook=NULL, m_hHookModulesLoaded=NULL;
-
-#define PROXY_SOCKS 0
-#define PROXY_W32SKYPEEMU 1
-#define PROXY_SKYPEPLUGIN 2
-#define PROXY_MAX 3
-
-static IMO2SPROXY_CFG m_stCfg;
-static SOCKSPROXY_CFG m_stSocksCfg;
-static W32SKYPEEMU_CFG m_stSypeEmuCfg;
-static SKYPEPLUGINLINK_CFG m_stSkypePluginCfg;
-
-static IMO2SPROXY *m_apProxy[PROXY_MAX] = {0};
-static HANDLE m_hThread[PROXY_MAX]={0}, m_hEvent = INVALID_HANDLE_VALUE;
-static BOOL m_bConsole = FALSE;
-
-#define ANY_SIZE 1
-
-typedef struct _MIB_IPADDRROW {
- DWORD dwAddr;
- DWORD dwIndex;
- DWORD dwMask;
- DWORD dwBCastAddr;
- DWORD dwReasmSize;
- unsigned short unused1;
- unsigned short wType;
-}MIB_IPADDRROW, *PMIB_IPADDRROW;
-
-typedef struct _MIB_IPADDRTABLE {
- DWORD dwNumEntries;
- MIB_IPADDRROW table[ANY_SIZE];
-}MIB_IPADDRTABLE, *PMIB_IPADDRTABLE;
-
-
-// Plugin Info
-#define PINFO \
- "imo2sproxy-Plugin", \
- PLUGIN_MAKE_VERSION(1,0,0,15), \
- "Tunnelling Skype traffic via imo.im Web service", \
- "leecher", \
- "leecher@dose.0wnz.at", \
- "© 2010-2012 leecher", \
- "http://dose.0wnz.at", \
- 0, \
- 0 //doesn't replace anything built-in
-
-
-PLUGININFO pluginInfo = {
- sizeof(PLUGININFO),
- PINFO
-};
-
-// New plugininfo
-PLUGININFOEX pluginInfoEx = {
- sizeof (pluginInfoEx),
- PINFO,
- { 0x3005c2b1, 0x4278, 0x470c, { 0x94, 0x98, 0x5, 0x95, 0x3d, 0xfa, 0x4d, 0x88 } } // // {3005C2B1-4278-470c-9498-05953DFA4D88}
-};
-
-// Whatever this is...
-// {95061E8D-B18C-4c1c-8E14-686DE967D851}
-#define MIID_IMOPROXY { 0x95061e8d, 0xb18c, 0x4c1c, { 0x8e, 0x14, 0x68, 0x6d, 0xe9, 0x67, 0xd8, 0x51 } }
-static const MUUID interfaces[] = { MIID_IMOPROXY, MIID_LAST };
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-int ShowError( FILE *stream, const char *format, ...)
-{
- char szBuf[1024];
- va_list ap;
- int iRet;
-
- va_start(ap, format);
- iRet = _vsnprintf (szBuf, sizeof(szBuf), format, ap);
- va_end(ap);
-
- MessageBox (NULL, szBuf, Translate("IMOPROXY Error"), MB_ICONSTOP | MB_OK);
- return iRet;
-}
-
-// -----------------------------------------------------------------------------
-
-static void LoadSettings(void)
-{
- DBVARIANT dbv;
-
- // General config
- if (!m_bConsole)
- {
- if (DBGetContactSetting(NULL, "IMOPROXY", "Logfile", &dbv)==0)
- {
- if ((m_stCfg.bVerbose = DBGetContactSettingByte(NULL, "IMOPROXY", "Verbose", 0)) &&
- *dbv.pszVal)
- {
- if (m_stCfg.fpLog) fclose (m_stCfg.fpLog);
- if (!(m_stCfg.fpLog = fopen(dbv.pszVal, "a")))
- {
- char szMsg[MAX_PATH+64];
-
- sprintf (szMsg, Translate("Cannot open Logfile %s for writing."), dbv.pszVal);
- MessageBox(NULL,szMsg,"IMOPROXY", MB_OK | MB_ICONWARNING);
- m_stCfg.bVerbose = FALSE;
- }
- }
- DBFreeVariant(&dbv);
- }
- }
- m_stCfg.iFlags = DBGetContactSettingDword(NULL, "IMOPROXY", "Flags", 0);
- if (DBGetContactSetting(NULL, "IMOPROXY", "User", &dbv)==0)
- {
- if (m_stCfg.pszUser) free(m_stCfg.pszUser);
- m_stCfg.pszUser = strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- if (DBGetContactSetting(NULL, "IMOPROXY", "Password", &dbv)==0)
- {
- if (m_stCfg.pszPass) free(m_stCfg.pszPass);
- m_stCfg.pszPass = strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
- }
-
- // Socks Proxy config
- m_stSocksCfg.sPort = DBGetContactSettingWord(NULL, "IMOPROXY", "Port", 1401);
- if (DBGetContactSetting(NULL, "IMOPROXY", "Host", &dbv)==0)
- {
- m_stSocksCfg.lAddr = inet_addr(dbv.pszVal);
- DBFreeVariant(&dbv);
- }
-}
-
-// -----------------------------------------------------------------------------
-
-static BOOL CheckSettings(int iMask)
-{
- DBVARIANT dbv;
-
- if (iMask & PROXY_SOCKS)
- {
- if (DBGetContactSetting(NULL, SKYPE_PROTONAME, "Host", &dbv)==0)
- {
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseSkype2Socket", 0) &&
- (lstrcmp (dbv.pszVal, "127.0.0.1")==0 ||
- lstrcmp (dbv.pszVal, "localhost")==0) &&
- DBGetContactSettingWord(NULL, SKYPE_PROTONAME, "Port", 0) ==
- DBGetContactSettingWord(NULL, "IMOPROXY", "Port", 1401))
- {
- DBFreeVariant(&dbv);
- return TRUE;
- }
- DBFreeVariant(&dbv);
- }
- }
- if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "FirstRun", 9) == 9)
- {
- MessageBox (NULL, Translate("SKYPE plugin may not be installed, this plugin only works together with "
- "the SKYPE-plugin. Please check if you installed and enabled it."), "IMOPROXY",
- MB_OK | MB_ICONWARNING);
- }
- else
- {
-
- if ((iMask & PROXY_SOCKS) && !ServiceExists(SKYPE_PROTONAME PSS_SKYPEAPIMSG) )
- {
- if (MessageBox (NULL, Translate("Your Skype plugin currently doesn't seem to be setup to use imo2proxy, "
- "do you want me to change its settings so that it uses this plugins?"), "IMOPROXY",
- MB_YESNO | MB_ICONQUESTION) == IDYES)
- {
- DBWriteContactSettingByte (NULL, SKYPE_PROTONAME, "UseSkype2Socket", 1);
- DBWriteContactSettingWord (NULL, SKYPE_PROTONAME, "Port", m_stSocksCfg.sPort);
- DBWriteContactSettingString (NULL, SKYPE_PROTONAME, "Host", "127.0.0.1");
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-
-// -----------------------------------------------------------------------------
-
-static BOOL EnumNetInterfaces (HWND hwndControl)
-{
- HINSTANCE hLib;
- BOOL bRet = FALSE;
-
- if (hLib = LoadLibrary("Iphlpapi.dll"))
- {
- PMIB_IPADDRTABLE pTable;
- ULONG uSize=1;
- DWORD i;
- FARPROC GetIpAddrTable;
-
- if (GetIpAddrTable = (FARPROC)GetProcAddress (hLib, "GetIpAddrTable"))
- {
- if ((GetIpAddrTable (&pTable, &uSize, TRUE) == ERROR_INSUFFICIENT_BUFFER) &&
- (pTable = HeapAlloc (GetProcessHeap(), 0, uSize)))
- {
- if (GetIpAddrTable (pTable, &uSize, TRUE) == NO_ERROR)
- {
- struct in_addr addr;
-
- for (i=0; i<pTable->dwNumEntries; i++)
- {
- addr.S_un.S_addr = pTable->table[i].dwAddr;
- SendMessage (hwndControl, CB_ADDSTRING, 0, (LPARAM)inet_ntoa(addr));
- }
- bRet = pTable->dwNumEntries > 0;
- }
- HeapFree (GetProcessHeap(), 0, pTable);
- }
- }
- FreeLibrary (hLib);
- }
- return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
-static DWORD WINAPI ProxyThread(IMO2SPROXY *pProxy)
-{
- if (pProxy->Open(pProxy)<0) return -1;
- SetEvent (m_hEvent);
- pProxy->Loop(pProxy);
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-
-static BYTE GetProxies(void)
-{
- return DBGetContactSettingByte(NULL, "IMOPROXY", "Proxies",
- (ServiceExists(SKYPE_PROTONAME PSS_SKYPEAPIMSG)?(1<<PROXY_SKYPEPLUGIN):(1<<PROXY_SOCKS)));
-}
-
-// -----------------------------------------------------------------------------
-
-static BOOL StartProxy (int i)
-{
- DWORD dwThreadId;
- BOOL bCreateThread = FALSE, bRet = TRUE;
- BYTE cEnabled = GetProxies();
- HANDLE ahEvents[2];
-
- // Username and Password must me available
- if (!m_stCfg.pszUser || !*m_stCfg.pszUser ||
- !m_stCfg.pszPass || !*m_stCfg.pszPass || !(cEnabled&(1<<i)) ) return FALSE;
-
- // Start the proxy, if enabled
- switch (i)
- {
- case PROXY_SOCKS:
- if (!(m_apProxy[i]))
- m_apProxy[i] = SocksProxy_Init (&m_stCfg, &m_stSocksCfg);
- break;
- case PROXY_W32SKYPEEMU:
- if (!(m_apProxy[i]))
- m_apProxy[i] = W32SkypeEmu_Init (&m_stCfg, &m_stSypeEmuCfg);
- break;
- case PROXY_SKYPEPLUGIN:
- if (!(m_apProxy[i]))
- m_apProxy[i] = SkypePluginLink_Init (&m_stCfg, &m_stSkypePluginCfg);
- if (m_apProxy[i]->Open(m_apProxy[i])<0)
- {
- m_apProxy[i]->Exit(m_apProxy[i]);
- return FALSE;
- }
- return TRUE;
- default:
- return FALSE;
- }
- if (!m_apProxy[i]) return FALSE;
-
- // As for example W32SKYPEEMU runs its own messagepump and the Window is
- // Registered in the Open-Function (as it can fail), we have to start
- // our Mainloop-Thread and wait for the Open() part to finish.
- // If it worked ok, the loop will start to run, otherwise we return
- // an error. So we need a Mutex for synchronisation.
- m_hEvent = ahEvents[1] = CreateEvent (NULL, FALSE, FALSE, NULL);
-
- if (!(m_hThread[i] = ahEvents[0] = (HANDLE)_beginthreadex (NULL, 0, ProxyThread, m_apProxy[i], 0, &dwThreadId)))
- {
- MessageBox (NULL, Translate("IMOPROXY Cannot start dispatch thread"), "IMOPROXY", MB_OK | MB_ICONSTOP);
- CloseHandle (m_hEvent);
- m_apProxy[i]->Exit(m_apProxy[i]);
- return FALSE;
- }
-
- bRet = WaitForMultipleObjects (2, ahEvents, FALSE, INFINITE)==WAIT_OBJECT_0+1;
- CloseHandle (m_hEvent);
- return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
-static void StopProxy (int i)
-{
- if (m_apProxy[i])
- {
- m_apProxy[i]->Exit(m_apProxy[i]);
- m_apProxy[i] = NULL;
- }
-
- if (m_hThread[i])
- {
- if (WaitForSingleObject (m_hThread[i], 3000) != WAIT_OBJECT_0)
- TerminateThread (m_hThread[i], -1);
- m_hThread[i] = NULL;
- }
-}
-
-// -----------------------------------------------------------------------------
-
-static BOOL StartProxies(int iMask)
-{
- int i;
- BOOL bRet=TRUE;
-
- for (i=0; i<PROXY_MAX; i++)
- if (iMask&(1<<i))
- bRet &= StartProxy(i);
- return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
-static void StopProxies(int iMask)
-{
- int i;
-
- for (i=0; i<PROXY_MAX; i++)
- if (iMask&(1<<i))
- StopProxy(i);
-}
-
-// -----------------------------------------------------------------------------
-
-static void UpdateProxyStatus (HWND hWnd, int iID)
-{
- struct {
- UINT uStatus;
- UINT uStart;
- UINT uStop;
- } astStatus[] = {
- {IDC_STATUSSOCKS, IDC_STARTSOCKS, IDC_STOPSOCKS},
- {IDC_STATUSCOMM, IDC_STARTCOMM, IDC_STOPCOMM},
- {IDC_STATUSSKYPEPL, IDC_STARTSKYPEPL, IDC_STOPSKYPEPL}
- };
-
- if (m_apProxy[iID])
- {
- SetDlgItemText (hWnd, astStatus[iID].uStatus, Translate("Running"));
- EnableWindow ((HWND)GetDlgItem (hWnd, astStatus[iID].uStart), FALSE);
- EnableWindow ((HWND)GetDlgItem (hWnd, astStatus[iID].uStop), TRUE);
- }
- else
- {
- BYTE cEnabled = GetProxies();
-
- SetDlgItemText (hWnd, astStatus[iID].uStatus, Translate("Stopped"));
- EnableWindow ((HWND)GetDlgItem (hWnd, astStatus[iID].uStart),
- ((cEnabled&(1<<iID)) && m_stCfg.pszUser && *m_stCfg.pszUser &&
- m_stCfg.pszPass && *m_stCfg.pszPass)?TRUE:FALSE);
- EnableWindow ((HWND)GetDlgItem (hWnd, astStatus[iID].uStop), FALSE);
- }
-}
-
-// -----------------------------------------------------------------------------
-
-static int CALLBACK OptionsDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- static char szOldHost[64]={0}, szOldLog[MAX_PATH]={0}, szOldUser[64], szOldPass[64];
- static short sOldPort=0;
- static BOOL bOldVerbose=FALSE;
- static int iOldFlags = 0, iOldProxies;
-
- switch (uMsg)
- {
- case WM_INITDIALOG:
- {
- DBVARIANT dbv;
-
- TranslateDialogDefault(hWnd);
- EnumNetInterfaces (GetDlgItem (hWnd, IDC_BINDIP));
- if (DBGetContactSetting(NULL, "IMOPROXY", "Host", &dbv)==0)
- {
- lstrcpyn (szOldHost, dbv.pszVal, sizeof(szOldHost));
- DBFreeVariant(&dbv);
- } else lstrcpy (szOldHost, "127.0.0.1");
- SetDlgItemText (hWnd, IDC_BINDIP,szOldHost);
- SetDlgItemInt (hWnd, IDC_BINDPORT, sOldPort = DBGetContactSettingWord(NULL, "IMOPROXY", "Port", 1401), FALSE);
- iOldFlags = DBGetContactSettingDword(NULL, "IMOPROXY", "Flags", 0);
- if (iOldFlags & IMO2S_FLAG_ALLOWINTERACT) CheckDlgButton (hWnd, IDC_INTERACT, BST_CHECKED);
- if (iOldFlags & IMO2S_FLAG_CURRTIMESTAMP) CheckDlgButton (hWnd, IDC_CURRTIMESTAMP, BST_CHECKED);
- if (DBGetContactSetting(NULL, "IMOPROXY", "Logfile", &dbv)==0)
- {
- lstrcpyn (szOldLog, dbv.pszVal, sizeof(szOldLog));
- DBFreeVariant(&dbv);
- }
- if (CallService (MS_SYSTEM_GETVERSION, 0, 0) >= 0x080000)
- {
- EnableWindow (GetDlgItem (hWnd, IDC_USENETLIB), TRUE);
- if (DBGetContactSettingByte (NULL, "IMOPROXY", "UseNetlib", 0))
- CheckDlgButton (hWnd, IDC_USENETLIB, BST_CHECKED);
- }
- SetDlgItemText (hWnd, IDC_LOGFILE, szOldLog);
- if (bOldVerbose = DBGetContactSettingByte(NULL, "IMOPROXY", "Verbose", 0))
- CheckDlgButton (hWnd, IDC_LOG, BST_CHECKED);
- else
- {
- EnableWindow (GetDlgItem (hWnd, IDC_LOGFILE), FALSE);
- EnableWindow (GetDlgItem (hWnd, IDC_OPEN), FALSE);
- }
- if (DBGetContactSetting(NULL, "IMOPROXY", "User", &dbv)==0)
- {
- lstrcpyn (szOldUser, dbv.pszVal, sizeof(szOldUser));
- DBFreeVariant(&dbv);
- }
- SetDlgItemText (hWnd, IDC_USERNAME, szOldUser);
- if (DBGetContactSetting(NULL, "IMOPROXY", "Password", &dbv)==0)
- {
- lstrcpyn (szOldPass, dbv.pszVal, sizeof(szOldPass));
- DBFreeVariant(&dbv);
- }
- iOldProxies= GetProxies();
- CheckDlgButton (hWnd, IDC_USESOCKS, (iOldProxies&(1<<PROXY_SOCKS))?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton (hWnd, IDC_USECOMM, (iOldProxies&(1<<PROXY_W32SKYPEEMU))?BST_CHECKED:BST_UNCHECKED);
- if (ServiceExists(SKYPE_PROTONAME PSS_SKYPEAPIMSG))
- {
- CheckDlgButton (hWnd, IDC_USESKYPEPL, (iOldProxies&(1<<PROXY_SKYPEPLUGIN))?BST_CHECKED:BST_UNCHECKED);
- UpdateProxyStatus (hWnd, PROXY_SKYPEPLUGIN);
- }
- else
- {
- EnableWindow (GetDlgItem (hWnd, IDC_USESKYPEPL), FALSE);
- EnableWindow (GetDlgItem (hWnd, IDC_STARTSKYPEPL), FALSE);
- }
- SetDlgItemText (hWnd, IDC_PASSWORD, szOldPass);
- UpdateProxyStatus (hWnd, PROXY_SOCKS);
- UpdateProxyStatus (hWnd, PROXY_W32SKYPEEMU);
-#ifdef _DEBUG
- EnableWindow (GetDlgItem(hWnd, IDC_CONSOLE), TRUE);
-#endif
- return TRUE;
- }
- case WM_NOTIFY:
- {
- NMHDR* nmhdr = (NMHDR*)lParam;
-
- switch (nmhdr->code)
- {
- case PSN_APPLY:
- case PSN_KILLACTIVE:
- {
- int iFlags=0, iProxies=0;
- short sPort;
- char szHost[64], szLog[MAX_PATH], szUser[64], szPass[64];
- BOOL bVerbose;
-
- GetDlgItemText (hWnd, IDC_BINDIP, szHost, sizeof(szHost));
- DBWriteContactSettingString (NULL, "IMOPROXY", "Host", szHost);
- DBWriteContactSettingWord (NULL, "IMOPROXY", "Port",
- (sPort = GetDlgItemInt (hWnd, IDC_BINDPORT, NULL, FALSE)));
- if (IsDlgButtonChecked (hWnd, IDC_INTERACT)==BST_CHECKED)
- iFlags|=IMO2S_FLAG_ALLOWINTERACT;
- if (IsDlgButtonChecked (hWnd, IDC_CURRTIMESTAMP)==BST_CHECKED)
- iFlags|=IMO2S_FLAG_CURRTIMESTAMP;
- GetDlgItemText (hWnd, IDC_USERNAME, szUser, sizeof(szUser));
- DBWriteContactSettingString (NULL, "IMOPROXY", "User", szUser);
- GetDlgItemText (hWnd, IDC_PASSWORD, szPass, sizeof(szPass));
- DBWriteContactSettingString (NULL, "IMOPROXY", "Password", szPass);
- DBWriteContactSettingDword (NULL, "IMOPROXY", "Flags", iFlags);
- DBWriteContactSettingByte(NULL, "IMOPROXY", "Verbose",
- (char)(bVerbose = (IsDlgButtonChecked (hWnd, IDC_LOG)==BST_CHECKED)));
- GetDlgItemText (hWnd, IDC_LOGFILE, szLog, sizeof(szLog));
- DBWriteContactSettingString (NULL, "IMOPROXY", "Logfile", szLog);
- if (IsDlgButtonChecked (hWnd, IDC_USESOCKS)==BST_CHECKED)
- iProxies|=(1<<PROXY_SOCKS);
- if (IsDlgButtonChecked (hWnd, IDC_USECOMM)==BST_CHECKED)
- iProxies|=(1<<PROXY_W32SKYPEEMU);
- if (IsDlgButtonChecked (hWnd, IDC_USESKYPEPL)==BST_CHECKED)
- iProxies|=(1<<PROXY_SKYPEPLUGIN);
- DBWriteContactSettingByte(NULL, "IMOPROXY", "UseNetlib",
- (char)(IsDlgButtonChecked (hWnd, IDC_USENETLIB)==BST_CHECKED));
- DBWriteContactSettingByte(NULL, "IMOPROXY", "Proxies", (char)iProxies);
- iProxies^=iOldProxies;
- if (sPort != sOldPort || lstrcmp (szOldHost, szHost))
- iProxies|=(1<<PROXY_SOCKS);
-
- if (lstrcmp (szOldLog, szLog) || bOldVerbose != bVerbose ||
- lstrcmp (szOldUser, szUser) || lstrcmp(szOldPass, szPass) ||
- iFlags != iOldFlags)
- iProxies=(1<<PROXY_MAX)-1;
-
- /*
- StopProxies(iProxies);
- LoadSettings();
- CheckSettings(iProxies);
- StartProxies(iProxies);
- */
- UpdateProxyStatus (hWnd, PROXY_SOCKS);
- UpdateProxyStatus (hWnd, PROXY_W32SKYPEEMU);
- if (ServiceExists(SKYPE_PROTONAME PSS_SKYPEAPIMSG))
- UpdateProxyStatus (hWnd, PROXY_SKYPEPLUGIN);
- return TRUE;
- }
- }
- break;
- }
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- case IDC_LOG:
- {
- BOOL bEnable = (SendMessage ((HWND)lParam, BM_GETCHECK, 0, 0)==BST_CHECKED);
-
- EnableWindow (GetDlgItem (hWnd, IDC_LOGFILE), bEnable);
- EnableWindow (GetDlgItem (hWnd, IDC_OPEN), bEnable);
- break;
- }
- case IDC_OPEN:
- {
- char szFilename[MAX_PATH];
- OPENFILENAME ofn={0};
-
- GetDlgItemText (hWnd, IDC_LOGFILE, szFilename, sizeof(szFilename));
- ofn.lStructSize=sizeof(OPENFILENAME);
- ofn.hwndOwner=hWnd;
- ofn.Flags=OFN_HIDEREADONLY;
- ofn.lpstrTitle=Translate("Select where log file will be created");
- ofn.lpstrFilter=Translate("All files (*.*)\0*.*\0");
- ofn.lpstrFile=szFilename;
- ofn.nMaxFile=sizeof(szFilename)-2;
- ofn.nMaxFileTitle=sizeof(szFilename);
- if(GetSaveFileName(&ofn))
- SetDlgItemText(hWnd, IDC_LOGFILE, szFilename);
- break;
- }
- case IDC_STARTSOCKS:
- case IDC_STARTCOMM:
- case IDC_STARTSKYPEPL:
- {
- int iID;
-
- switch (LOWORD(wParam))
- {
- case IDC_STARTSOCKS:
- iID = PROXY_SOCKS;
- break;
- case IDC_STARTCOMM:
- iID = PROXY_W32SKYPEEMU;
- break;
- case IDC_STARTSKYPEPL:
- iID = PROXY_SKYPEPLUGIN;
- break;
- }
- EnableWindow ((HWND)lParam, FALSE);
- LoadSettings();
- CheckSettings (1<<iID);
- StartProxy (iID);
- UpdateProxyStatus (hWnd, iID);
- break;
- }
- case IDC_STOPSOCKS:
- case IDC_STOPCOMM:
- case IDC_STOPSKYPEPL:
- {
- int iID;
-
- switch (LOWORD(wParam))
- {
- case IDC_STOPSOCKS:
- iID = PROXY_SOCKS;
- break;
- case IDC_STOPCOMM:
- iID = PROXY_W32SKYPEEMU;
- break;
- case IDC_STOPSKYPEPL:
- iID = PROXY_SKYPEPLUGIN;
- break;
- }
- EnableWindow ((HWND)lParam, FALSE);
- StopProxy (iID);
- UpdateProxyStatus (hWnd, iID);
- break;
- }
- case IDC_CONSOLE:
- {
- CONSOLE_SCREEN_BUFFER_INFO coninfo;
- HANDLE hStdHandle;
- int hConHandle;
- HMENU hMenu;
- FILE *fp;
- HMODULE hKernel32;
- HWND (WINAPI *_GetConsoleWindow)(void), hWndCon;
-
- /* Some dirty hack for a simple console. I know this isn't really
- proper and that I should use my own console, but it's enough for
- debugging purposes ;-)
- */
- if (HIWORD(wParam)!=BN_CLICKED) break;
- switch (SendMessage ((HWND)lParam, BM_GETCHECK, 0, 0))
- {
- case BST_UNCHECKED:
- if (m_stCfg.fpLog) fclose(m_stCfg.fpLog);
- m_stCfg.fpLog = NULL;
- LoadSettings ();
- FreeConsole();
- m_stCfg.bVerbose = bOldVerbose;
- m_bConsole = FALSE;
- break;
- case BST_CHECKED:
- m_bConsole = AllocConsole();
- hStdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
- GetConsoleScreenBufferInfo(hStdHandle, &coninfo);
- coninfo.dwSize.Y = 500;
- SetConsoleScreenBufferSize(hStdHandle, coninfo.dwSize);
- hConHandle = _open_osfhandle((long)hStdHandle, _O_TEXT);
- fp = _fdopen(hConHandle, "w");
- if (!fp)
- {
- FreeConsole();
- break;
- }
- // Only available in Win2k or above
- // Protect Console form closing, otherwise closing the console
- // would Shutdown Miranda
- if ((hKernel32 = GetModuleHandle ("kernel32.dll")) &&
- (*(FARPROC *)&_GetConsoleWindow =
- GetProcAddress(hKernel32, "GetConsoleWindow")) &&
- (hWndCon = _GetConsoleWindow()))
- {
- hMenu = GetSystemMenu (hWndCon, FALSE);
- DeleteMenu (hMenu, SC_CLOSE, MF_BYCOMMAND);
- }
- else
- {
- fprintf (fp, Translate("WARNING: Only close this console by pushing the Console button "
- "in the settings dialog, otherwise you sould shutdown Miranda by closing "
- "the Window!\n"));
- }
- setvbuf(fp, NULL, _IONBF, 0 );
- if (m_stCfg.fpLog && m_stCfg.fpLog != stdout && m_stCfg.fpLog != stderr) fclose(m_stCfg.fpLog);
- bOldVerbose = m_stCfg.bVerbose;
- m_stCfg.bVerbose = 1;
- m_stCfg.fpLog = fp;
- break;
- }
- break;
- }
- }
- SendMessage (GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
- }
- return FALSE;
-}
-
-// -----------------------------------------------------------------------------
-
-static int RegisterOptions(WPARAM wParam, LPARAM lParam)
-{
- OPTIONSDIALOGPAGE odp={0};
-
- odp.cbSize = sizeof(odp);
- odp.hInstance = m_hInst;
- odp.pszTemplate = MAKEINTRESOURCE(IDD_OPTIONS);
- odp.pszGroup = Translate("Network");
- odp.pszTitle = "Skype Imoproxy";
- odp.pfnDlgProc = OptionsDlgProc;
- odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-
-void RegisterToUpdate(void)
-{
- //Use for the Updater plugin
- if(ServiceExists(MS_UPDATE_REGISTER))
- {
- Update update = {0};
- char szVersion[16];
-
- update.szComponentName = pluginInfo.shortName;
- update.pbVersion = (BYTE *)CreateVersionStringPlugin((PLUGININFO *)&pluginInfo, szVersion);
- update.cpbVersion = strlen((char *)update.pbVersion);
-
-#ifdef _WIN64
- update.szUpdateURL = "http://dose.0wnz.at/miranda/Skype/imo2sproxy_x64_binonly.zip"; // FIXME!!
- update.szVersionURL = "http://dose.0wnz.at/miranda/Skype/"; // FIXME
- update.pbVersionPrefix = (BYTE *)"imo2sproxy version "; //FIXME
- update.szBetaUpdateURL = "http://dose.0wnz.at/miranda/Skype/imo2sproxy_x64_binonly.zip";
- update.szBetaVersionURL = "http://dose.0wnz.at/miranda/Skype/";
- update.pbBetaVersionPrefix = (BYTE *)"imo2sproxy version ";
-#else
- update.szUpdateURL = "http://addons.miranda-im.org/feed.php?dlfile=4146";
- update.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=4146";
- update.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">Skype to imo.im Gateway ";
- update.szBetaUpdateURL = "http://dose.0wnz.at/miranda/Skype/imo2sproxy_w32_binonly.zip";
- update.szBetaVersionURL = "http://dose.0wnz.at/miranda/Skype/";
- update.pbBetaVersionPrefix = (BYTE *)"imo2sproxy version ";
-#endif
-
- update.cpbVersionPrefix = strlen((char *)update.pbVersionPrefix);
- update.cpbBetaVersionPrefix = strlen((char *)update.pbBetaVersionPrefix);
-
- CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
-
- }
-}
-
-// -----------------------------------------------------------------------------
-
-int PreShutdown(WPARAM wParam, LPARAM lParam)
-{
- OutputDebugString ("IMOPROXY: PreShutdown");
- StopProxies (-1);
- if (m_stCfg.fpLog && m_stCfg.fpLog != stdout && m_stCfg.fpLog != stderr)
- {
- fclose(m_stCfg.fpLog);
- m_stCfg.fpLog = NULL;
- }
- if (m_stCfg.pszUser)
- {
- free(m_stCfg.pszUser);
- m_stCfg.pszUser = NULL;
- }
- if (m_stCfg.pszPass)
- {
- free(m_stCfg.pszPass);
- m_stCfg.pszPass = NULL;
- }
-
- FreeConsole();
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-
-int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
-{
- BYTE CheckSkype = DBGetContactSettingByte (NULL, "IMOPROXY", "CheckSkype", 2);
- if (CheckSkype) CheckSettings(-1);
- if (CheckSkype == 2) DBWriteContactSettingByte (NULL, "IMOPROXY", "CheckSkype", 0);
- RegisterToUpdate();
-
- // On Miranda 0.0.0.8+ NETLIB suppotrs HTTPS, therefore we can use
- // Netlib there
- if (CallService (MS_SYSTEM_GETVERSION, 0, 0) >= 0x080000 &&
- DBGetContactSettingByte (NULL, "IMOPROXY", "UseNetlib", 0))
- ImoRq_SetIOLayer (IoLayerNETLIB_Init);
- StartProxies(-1);
-
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
-{
- m_hInst=hinstDLL;
- return TRUE;
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-__declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
-{
- return &pluginInfo;
-}
-
-// -----------------------------------------------------------------------------
-
-// New plugin API
-__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
-{
- return &pluginInfoEx;
-}
-
-// -----------------------------------------------------------------------------
-
-__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
-{
- return interfaces;
-}
-
-// -----------------------------------------------------------------------------
-
-int __declspec(dllexport) Load(PLUGINLINK *link)
-{
-
-#ifdef _DEBUG
- Crash_Init();
-#endif
- pluginLink = link;
-
- // Init IMO2S config structures
- Imo2sproxy_Defaults (&m_stCfg);
- SocksProxy_Defaults (&m_stSocksCfg);
- W32SkypeEmu_Defaults(&m_stSypeEmuCfg);
- SkypePluginLink_Defaults(&m_stSkypePluginCfg);
- m_stCfg.logerror = ShowError;
- LoadSettings();
-
- m_hOptHook = HookEvent(ME_OPT_INITIALISE, RegisterOptions);
- m_hPreShutdownHook = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
- m_hHookModulesLoaded = HookEvent( ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
-
- OutputDebugString ("IMOPROXY: Loaded");
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-
-int __declspec(dllexport) Unload(void)
-{
- OutputDebugString ("IMOPROXY: Unload");
- UnhookEvent(m_hOptHook);
- UnhookEvent(m_hPreShutdownHook);
- UnhookEvent(m_hHookModulesLoaded);
- return 0;
-}
diff --git a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/io_layer_netlib.c b/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/io_layer_netlib.c deleted file mode 100644 index 378f72e65f..0000000000 --- a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/io_layer_netlib.c +++ /dev/null @@ -1,340 +0,0 @@ -/* Module: io_layer_netlib.c
- Purpose: IO Layer for Internet communication using Miranda NETLIB
- Author: leecher
- Date: 20.04.2011 :=)
-*/
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <winsock2.h>
-#include <stdlib.h>
-#include "include/newpluginapi.h"
-#include "include/m_netlib.h"
-#include "fifo.h"
-#include "memlist.h"
-#include "io_layer.h"
-
-#define USER_AGENT "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13"
-
-typedef struct
-{
- IOLAYER vtbl;
- int iRecursion;
- NETLIBHTTPREQUEST *nlhrReply;
- LPVOID lpErrorBuf;
- HANDLE nlc;
-} IOLAYER_INST;
-
-typedef struct
-{
- HANDLE hNetlib;
- TYP_LIST *hCookies;
- TYP_FIFO *hCookieStr;
- char *pszCookies;
- LONG lRefCount;
- CRITICAL_SECTION cs;
-} IOLAYER_SINGLETON;
-
-static IOLAYER_SINGLETON *m_hNL = NULL;
-
-static void IoLayer_Exit (IOLAYER *hPIO);
-static char *IoLayer_Post(IOLAYER *hPIO, char *pszURL, char *pszPostFields, unsigned int cbPostFields, unsigned int *pdwLength);
-static char *IoLayer_Get(IOLAYER *hIO, char *pszURL, unsigned int *pdwLength);
-static void IoLayer_Cancel(IOLAYER *hIO);
-static char *IoLayer_GetLastError(IOLAYER *hIO);
-static char *IoLayer_EscapeString(IOLAYER *hPIO, char *pszData);
-static void IoLayer_FreeEscapeString(char *pszData);
-static void FetchLastError (IOLAYER_INST *hIO);
-static void add_cookies(char *pszCookies);
-static void refresh_cookies();
-static HANDLE *OpenConnection(NETLIBHTTPREQUEST *nlhr);
-
-// -----------------------------------------------------------------------------
-// Interface
-// -----------------------------------------------------------------------------
-
-IOLAYER *IoLayerNETLIB_Init(void)
-{
- IOLAYER_INST *hIO;
-
- if (CallService (MS_SYSTEM_GETVERSION, 0, 0) < 0x080000 || // Miranda HTTPS support starting with 0.8.0.0
- !(hIO = calloc(1, sizeof(IOLAYER_INST))))
- return NULL;
-
- // NETLIB only works as singleton
- if (!m_hNL)
- {
- NETLIBUSER nlu={0};
-
- if (!(m_hNL = calloc (1, sizeof(IOLAYER_SINGLETON))))
- {
- free (hIO);
- return NULL;
- }
- m_hNL->lRefCount++;
-
- // Init Netlib
- nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_OUTGOING;
- nlu.szDescriptiveName = "imo2sproxy connection";
- nlu.szSettingsModule = "IMOPROXY";
- nlu.szHttpGatewayUserAgent = USER_AGENT;
- if (!(m_hNL->hNetlib = (HANDLE)CallService (MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu)) ||
- !(m_hNL->hCookies = List_Init(0)) ||
- !(m_hNL->hCookieStr = Fifo_Init(0)))
- {
- IoLayer_Exit((IOLAYER*)hIO);
- return NULL;
- }
- m_hNL->pszCookies = "";
- InitializeCriticalSection (&m_hNL->cs);
- } else m_hNL->lRefCount++;
-
- // Init Vtbl
- hIO->vtbl.Exit = IoLayer_Exit;
- hIO->vtbl.Post = IoLayer_Post;
- hIO->vtbl.Get = IoLayer_Get;
- hIO->vtbl.Cancel = IoLayer_Cancel;
- hIO->vtbl.GetLastError = IoLayer_GetLastError;
- hIO->vtbl.EscapeString = IoLayer_EscapeString;
- hIO->vtbl.FreeEscapeString = IoLayer_FreeEscapeString;
-
- return (IOLAYER*)hIO;
-}
-// -----------------------------------------------------------------------------
-
-static void IoLayer_Exit (IOLAYER *hPIO)
-{
- IOLAYER_INST *hIO = (IOLAYER_INST*)hPIO;
-
- if (hIO->nlhrReply) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)hIO->nlhrReply);
- if (hIO->lpErrorBuf) LocalFree(hIO->lpErrorBuf);
- if (InterlockedDecrement(&m_hNL->lRefCount) <= 0)
- {
- if (m_hNL->hNetlib) Netlib_CloseHandle (m_hNL->hNetlib);
- if (m_hNL->hCookies) {
- List_FreeElements(m_hNL->hCookies);
- List_Exit (m_hNL->hCookies);
- }
- if (m_hNL->hCookieStr) Fifo_Exit(m_hNL->hCookieStr);
- DeleteCriticalSection (&m_hNL->cs);
- free (m_hNL);
- m_hNL = NULL;
- }
- free (hIO);
-}
-
-// -----------------------------------------------------------------------------
-
-static char *IoLayer_Post(IOLAYER *hPIO, char *pszURL, char *pszPostFields, unsigned int cbPostFields, unsigned int *pdwLength)
-{
- IOLAYER_INST *hIO = (IOLAYER_INST*)hPIO;
- NETLIBHTTPREQUEST nlhr={0};
- NETLIBHTTPHEADER headers[5];
- int i;
- char *pszCookies = NULL;
-
-
- /*
- char szDbg[256];
- sprintf (szDbg, "Thread %d with hIO %08X requests %s\n", GetCurrentThreadId(), hIO, pszURL);
- OutputDebugString(szDbg);
- */
-
- // Build basic request
- nlhr.cbSize = sizeof(nlhr);
- nlhr.flags = NLHRF_GENERATEHOST | NLHRF_SMARTREMOVEHOST | NLHRF_REDIRECT;
- if (!pdwLength) nlhr.flags |= NLHRF_DUMPASTEXT; // pdwLength needed -> Binary data
- nlhr.requestType = pszPostFields?REQUEST_POST:REQUEST_GET;
- nlhr.szUrl = pszURL;
- nlhr.pData = pszPostFields;
- nlhr.dataLength = cbPostFields;
- nlhr.headers = headers;
-
- // Add headers
- EnterCriticalSection (&m_hNL->cs);
- if (m_hNL->pszCookies && *m_hNL->pszCookies)
- {
- headers[nlhr.headersCount].szName = "Cookie";
- headers[nlhr.headersCount++].szValue = pszCookies = strdup(m_hNL->pszCookies);
- }
- headers[nlhr.headersCount].szName = "User-Agent";
- headers[nlhr.headersCount++].szValue = USER_AGENT;
- headers[nlhr.headersCount].szName = "Accept-Encoding";
- headers[nlhr.headersCount++].szValue = "deflate, gzip";
- headers[nlhr.headersCount].szName = "Content-Type";
- headers[nlhr.headersCount++].szValue = "application/x-www-form-urlencoded; charset=UTF-8";
- headers[nlhr.headersCount].szName = "X-Requested-With";
- headers[nlhr.headersCount++].szValue = "XMLHttpRequest";
- LeaveCriticalSection (&m_hNL->cs);
-
- // Do the transaction
- nlhr.nlc = hIO->nlc = OpenConnection (&nlhr);
- if (hIO->nlhrReply) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)hIO->nlhrReply);
- hIO->nlhrReply = (NETLIBHTTPREQUEST*)CallService (MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNL->hNetlib, (LPARAM)&nlhr);
- hIO->nlc = NULL;
-
- if (pszCookies) free (pszCookies);
- if (!hIO->nlhrReply)
- {
- FetchLastError (hIO);
- return NULL;
- }
-
- if (!hIO->nlhrReply || !hIO->nlhrReply->dataLength || !hIO->nlhrReply->pData)
- {
- if (hIO->lpErrorBuf) LocalFree(hIO->lpErrorBuf);
- if (hIO->lpErrorBuf = LocalAlloc (LPTR, 64))
- strcpy (hIO->lpErrorBuf, "Reply contained no data");
- return NULL;
- }
-
- // Error handling
- if (hIO->nlhrReply->resultCode < 200 || hIO->nlhrReply->resultCode >= 300)
- {
- if (hIO->lpErrorBuf) LocalFree(hIO->lpErrorBuf);
- if (hIO->lpErrorBuf = LocalAlloc (LPTR, 64))
- sprintf (hIO->lpErrorBuf, "HTTP transaction returned status %d", hIO->nlhrReply->resultCode);
- return NULL;
- }
-
- // Process headers to collect cookies
- EnterCriticalSection (&m_hNL->cs);
- for (i=0; i<hIO->nlhrReply->headersCount; i++)
- {
- if (!strnicmp(hIO->nlhrReply->headers[i].szName, "Set-Cookie", 10))
- add_cookies(hIO->nlhrReply->headers[i].szValue);
- }
- LeaveCriticalSection (&m_hNL->cs);
-
- // Return reply
- if (pdwLength) *pdwLength = hIO->nlhrReply->dataLength;
- return hIO->nlhrReply->pData;
-}
-
-// -----------------------------------------------------------------------------
-
-static char *IoLayer_Get(IOLAYER *hIO, char *pszURL, unsigned int *pdwLength)
-{
- return IoLayer_Post (hIO, pszURL, NULL, 0, pdwLength);
-}
-
-// -----------------------------------------------------------------------------
-
-static void IoLayer_Cancel(IOLAYER *hPIO)
-{
- IOLAYER_INST *hIO = (IOLAYER_INST*)hPIO;
-
- if (hIO->nlc && Netlib_CloseHandle(hIO->nlc))
- hIO->nlc = NULL;
-}
-
-// -----------------------------------------------------------------------------
-
-static char *IoLayer_GetLastError(IOLAYER *hIO)
-{
- return (char*)((IOLAYER_INST*)hIO)->lpErrorBuf;
-}
-
-// -----------------------------------------------------------------------------
-
-static char *IoLayer_EscapeString(IOLAYER *hPIO, char *pszData)
-{
- return (char*)CallService (MS_NETLIB_URLENCODE, 0, (LPARAM)pszData);
-}
-
-// -----------------------------------------------------------------------------
-
-static void IoLayer_FreeEscapeString(char *pszData)
-{
- HeapFree(GetProcessHeap(), 0, pszData);
-}
-
-// -----------------------------------------------------------------------------
-// Static
-// -----------------------------------------------------------------------------
-
-static void FetchLastError (IOLAYER_INST *hIO)
-{
- if (hIO->lpErrorBuf) LocalFree(hIO->lpErrorBuf);
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
- GetLastError(), MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
- (LPTSTR)&hIO->lpErrorBuf, 0, NULL);
-}
-
-// -----------------------------------------------------------------------------
-
-static void add_cookies(char *pszCookies)
-{
- int i, nCount, iLenCmp, iLenCookie;
- char *p, *pszCookie = NULL;
-
- if (!(p = strchr(pszCookies, '='))) return;
- iLenCmp=p-pszCookies+1;
- if ((p=strchr (p, ';')) || (p=strchr (p, ';'))) iLenCookie = p-pszCookies;
- else iLenCookie=strlen(pszCookies);
-
- for (i=0, nCount=List_Count(m_hNL->hCookies); i<nCount; i++)
- {
- pszCookie = (char*)List_ElementAt (m_hNL->hCookies, i);
- if (!strncmp(pszCookie, pszCookies, iLenCmp))
- break;
- }
-
- if (i==nCount) pszCookie = NULL;
- if (pszCookie = realloc (pszCookie, iLenCookie+1))
- {
- strncpy (pszCookie, pszCookies, iLenCookie);
- pszCookie[iLenCookie]=0;
- if (i<nCount)
- List_ReplaceElementAt (m_hNL->hCookies, pszCookie, i);
- else
- List_Push (m_hNL->hCookies, pszCookie);
- }
- refresh_cookies ();
-}
-
-// -----------------------------------------------------------------------------
-
-static void refresh_cookies()
-{
- int i, nCount;
-
- Fifo_Reset (m_hNL->hCookieStr);
- for (i=0, nCount=List_Count(m_hNL->hCookies); i<nCount; i++)
- {
- char *pszCookie = (char*)List_ElementAt (m_hNL->hCookies, i);
- Fifo_Add (m_hNL->hCookieStr, pszCookie, strlen(pszCookie));
- Fifo_Add (m_hNL->hCookieStr, "; ", 2);
- }
- Fifo_Add (m_hNL->hCookieStr, "", 1);
- m_hNL->pszCookies = Fifo_Get (m_hNL->hCookieStr, NULL);
-}
-
-// -----------------------------------------------------------------------------
-
-static HANDLE *OpenConnection(NETLIBHTTPREQUEST *nlhr)
-{
- NETLIBOPENCONNECTION nloc={0};
- BOOL secur = (nlhr->flags & NLHRF_SSL) || _strnicmp(nlhr->szUrl, "https", 5) == 0;
- char* phost = strstr(nlhr->szUrl, "://");
- char *ppath, *pcolon;
-
- // Poor man's InternetCrackUrl
- nloc.cbSize = sizeof(NETLIBOPENCONNECTION);
- if (phost) phost+=3; else phost=nlhr->szUrl;
- nloc.szHost = _alloca (strlen(phost)+1);
- strcpy ((char*)nloc.szHost, phost);
- if (ppath = strchr(nloc.szHost, '/')) *ppath = '\0';
- if (pcolon = strrchr(nloc.szHost, ':'))
- {
- *pcolon = '\0';
- nloc.wPort = (WORD)strtol(pcolon+1, NULL, 10);
- }
- else nloc.wPort = secur ? 443 : 80;
- nloc.flags = (secur ? NLOCF_SSL : 0) | NLOCF_HTTP;
- if (secur) nlhr->flags |= NLHRF_SSL; else nlhr->flags &= ~NLHRF_SSL;
-
- // Open connection
- return (HANDLE)CallService (MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNL->hNetlib, (LPARAM)&nloc);
-}
\ No newline at end of file diff --git a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/res.aps b/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/res.aps Binary files differdeleted file mode 100644 index 280086f42b..0000000000 --- a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/res.aps +++ /dev/null diff --git a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/res.rc b/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/res.rc deleted file mode 100644 index 487426fbfe..0000000000 --- a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/res.rc +++ /dev/null @@ -1,145 +0,0 @@ -//Microsoft Developer Studio generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Deutsch (Österreich) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEA)
-#ifdef _WIN32
-LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_OPTIONS DIALOGEX 0, 0, 287, 224
-STYLE WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Sans Serif"
-BEGIN
- GROUPBOX "Account information",IDC_STATIC,7,7,273,31
- LTEXT "Username:",IDC_STATIC,17,20,53,9
- EDITTEXT IDC_USERNAME,74,18,56,12,ES_AUTOHSCROLL
- LTEXT "Password:",IDC_STATIC,135,20,47,9
- EDITTEXT IDC_PASSWORD,185,18,56,12,ES_PASSWORD | ES_AUTOHSCROLL
- CONTROL "Support for Voicecalls via imo.im Flash in Internet Explorer",
- IDC_INTERACT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,42,
- 273,9
- CONTROL "Ignore server timestamp and use current time for messages",
- IDC_CURRTIMESTAMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
- 7,60,273,10
- CONTROL "Log traffic to file:",IDC_LOG,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,7,71,110,10
- EDITTEXT IDC_LOGFILE,119,71,128,12,ES_AUTOHSCROLL
- PUSHBUTTON "...",IDC_OPEN,248,71,14,12
- LTEXT "Status:",IDC_STATIC,126,140,29,10
- LTEXT "Stopped",IDC_STATUSSOCKS,157,140,54,9,SS_SUNKEN
- GROUPBOX "Socket Proxy",IDC_STATIC,7,129,273,45
- LTEXT "Bind to address:",IDC_STATIC,17,157,73,9
- COMBOBOX IDC_BINDIP,95,155,75,12,CBS_DROPDOWN | CBS_SORT |
- WS_VSCROLL | WS_TABSTOP
- LTEXT "Port:",IDC_STATIC,179,157,31,9
- EDITTEXT IDC_BINDPORT,211,155,31,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "Use Socket Proxy",IDC_USESOCKS,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,18,140,81,9
- PUSHBUTTON "Start",IDC_STARTSOCKS,216,137,30,12
- PUSHBUTTON "Stop",IDC_STOPSOCKS,246,137,30,12,WS_DISABLED
- GROUPBOX "Skype compatible communication API",IDC_STATIC,7,177,
- 273,40
- LTEXT "Caution: Don't use this if you have the Skype application running!",
- IDC_STATIC,13,188,260,8
- LTEXT "Status:",IDC_STATIC,126,201,29,10
- LTEXT "Stopped",IDC_STATUSCOMM,158,201,54,9,SS_SUNKEN
- CONTROL "Use compatible comm API",IDC_USECOMM,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,18,201,105,9
- PUSHBUTTON "Start",IDC_STARTCOMM,216,198,30,12
- PUSHBUTTON "Stop",IDC_STOPCOMM,246,198,30,12,WS_DISABLED
- CONTROL "Console",IDC_CONSOLE,"Button",BS_AUTOCHECKBOX |
- BS_PUSHLIKE | WS_TABSTOP,216,87,45,11
- GROUPBOX "Skype Plugin 0.0.0.46+ internal communication link",
- IDC_STATIC,7,102,273,25
- LTEXT "Status:",IDC_STATIC,126,113,29,10
- LTEXT "Stopped",IDC_STATUSSKYPEPL,158,113,54,9,SS_SUNKEN
- CONTROL "Use plugin link",IDC_USESKYPEPL,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,18,113,105,9
- PUSHBUTTON "Start",IDC_STARTSKYPEPL,216,110,30,12
- PUSHBUTTON "Stop",IDC_STOPSKYPEPL,246,110,30,12,WS_DISABLED
- CONTROL "Use Netlib instead of WinInet (Experimental)",
- IDC_USENETLIB,"Button",BS_AUTOCHECKBOX | WS_DISABLED |
- WS_TABSTOP,7,51,273,9
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE
-BEGIN
- IDD_OPTIONS, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 280
- TOPMARGIN, 7
- BOTTOMMARGIN, 217
- END
-END
-#endif // APSTUDIO_INVOKED
-
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE DISCARDABLE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE DISCARDABLE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE DISCARDABLE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-#endif // Deutsch (Österreich) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/resource.h b/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/resource.h deleted file mode 100644 index e0da6bef1d..0000000000 --- a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/resource.h +++ /dev/null @@ -1,39 +0,0 @@ -//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by res.rc
-//
-#define IDD_OPTIONS 101
-#define IDC_BINDPORT 1001
-#define IDC_BINDIP 1002
-#define IDC_INTERACT 1003
-#define IDC_CURRTIMESTAMP 1004
-#define IDC_LOG 1005
-#define IDC_LOGFILE 1006
-#define IDC_OPEN 1007
-#define IDC_USERNAME 1008
-#define IDC_PASSWORD 1009
-#define IDC_STATUSSOCKS 1010
-#define IDC_STATUSCOMM 1011
-#define IDC_STATUSSKYPEPL 1012
-#define IDC_USESOCKS 1013
-#define IDC_STARTSOCKS 1014
-#define IDC_STOPSOCKS 1015
-#define IDC_USECOMM 1016
-#define IDC_STARTCOMM 1017
-#define IDC_STOPCOMM 1018
-#define IDC_CONSOLE 1019
-#define IDC_USESKYPEPL 1020
-#define IDC_STARTSKYPEPL 1021
-#define IDC_STOPSKYPEPL 1022
-#define IDC_USENETLIB 1023
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1020
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/sdk/m_updater.h b/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/sdk/m_updater.h deleted file mode 100644 index 371b7437a0..0000000000 --- a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/sdk/m_updater.h +++ /dev/null @@ -1,146 +0,0 @@ -#ifndef _M_UPDATER_H
-#define _M_UPDATER_H
-
-// NOTES:
-// - For langpack updates, include a string of the following format in the langpack text file:
-// ";FLID: <file listing name> <version>"
-// version must be four numbers seperated by '.', in the range 0-255 inclusive
-// - Updater will disable plugins that are downloaded but were not active prior to the update (this is so that, if an archive contains e.g. ansi and
-// unicode versions, the correct plugin will be the only one active after the new version is installed)...so if you add a support plugin, you may need
-// to install an ini file to make the plugin activate when miranda restarts after the update
-// - Updater will replace all dlls that have the same internal shortName as a downloaded update dll (this is so that msn1.dll and msn2.dll, for example,
-// will both be updated) - so if you have a unicode and a non-unicode version of a plugin in your archive, you should make the internal names different (which will break automatic
-// updates from the file listing if there is only one file listing entry for both versions, unless you use the 'MS_UPDATE_REGISTER' service below)
-// - Updater will install all files in the root of the archive into the plugins folder, except for langpack files that contain the FLID string which go into the root folder (same
-// folder as miranda32.exe)...all folders in the archive will also be copied to miranda's root folder, and their contents transferred into the new folders. The only exception is a
-// special folder called 'root_files' - if there is a folder by that name in the archive, it's contents will also be copied into miranda's root folder - this is intended to be used
-// to install additional dlls etc that a plugin may require)
-
-// if you set Update.szUpdateURL to the following value when registering, as well as setting your beta site and version data,
-// Updater will ignore szVersionURL and pbVersionPrefix, and attempt to find the file listing URL's from the backend XML data.
-// for this to work, the plugin name in pluginInfo.shortName must match the file listing exactly (except for case)
-#define UPDATER_AUTOREGISTER "UpdaterAUTOREGISTER"
-// Updater will also use the backend xml data if you provide URL's that reference the miranda file listing for updates (so you can use that method
-// if e.g. your plugin shortName does not match the file listing) - it will grab the file listing id from the end of these URLs
-
-typedef struct Update_tag {
- int cbSize;
- char *szComponentName; // component name as it will appear in the UI (will be translated before displaying)
-
- char *szVersionURL; // URL where the current version can be found (NULL to disable)
- BYTE *pbVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data
- // (note that this URL could point at a binary file - dunno why, but it could :)
- int cpbVersionPrefix; // number of bytes pointed to by pbVersionPrefix
- char *szUpdateURL; // URL where dll/zip is located
- // set to UPDATER_AUTOREGISTER if you want Updater to find the file listing URLs (ensure plugin shortName matches file listing!)
-
- char *szBetaVersionURL; // URL where the beta version can be found (NULL to disable betas)
- BYTE *pbBetaVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data
- int cpbBetaVersionPrefix; // number of bytes pointed to by pbVersionPrefix
- char *szBetaUpdateURL; // URL where dll/zip is located
-
- BYTE *pbVersion; // bytes of current version, used for comparison with those in VersionURL
- int cpbVersion; // number of bytes pointed to by pbVersion
-
- char *szBetaChangelogURL; // url for displaying changelog for beta versions
-} Update;
-
-// register a comonent with Updater
-//
-// wparam = 0
-// lparam = (LPARAM)&Update
-#define MS_UPDATE_REGISTER "Update/Register"
-
-// utility functions to create a version string from a DWORD or from pluginInfo
-// point buf at a buffer at least 16 chars wide - but note the version string returned may be shorter
-//
-__inline static char *CreateVersionString(DWORD version, char *buf) {
- mir_snprintf(buf, 16, "%d.%d.%d.%d", (version >> 24) & 0xFF, (version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);
- return buf;
-}
-
-__inline static char *CreateVersionStringPlugin(PLUGININFO *pluginInfo, char *buf) {
- return CreateVersionString(pluginInfo->version, buf);
-}
-
-
-// register the 'easy' way - use this method if you have no beta URL and the plugin is on the miranda file listing
-// NOTE: the plugin version string on the file listing must be the string version of the version in pluginInfo (i.e. 0.0.0.1,
-// four numbers between 0 and 255 inclusivem, so no letters, brackets, etc.)
-//
-// wParam = (int)fileID - this is the file ID from the file listing (i.e. the number at the end of the download link)
-// lParam = (PLUGININFO*)&pluginInfo
-#define MS_UPDATE_REGISTERFL "Update/RegisterFL"
-
-// this function can be used to 'unregister' components - useful for plugins that register non-plugin/langpack components and
-// may need to change those components on the fly
-// lParam = (char *)szComponentName
-#define MS_UPDATE_UNREGISTER "Update/Unregister"
-
-// this event is fired when the startup process is complete, but NOT if a restart is imminent
-// it is designed for status managment plugins to use as a trigger for beggining their own startup process
-// wParam = lParam = 0 (unused)
-// (added in version 0.1.6.0)
-#define ME_UPDATE_STARTUPDONE "Update/StartupDone"
-
-// this service can be used to enable/disable Updater's global status control
-// it can be called from the StartupDone event handler
-// wParam = (BOOL)enable
-// lParam = 0
-// (added in version 0.1.6.0)
-#define MS_UPDATE_ENABLESTATUSCONTROL "Update/EnableStatusControl"
-
-// An description of usage of the above service and event:
-// Say you are a status control plugin that normally sets protocol or global statuses in your ModulesLoaded event handler.
-// In order to make yourself 'Updater compatible', you would move the status control code from ModulesLoaded to another function,
-// say DoStartup. Then, in ModulesLoaded you would check for the existence of the MS_UPDATE_ENABLESTATUSCONTROL service.
-// If it does not exist, call DoStartup. If it does exist, hook the ME_UPDATE_STARTUPDONE event and call DoStartup from there. You may
-// also wish to call MS_UPDATE_ENABLESTATUSCONTROL with wParam == FALSE at this time, to disable Updater's own status control feature.
-
-// this service can be used to determine whether updates are possible for a component with the given name
-// wParam = 0
-// lParam = (char *)szComponentName
-// returns TRUE if updates are supported, FALSE otherwise
-#define MS_UPDATE_ISUPDATESUPPORTED "Update/IsUpdateSupported"
-
-#endif
-
-
-/////////////// Usage Example ///////////////
-
-#ifdef EXAMPLE_CODE
-
-// you need to #include "m_updater.h" and HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded) in your Load function...
-
-int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
-
- Update update = {0}; // for c you'd use memset or ZeroMemory...
- char szVersion[16];
-
- update.cbSize = sizeof(Update);
-
- update.szComponentName = pluginInfo.shortName;
- update.pbVersion = (BYTE *)CreateVersionString(&pluginInfo, szVersion);
- update.cpbVersion = strlen((char *)update.pbVersion);
-
- // these are the three lines that matter - the archive, the page containing the version string, and the text (or data)
- // before the version that we use to locate it on the page
- // (note that if the update URL and the version URL point to standard file listing entries, the backend xml
- // data will be used to check for updates rather than the actual web page - this is not true for beta urls)
- update.szUpdateURL = "http://scottellis.com.au:81/test/updater.zip";
- update.szVersionURL = "http://scottellis.com.au:81/test/updater_test.html";
- update.pbVersionPrefix = (BYTE *)"Updater version ";
-
- update.cpbVersionPrefix = strlen((char *)update.pbVersionPrefix);
-
- // do the same for the beta versions of the above struct members if you wish to allow beta updates from another URL
-
- CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
-
- // Alternatively, to register a plugin with e.g. file ID 2254 on the file listing...
- // CallService(MS_UPDATE_REGISTERFL, (WPARAM)2254, (LPARAM)&pluginInfo);
-
- return 0;
-}
-
-#endif
diff --git a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/skypepluginlink.c b/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/skypepluginlink.c deleted file mode 100644 index 0109bd6ede..0000000000 --- a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/skypepluginlink.c +++ /dev/null @@ -1,233 +0,0 @@ -#include "imo2sproxy.h"
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <stdlib.h>
-#include "skypepluginlink.h"
-#include "include/newpluginapi.h"
-#include "include/m_system.h"
-
-#define LockMutex(x) EnterCriticalSection (&x)
-#define UnlockMutex(x) LeaveCriticalSection(&x)
-#define InitMutex(x) InitializeCriticalSection(&x)
-#define ExitMutex(x) DeleteCriticalSection(&x)
-#define mutex_t CRITICAL_SECTION
-
-
-// -----------------------------------------------------------------------------
-
-struct tag_proxyInst;
-typedef struct tag_proxyInst IMO2SPROXY_INST;
-
-typedef struct
-{
- IMOSAPI *hInst;
- IMO2SPROXY_INST *hProxy;
- mutex_t sendmutex;
- mutex_t rcvmutex;
- int iConnectionStat;
-} CONNINST;
-
-struct tag_proxyInst
-{
- IMO2SPROXY vtbl; // Must be first!
- IMO2SPROXY_CFG *pCfg;
- SKYPEPLUGINLINK_CFG *pMyCfg;
- HANDLE hService;
- CONNINST stClient; // Currently only 1 connection
-};
-
-
-static CONNINST *m_pConn = NULL;
-
-// -----------------------------------------------------------------------------
-
-static void EventHandler(char *pszMsg, void *pUser);
-static int InitProxy(IMO2SPROXY_INST *hProxy);
-
-static int Imo2sproxy_Open(IMO2SPROXY *hInst);
-static void Imo2sproxy_Loop(IMO2SPROXY *hInst);
-static void Imo2sproxy_Exit(IMO2SPROXY *hInst);
-
-// -----------------------------------------------------------------------------
-static void EventHandler(char *pszMsg, void *pUser)
-{
- CONNINST *pInst = (CONNINST*)pUser;
- COPYDATASTRUCT cds;
- DWORD dwRes = 0;
-
- //LockMutex (pInst->sendmutex);
- if (pInst->hProxy->pCfg->bVerbose && pInst->hProxy->pCfg->fpLog)
- {
- fprintf (pInst->hProxy->pCfg->fpLog, "> %s\n", pszMsg);
- fflush (pInst->hProxy->pCfg->fpLog);
- }
- cds.dwData = 0;
- cds.cbData = strlen(pszMsg)+1;
- cds.lpData = pszMsg;
- CallService (SKYPE_PROTONAME PSS_SKYPEAPIMSG, 0, (LPARAM)&cds);
- //UnlockMutex (pInst->sendmutex);
-}
-
-// -----------------------------------------------------------------------------
-
-INT_PTR CallIn(WPARAM wParam,LPARAM lParam)
-{
- CONNINST *pInst = (CONNINST*)m_pConn;
- PCOPYDATASTRUCT pCopyData = (PCOPYDATASTRUCT)lParam;
-
- if (!pInst) return -1;
-
- if (pInst->hProxy->pMyCfg->bDelayLogin && pInst->iConnectionStat < 1)
- {
- LockMutex (pInst->rcvmutex);
- if (InitProxy(pInst->hProxy)<0)
- {
- UnlockMutex(pInst->rcvmutex);
- return -1;
- }
- UnlockMutex(pInst->rcvmutex);
- }
-
- if (pInst->hProxy->pCfg->bVerbose && pInst->hProxy->pCfg->fpLog)
- {
- fprintf (pInst->hProxy->pCfg->fpLog, "< [%s]\n", pCopyData->lpData);
- fflush (pInst->hProxy->pCfg->fpLog);
- }
- Imo2S_Send (pInst->hInst, pCopyData->lpData);
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-
-static void FreeConnection (CONNINST *pInst)
-{
- if (!pInst || !pInst->hProxy) return;
- if (pInst->hProxy->pCfg->bVerbose && pInst->hProxy->pCfg->fpLog)
- {
- fprintf (pInst->hProxy->pCfg->fpLog, "SkypePluginLink: Closed connection\n");
- fflush (pInst->hProxy->pCfg->fpLog);
- }
-
- if (pInst->hProxy->hService)
- {
- DestroyServiceFunction(pInst->hProxy->hService);
- pInst->hProxy->hService = NULL;
- CallService (SKYPE_PROTONAME SKYPE_REGPROXY, 0, 0);
- }
- ExitMutex(pInst->sendmutex);
- ExitMutex(pInst->rcvmutex);
- if (pInst->hInst)
- {
- IMOSAPI *hInst = pInst->hInst;
- pInst->hInst = NULL;
- Imo2S_Exit(hInst);
- }
-}
-
-// -----------------------------------------------------------------------------
-
-static int InitProxy(IMO2SPROXY_INST *hProxy)
-{
- char *pszError;
-
- if (!hProxy->stClient.hInst)
- {
- if (!(hProxy->stClient.hInst = Imo2S_Init(EventHandler, &hProxy->stClient, hProxy->pCfg->iFlags)))
- {
- hProxy->pCfg->logerror (stderr, "SkypePluginLink: Cannot start Imo2Skype instance.\n");
- return -1;
- }
- }
-
- // FIXME: We should enable logging dependent on a loglevel rather than just enabling it
- Imo2S_SetLog (hProxy->stClient.hInst, hProxy->pCfg->fpLog);
-
- if (hProxy->stClient.iConnectionStat == 0 ||
- (hProxy->stClient.iConnectionStat = Imo2S_Login (hProxy->stClient.hInst,
- hProxy->pCfg->pszUser, hProxy->pCfg->pszPass, &pszError)) != 1)
- {
- hProxy->pCfg->logerror (stderr, "SkypePluginLink: Cannot login with (%s/****): %s\n",
- hProxy->pCfg->pszUser, pszError);
- return -1;
- }
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-// PUBLIC
-// -----------------------------------------------------------------------------
-
-void SkypePluginLink_Defaults (SKYPEPLUGINLINK_CFG *pMyCfg)
-{
- memset (pMyCfg, 0, sizeof(SKYPEPLUGINLINK_CFG));
- pMyCfg->bDelayLogin = TRUE;
-}
-
-// -----------------------------------------------------------------------------
-
-IMO2SPROXY *SkypePluginLink_Init (IMO2SPROXY_CFG *pCfg, SKYPEPLUGINLINK_CFG *pMyCfg)
-{
- IMO2SPROXY_INST *pstInst = calloc(sizeof(IMO2SPROXY_INST), 1);
-
- pstInst->vtbl.Open = Imo2sproxy_Open;
- pstInst->vtbl.Loop = Imo2sproxy_Loop;
- pstInst->vtbl.Exit = Imo2sproxy_Exit;
- pstInst->pCfg = pCfg;
- pstInst->pMyCfg = pMyCfg;
- return (IMO2SPROXY*)pstInst;
-}
-
-// -----------------------------------------------------------------------------
-// IMPLEMENTATION
-// -----------------------------------------------------------------------------
-static int Imo2sproxy_Open(IMO2SPROXY *hInst)
-{
- IMO2SPROXY_INST *hProxy = (IMO2SPROXY_INST*)hInst;
- WNDCLASS WndClass ={0};
-
- if (hProxy->pCfg->bVerbose && hProxy->pCfg->fpLog)
- fprintf (hProxy->pCfg->fpLog, "SkypePluginLink:Open(Start)\n");
-
- // Only 1 connection instance, so we can init it right here
- InitMutex(hProxy->stClient.sendmutex);
- InitMutex(hProxy->stClient.rcvmutex);
- hProxy->stClient.hProxy = hProxy;
- m_pConn = &hProxy->stClient;
-
- // Register with Skype Plugin
- hProxy->hService = CreateServiceFunction("IMO2SPROXY" PSS_SKYPEAPIMSG, CallIn);
- CallService (SKYPE_PROTONAME SKYPE_REGPROXY, 0, (LPARAM)"IMO2SPROXY" PSS_SKYPEAPIMSG);
- hProxy->stClient.iConnectionStat = -1;
-
- if (!hProxy->pMyCfg->bDelayLogin)
- {
- if (InitProxy(hProxy)<0)
- {
- FreeConnection(&hProxy->stClient);
- return -1;
- }
- }
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-
-static void Imo2sproxy_Loop(IMO2SPROXY *hInst)
-{
- // No loop needed for call-in
-}
-
-
-// -----------------------------------------------------------------------------
-
-static void Imo2sproxy_Exit(IMO2SPROXY *hInst)
-{
- IMO2SPROXY_INST *hProxy = (IMO2SPROXY_INST*)hInst;
-
- if (hProxy->pCfg->bVerbose && hProxy->pCfg->fpLog)
- fprintf (hProxy->pCfg->fpLog, "SkypePluginLink:Exit()\n");
-
- FreeConnection (&hProxy->stClient);
- free (hProxy);
-}
-
diff --git a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/skypepluginlink.h b/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/skypepluginlink.h deleted file mode 100644 index ecc520ff1e..0000000000 --- a/plugins/!NotAdopted/IMO2sProxy/src/imo2skype/miranda/skypepluginlink.h +++ /dev/null @@ -1,10 +0,0 @@ -typedef struct {
- int bDelayLogin;
-} SKYPEPLUGINLINK_CFG;
-
-#define SKYPE_PROTONAME "SKYPE"
-#define PSS_SKYPEAPIMSG "/SendSkypeAPIMsg"
-#define SKYPE_REGPROXY "/RegisterProxySvc"
-
-void SkypePluginLink_Defaults (SKYPEPLUGINLINK_CFG *pMyCfg);
-IMO2SPROXY *SkypePluginLink_Init (IMO2SPROXY_CFG *pCfg, SKYPEPLUGINLINK_CFG *pMyCfg);
|