diff options
31 files changed, 3542 insertions, 0 deletions
diff --git a/Protocols/IAX/Docs/iax_changelog.txt b/Protocols/IAX/Docs/iax_changelog.txt new file mode 100644 index 0000000..2122737 --- /dev/null +++ b/Protocols/IAX/Docs/iax_changelog.txt @@ -0,0 +1,6 @@ +IAX protocol
+
+Changelog:
+
+. 0.1.0.0
+ + Initial version
\ No newline at end of file diff --git a/Protocols/IAX/Docs/iax_readme.txt b/Protocols/IAX/Docs/iax_readme.txt new file mode 100644 index 0000000..0910257 --- /dev/null +++ b/Protocols/IAX/Docs/iax_readme.txt @@ -0,0 +1,4 @@ +IAX protocol
+------------
+
+CAUTION: THIS IS A BETA STAGE PLUGIN. IT CAN DO VERY BAD THINGS. USE AT YOUR OWN RISK.
diff --git a/Protocols/IAX/Docs/iax_version.txt b/Protocols/IAX/Docs/iax_version.txt new file mode 100644 index 0000000..1628d11 --- /dev/null +++ b/Protocols/IAX/Docs/iax_version.txt @@ -0,0 +1 @@ +IAX protocol 0.1.0.0
\ No newline at end of file diff --git a/Protocols/IAX/Docs/langpack_iax.txt b/Protocols/IAX/Docs/langpack_iax.txt new file mode 100644 index 0000000..6b6a4fc --- /dev/null +++ b/Protocols/IAX/Docs/langpack_iax.txt @@ -0,0 +1,2 @@ +; IAX protocol
+; Author: Pescuma
diff --git a/Protocols/IAX/commons.h b/Protocols/IAX/commons.h new file mode 100644 index 0000000..2825e39 --- /dev/null +++ b/Protocols/IAX/commons.h @@ -0,0 +1,87 @@ +/*
+Copyright (C) 2009 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+
+#ifndef __COMMONS_H__
+# define __COMMONS_H__
+
+
+#define OEMRESOURCE
+#define _WIN32_WINNT 0x0400
+#include <windows.h>
+#include <commctrl.h>
+#include <tchar.h>
+#include <stdio.h>
+#include <time.h>
+
+#include <vector>
+
+// Miranda headers
+#define MIRANDA_VER 0x0900
+#include <win2k.h>
+#include <newpluginapi.h>
+#include <m_system.h>
+#include <m_system_cpp.h>
+#include <m_protocols.h>
+#include <m_protosvc.h>
+#include <m_protomod.h>
+#include <m_protoint.h>
+#include <m_clist.h>
+#include <m_contacts.h>
+#include <m_langpack.h>
+#include <m_database.h>
+#include <m_options.h>
+#include <m_utils.h>
+#include <m_updater.h>
+#include <m_popup.h>
+#include <m_history.h>
+#include <m_message.h>
+#include <m_folders.h>
+#include <m_icolib.h>
+#include <m_avatars.h>
+#include <m_netlib.h>
+#include <m_fontservice.h>
+
+#include "../../plugins/utils/mir_memory.h"
+#include "../../plugins/utils/mir_options.h"
+#include "../../plugins/utils/mir_icons.h"
+#include "../../plugins/utils/mir_log.h"
+
+#include <iaxclient.h>
+
+#include "resource.h"
+#include "m_iax.h"
+#include "options.h"
+
+
+#define MODULE_NAME "IAX"
+
+
+// Global Variables
+extern HINSTANCE hInst;
+extern PLUGINLINK *pluginLink;
+
+#define MAX_REGS(_A_) ( sizeof(_A_) / sizeof(_A_[0]) )
+#define MIR_FREE(_X_) if (_X_ != NULL) { mir_free(_X_); _X_ = NULL; }
+#define RELEASE(_X_) if (_X_ != NULL) { _X_->Release(); _X_ = NULL; }
+
+
+
+
+#endif // __COMMONS_H__
diff --git a/Protocols/IAX/iax.cpp b/Protocols/IAX/iax.cpp new file mode 100644 index 0000000..4b99e0a --- /dev/null +++ b/Protocols/IAX/iax.cpp @@ -0,0 +1,370 @@ +/*
+Copyright (C) 2009 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+#include "commons.h"
+
+
+// Prototypes ///////////////////////////////////////////////////////////////////////////
+
+
+PLUGININFOEX pluginInfo={
+ sizeof(PLUGININFOEX),
+#ifdef UNICODE
+ "IAX protocol (Unicode)",
+#else
+ "IAX protocol (Ansi)",
+#endif
+ PLUGIN_MAKE_VERSION(0,1,0,0),
+ "Provides support for Inter-Asterisk eXchange (IAX) protocol",
+ "Ricardo Pescuma Domenecci, sje",
+ "pescuma@miranda-im.org",
+ "© 2009 Ricardo Pescuma Domenecci, sje, IAXClient",
+ "http://pescuma.org/miranda/iax",
+ UNICODE_AWARE,
+ 0, //doesn't replace anything built-in
+#ifdef UNICODE
+ { 0x706e2aca, 0x4310, 0x49c5, { 0x93, 0x3c, 0xea, 0xa1, 0xd6, 0x52, 0xa2, 0x6f } } // {706E2ACA-4310-49c5-933C-EAA1D652A26F}
+#else
+ { 0x6d6a97da, 0x86ed, 0x422e, { 0x82, 0xe8, 0xd2, 0x6, 0x32, 0xb0, 0x7, 0x51 } } // {6D6A97DA-86ED-422e-82E8-D20632B00751}
+#endif
+};
+
+
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+MM_INTERFACE mmi;
+UTF8_INTERFACE utfi;
+LIST_INTERFACE li;
+
+std::vector<HANDLE> hHooks;
+std::vector<HANDLE> hServices;
+
+int ModulesLoaded(WPARAM wParam, LPARAM lParam);
+int PreShutdown(WPARAM wParam, LPARAM lParam);
+
+// IAXProto /////////////////////////////////////////////////////////////////////////////
+
+class IAXProto;
+typedef INT_PTR (IAXProto::*IAXServiceFunc)(WPARAM, LPARAM);
+typedef INT_PTR (IAXProto::*IAXServiceFuncParam)(WPARAM, LPARAM, LPARAM);
+
+class IAXProto : public PROTO_INTERFACE
+{
+private:
+ HANDLE hNetlibUser;
+
+public:
+ IAXProto(const char *aProtoName, const TCHAR *aUserName)
+ {
+ m_iDesiredStatus = m_iStatus = ID_STATUS_OFFLINE;
+
+ m_tszUserName = mir_tstrdup(aUserName);
+ m_szProtoName = mir_strdup(aProtoName);
+ m_szModuleName = mir_strdup(aProtoName);
+
+ TCHAR buffer[MAX_PATH];
+ mir_sntprintf(buffer, MAX_REGS(buffer), TranslateT("%s plugin connections"), m_tszUserName);
+
+ NETLIBUSER nl_user = {0};
+ nl_user.cbSize = sizeof(nl_user);
+ nl_user.flags = NUF_OUTGOING | NUF_TCHAR;
+ nl_user.szSettingsModule = m_szModuleName;
+ nl_user.ptszDescriptiveName = buffer;
+ hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
+ }
+
+ ~IAXProto()
+ {
+ Netlib_CloseHandle(hNetlibUser);
+
+ mir_free(m_tszUserName);
+ mir_free(m_szProtoName);
+ mir_free(m_szModuleName);
+ }
+
+ virtual HANDLE __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ) { return 0; }
+ virtual HANDLE __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ) { return 0; }
+
+ virtual int __cdecl Authorize( HANDLE hDbEvent ) { return 1; }
+ virtual int __cdecl AuthDeny( HANDLE hDbEvent, const char* szReason ) { return 1; }
+ virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ) { return 1; }
+ virtual int __cdecl AuthRequest( HANDLE hContact, const char* szMessage ) { return 1; }
+
+ virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ) { return 0; }
+
+ virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath ) { return 0; }
+ virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ) { return 1; }
+ virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason ) { return 1; }
+ virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename ) { return 1; }
+
+ virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL )
+ {
+ switch(type)
+ {
+ case PFLAGNUM_1:
+ return 0;
+
+ case PFLAGNUM_2:
+ return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND
+ | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE | PF2_INVISIBLE | PF2_IDLE;
+
+ case PFLAGNUM_3:
+ return 0;
+
+ case PFLAGNUM_4:
+ return PF4_NOCUSTOMAUTH;
+
+ case PFLAG_UNIQUEIDTEXT:
+ return NULL;
+
+ case PFLAG_UNIQUEIDSETTING:
+ return NULL;
+
+ case PFLAG_MAXLENOFMESSAGE:
+ return 100;
+ }
+
+ return 0;
+ }
+
+ virtual HICON __cdecl GetIcon( int iconIndex ) { return 0; }
+ virtual int __cdecl GetInfo( HANDLE hContact, int infoType ) { return 1; }
+
+ virtual HANDLE __cdecl SearchBasic( const char* id ) { return 0; }
+ virtual HANDLE __cdecl SearchByEmail( const char* email ) { return 0; }
+ virtual HANDLE __cdecl SearchByName( const char* nick, const char* firstName, const char* lastName ) { return 0; }
+ virtual HWND __cdecl SearchAdvanced( HWND owner ) { return 0; }
+ virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ) { return 0; }
+
+ virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ) { return 1; }
+ virtual int __cdecl RecvFile( HANDLE hContact, PROTOFILEEVENT* ) { return 1; }
+ virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ) { return 1; }
+ virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ) { return 1; }
+
+ virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ) { return 1; }
+ virtual HANDLE __cdecl SendFile( HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ) { return 0; }
+ virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ) { return 1; }
+ virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ) { return 1; }
+
+ virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ) { return 1; }
+ virtual int __cdecl SetStatus( int iNewStatus )
+ {
+ if (m_iDesiredStatus == iNewStatus)
+ return 0;
+ m_iDesiredStatus = iNewStatus;
+
+ if (m_iDesiredStatus == ID_STATUS_OFFLINE)
+ {
+ BroadcastStatus(ID_STATUS_OFFLINE);
+ }
+ else if (m_iStatus == ID_STATUS_OFFLINE)
+ {
+ BroadcastStatus(ID_STATUS_CONNECTING);
+ }
+ else if (m_iStatus > ID_STATUS_OFFLINE)
+ {
+ BroadcastStatus(m_iDesiredStatus);
+ }
+
+ return 0;
+ }
+
+ virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ) { return 0; }
+ virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ) { return 1; }
+ virtual int __cdecl SendAwayMsg( HANDLE hContact, HANDLE hProcess, const char* msg ) { return 1; }
+ virtual int __cdecl SetAwayMsg( int iStatus, const char* msg ) { return 1; }
+
+ virtual int __cdecl UserIsTyping( HANDLE hContact, int type ) { return 0; }
+
+ virtual int __cdecl OnEvent( PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam ) { return 1; }
+
+
+
+private:
+ void BroadcastStatus(int newStatus)
+ {
+ int oldStatus = m_iStatus;
+ m_iStatus = newStatus;
+ SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
+ }
+
+ void CreateProtoService(const char* szService, IAXServiceFunc serviceProc)
+ {
+ char str[MAXMODULELABELLENGTH];
+
+ mir_snprintf(str, sizeof(str), "%s%s", m_szModuleName, szService);
+ ::CreateServiceFunctionObj(str, (MIRANDASERVICEOBJ)*(void**)&serviceProc, this);
+ }
+
+ void CreateProtoService(const char* szService, IAXServiceFuncParam serviceProc, LPARAM lParam)
+ {
+ char str[MAXMODULELABELLENGTH];
+ mir_snprintf(str, sizeof(str), "%s%s", m_szModuleName, szService);
+ ::CreateServiceFunctionObjParam(str, (MIRANDASERVICEOBJPARAM)*(void**)&serviceProc, this, lParam);
+ }
+
+ HANDLE CreateProtoEvent(const char* szService)
+ {
+ char str[MAXMODULELABELLENGTH];
+ mir_snprintf(str, sizeof(str), "%s%s", m_szModuleName, szService);
+ return ::CreateHookableEvent(str);
+ }
+
+ int SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
+ {
+ ACKDATA ack = {0};
+ ack.cbSize = sizeof(ACKDATA);
+ ack.szModule = m_szModuleName;
+ ack.hContact = hContact;
+ ack.type = type;
+ ack.result = result;
+ ack.hProcess = hProcess;
+ ack.lParam = lParam;
+ return CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack);
+ }
+
+
+};
+
+OBJLIST<IAXProto> instances(1);
+
+
+// Functions ////////////////////////////////////////////////////////////////////////////
+
+
+extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ hInst = hinstDLL;
+ return TRUE;
+}
+
+
+extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
+{
+ pluginInfo.cbSize = sizeof(PLUGININFO);
+ return (PLUGININFO*) &pluginInfo;
+}
+
+
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ pluginInfo.cbSize = sizeof(PLUGININFOEX);
+ return &pluginInfo;
+}
+
+
+static const MUUID interfaces[] = { MIID_PROTOCOL, MIID_LAST };
+extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+{
+ return interfaces;
+}
+
+
+static IAXProto *IAXProtoInit(const char* pszProtoName, const TCHAR* tszUserName)
+{
+ IAXProto *proto = new IAXProto(pszProtoName, tszUserName);
+ instances.insert(proto);
+ return proto;
+}
+
+
+static int IAXProtoUninit(IAXProto *proto)
+{
+ instances.remove(proto);
+ return 0;
+}
+
+
+extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
+{
+ pluginLink = link;
+
+ CHECK_VERSION("IAX")
+
+ // TODO Assert results here
+ mir_getMMI(&mmi);
+ mir_getUTFI(&utfi);
+ mir_getLI(&li);
+
+ hHooks.push_back( HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded) );
+ hHooks.push_back( HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown) );
+
+ PROTOCOLDESCRIPTOR pd = {0};
+ pd.cbSize = sizeof(pd);
+ pd.szName = MODULE_NAME;
+ pd.fnInit = (pfnInitProto) IAXProtoInit;
+ pd.fnUninit = (pfnUninitProto) IAXProtoUninit;
+ pd.type = PROTOTYPE_PROTOCOL;
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM) &pd);
+
+ return 0;
+}
+
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ return 0;
+}
+
+
+// Called when all the modules are loaded
+int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+{
+ // Add our modules to the KnownModules list
+ CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0);
+
+ // Updater plugin support
+ if(ServiceExists(MS_UPDATE_REGISTER))
+ {
+ Update upd = {0};
+ char szCurrentVersion[30];
+
+ upd.cbSize = sizeof(upd);
+ upd.szComponentName = pluginInfo.shortName;
+
+ upd.szUpdateURL = UPDATER_AUTOREGISTER;
+
+ upd.szBetaVersionURL = "http://pescuma.org/miranda/iax_version.txt";
+ upd.szBetaChangelogURL = "http://pescuma.org/miranda/iax#Changelog";
+ upd.pbBetaVersionPrefix = (BYTE *)"IAX protocol ";
+ upd.cpbBetaVersionPrefix = strlen((char *)upd.pbBetaVersionPrefix);
+#ifdef UNICODE
+ upd.szBetaUpdateURL = "http://pescuma.org/miranda/iaxW.zip";
+#else
+ upd.szBetaUpdateURL = "http://pescuma.org/miranda/iax.zip";
+#endif
+
+ upd.pbVersion = (BYTE *)CreateVersionStringPlugin((PLUGININFO*) &pluginInfo, szCurrentVersion);
+ upd.cpbVersion = strlen((char *)upd.pbVersion);
+
+ CallService(MS_UPDATE_REGISTER, 0, (LPARAM)&upd);
+ }
+
+ return 0;
+}
+
+
+int PreShutdown(WPARAM wParam, LPARAM lParam)
+{
+ for(unsigned int i = 0; i < hHooks.size(); ++i)
+ UnhookEvent(hHooks[i]);
+
+ return 0;
+}
+
diff --git a/Protocols/IAX/iax.dsp b/Protocols/IAX/iax.dsp new file mode 100644 index 0000000..64d1d3f --- /dev/null +++ b/Protocols/IAX/iax.dsp @@ -0,0 +1,247 @@ +# Microsoft Developer Studio Project File - Name="iax" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=iax - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "iax.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "iax.mak" CFG="iax - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "iax - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "iax - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "iax - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "iax - Win32 Unicode Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "iax - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O1 /YX /FD /c
+# SUBTRACT BASE CPP /Fr
+# ADD CPP /nologo /G4 /MT /W3 /GX /O2 /Ob0 /I "../../include" /I "sdk" /I "lib/iaxclient" /D "WIN32" /D "W32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Fr /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 user32.lib shell32.lib wininet.lib gdi32.lib /nologo /base:"0x67100000" /dll /machine:I386 /filealign:0x200
+# SUBTRACT BASE LINK32 /pdb:none /map
+# ADD LINK32 libgsm.lib libiax2.lib libiaxclient.lib libogg.lib libportaudio.lib libportmixer.lib libspeex.lib ws2_32.lib kernel32.lib user32.lib /nologo /base:"0x3EC20000" /dll /map /debug /debugtype:both /machine:I386 /out:"..\..\bin\release\Plugins\iax.dll" /pdbtype:sept /libpath:"lib/iaxclient/Release" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ELSEIF "$(CFG)" == "iax - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /G4 /MT /W3 /GX /O2 /Ob0 /I "../../include" /FR /YX /FD /c
+# ADD CPP /nologo /G4 /MDd /W3 /GX /ZI /Od /I "../../include" /I "sdk" /I "lib/iaxclient" /D "WIN32" /D "W32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..bin\release\Plugins\iax.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT BASE LINK32 /profile /pdb:none
+# ADD LINK32 libgsm.lib libiax2.lib libiaxclient.lib libogg.lib libportaudio.lib libportmixer.lib libspeex.lib ws2_32.lib kernel32.lib user32.lib /nologo /base:"0x3EC20000" /dll /incremental:yes /debug /machine:I386 /out:"..\..\bin\debug\Plugins\iax.dll" /libpath:"lib/iaxclient/Debug" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ELSEIF "$(CFG)" == "iax - Win32 Unicode Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "iax___Win32_Unicode_Debug"
+# PROP BASE Intermediate_Dir "iax___Win32_Unicode_Debug"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Unicode_Debug"
+# PROP Intermediate_Dir "Unicode_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /G4 /MTd /W3 /GX /ZI /Od /I "../../include" /FR /YX /FD /c
+# ADD CPP /nologo /G4 /MDd /W3 /GX /ZI /Od /I "lib/iaxclient" /I "../../include" /I "sdk" /D "WIN32" /D "W32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "_USRDLL" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x32100000" /dll /incremental:yes /debug /machine:I386 /out:"..\..\bin\debug\Plugins\iax.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT BASE LINK32 /profile /pdb:none
+# ADD LINK32 libgsm.lib libiax2.lib libiaxclient.lib libogg.lib libportaudio.lib libportmixer.lib libspeex.lib ws2_32.lib kernel32.lib user32.lib /nologo /base:"0x3EC20000" /dll /incremental:yes /debug /machine:I386 /out:"..\..\bin\debug unicode\Plugins\iaxW.dll" /libpath:"lib/iaxclient/Debug" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ELSEIF "$(CFG)" == "iax - Win32 Unicode Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "iax___Win32_Unicode_Release"
+# PROP BASE Intermediate_Dir "iax___Win32_Unicode_Release"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Unicode_Release"
+# PROP Intermediate_Dir "Unicode_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /G4 /MT /W3 /GX /O2 /Ob0 /I "../../include" /Fr /YX /FD /c
+# ADD CPP /nologo /G4 /MT /W3 /GX /O2 /Ob0 /I "../../include" /I "sdk" /I "lib/iaxclient" /D "WIN32" /D "W32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "_USRDLL" /Fr /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x32100000" /dll /map /machine:I386 /out:"..\..\bin\release\Plugins\iax.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT BASE LINK32 /profile /pdb:none
+# ADD LINK32 libgsm.lib libiax2.lib libiaxclient.lib libogg.lib libportaudio.lib libportmixer.lib libspeex.lib ws2_32.lib kernel32.lib user32.lib /nologo /base:"0x3EC20000" /dll /map /debug /debugtype:both /machine:I386 /out:"..\..\bin\release unicode\Plugins\iaxW.dll" /pdbtype:sept /libpath:"lib/iaxclient/Release" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "iax - Win32 Release"
+# Name "iax - Win32 Debug"
+# Name "iax - Win32 Unicode Debug"
+# Name "iax - Win32 Unicode Release"
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\commons.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\m_iax.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_icons.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_log.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_memory.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_options.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\options.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\resource.rc
+# End Source File
+# End Group
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\iax.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_icons.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_log.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_options.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\options.cpp
+# End Source File
+# End Group
+# Begin Group "Docs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\Docs\iax_changelog.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\Docs\iax_readme.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\Docs\iax_version.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\Docs\langpack_iax.txt
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/Protocols/IAX/iax.dsw b/Protocols/IAX/iax.dsw new file mode 100644 index 0000000..c6c220d --- /dev/null +++ b/Protocols/IAX/iax.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "iax"=.\iax.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/Protocols/IAX/lib/iaxclient/Debug/libgsm.lib b/Protocols/IAX/lib/iaxclient/Debug/libgsm.lib Binary files differnew file mode 100644 index 0000000..3f5b976 --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Debug/libgsm.lib diff --git a/Protocols/IAX/lib/iaxclient/Debug/libiax2.lib b/Protocols/IAX/lib/iaxclient/Debug/libiax2.lib Binary files differnew file mode 100644 index 0000000..60acf2b --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Debug/libiax2.lib diff --git a/Protocols/IAX/lib/iaxclient/Debug/libiaxclient.lib b/Protocols/IAX/lib/iaxclient/Debug/libiaxclient.lib Binary files differnew file mode 100644 index 0000000..fa48ed8 --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Debug/libiaxclient.lib diff --git a/Protocols/IAX/lib/iaxclient/Debug/libogg.lib b/Protocols/IAX/lib/iaxclient/Debug/libogg.lib Binary files differnew file mode 100644 index 0000000..2f74751 --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Debug/libogg.lib diff --git a/Protocols/IAX/lib/iaxclient/Debug/libportaudio.lib b/Protocols/IAX/lib/iaxclient/Debug/libportaudio.lib Binary files differnew file mode 100644 index 0000000..0bbbf1b --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Debug/libportaudio.lib diff --git a/Protocols/IAX/lib/iaxclient/Debug/libportmixer.lib b/Protocols/IAX/lib/iaxclient/Debug/libportmixer.lib Binary files differnew file mode 100644 index 0000000..dd10033 --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Debug/libportmixer.lib diff --git a/Protocols/IAX/lib/iaxclient/Debug/libspeex.lib b/Protocols/IAX/lib/iaxclient/Debug/libspeex.lib Binary files differnew file mode 100644 index 0000000..f571d31 --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Debug/libspeex.lib diff --git a/Protocols/IAX/lib/iaxclient/Release/libgsm.lib b/Protocols/IAX/lib/iaxclient/Release/libgsm.lib Binary files differnew file mode 100644 index 0000000..b410d9d --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Release/libgsm.lib diff --git a/Protocols/IAX/lib/iaxclient/Release/libiax2.lib b/Protocols/IAX/lib/iaxclient/Release/libiax2.lib Binary files differnew file mode 100644 index 0000000..3af1037 --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Release/libiax2.lib diff --git a/Protocols/IAX/lib/iaxclient/Release/libiaxclient.lib b/Protocols/IAX/lib/iaxclient/Release/libiaxclient.lib Binary files differnew file mode 100644 index 0000000..72a00ec --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Release/libiaxclient.lib diff --git a/Protocols/IAX/lib/iaxclient/Release/libogg.lib b/Protocols/IAX/lib/iaxclient/Release/libogg.lib Binary files differnew file mode 100644 index 0000000..5d508ea --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Release/libogg.lib diff --git a/Protocols/IAX/lib/iaxclient/Release/libportaudio.lib b/Protocols/IAX/lib/iaxclient/Release/libportaudio.lib Binary files differnew file mode 100644 index 0000000..2b6b0d4 --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Release/libportaudio.lib diff --git a/Protocols/IAX/lib/iaxclient/Release/libportmixer.lib b/Protocols/IAX/lib/iaxclient/Release/libportmixer.lib Binary files differnew file mode 100644 index 0000000..1ee38c1 --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Release/libportmixer.lib diff --git a/Protocols/IAX/lib/iaxclient/Release/libspeex.lib b/Protocols/IAX/lib/iaxclient/Release/libspeex.lib Binary files differnew file mode 100644 index 0000000..da7d543 --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/Release/libspeex.lib diff --git a/Protocols/IAX/lib/iaxclient/iaxclient.h b/Protocols/IAX/lib/iaxclient/iaxclient.h new file mode 100644 index 0000000..9d602e2 --- /dev/null +++ b/Protocols/IAX/lib/iaxclient/iaxclient.h @@ -0,0 +1,1395 @@ +/*
+ * iaxclient: a cross-platform IAX softphone library
+ *
+ * Copyrights:
+ * Copyright (C) 2003-2006, Horizon Wimba, Inc.
+ * Copyright (C) 2007, Wimba, Inc.
+ *
+ * Contributors:
+ * Steve Kann <stevek@stevek.com>
+ * Frik Strecker <frik@gatherworks.com>
+ * Mihai Balea <mihai AT hates DOT ms>
+ * Peter Grayson <jpgrayson@gmail.com>
+ * Bill Cholewka <bcholew@gmail.com>
+ * Erik Bunce <kde@bunce.us>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU Lesser (Library) General Public License.
+ */
+#ifndef _iaxclient_h
+#define _iaxclient_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ \file iaxclient.h
+ \brief The IAXClient API
+
+
+
+ \note This is the include file which declares all external API functions to
+ IAXClient. It should include all functions and declarations needed
+ by IAXClient library users, but not include internal structures, or
+ require the inclusion of library internals (or sub-libraries)
+*/
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+#ifdef _MSC_VER
+typedef int socklen_t;
+#endif
+#include <stdio.h>
+#if defined(WIN32) || defined(_WIN32_WCE)
+#include <windows.h>
+#include <winsock.h>
+#else
+#include <sys/socket.h>
+#endif
+
+#ifdef BUILDING_DLL
+# if defined(WIN32) || defined(_WIN32_WCE)
+# ifdef _MSC_VER
+# define EXPORT __declspec(dllexport)
+# else
+# define EXPORT __stdcall __declspec(dllexport)
+# endif
+# else
+# define EXPORT
+#endif
+#else
+# define EXPORT
+#endif
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+#if defined(WIN32) || defined(_WIN32_WCE)
+#if defined(_MSC_VER)
+ typedef int (__stdcall *iaxc_sendto_t)(SOCKET, const void *, size_t, int,
+ const struct sockaddr *, socklen_t);
+ typedef int (__stdcall *iaxc_recvfrom_t)(SOCKET, void *, size_t, int,
+ struct sockaddr *, socklen_t *);
+#else
+ typedef int PASCAL (*iaxc_sendto_t)(SOCKET, const char *, int, int,
+ const struct sockaddr *, int);
+ typedef int PASCAL (*iaxc_recvfrom_t)(SOCKET, char *, int, int,
+ struct sockaddr *, int *);
+#endif
+#else
+ /*!
+ Defines the portotype for an application provided sendto implementation.
+ */
+ typedef int (*iaxc_sendto_t)(int, const void *, size_t, int,
+ const struct sockaddr *, socklen_t);
+ /*!
+ Defines the portotype for an application provided recvfrom implementation.
+ */
+ typedef int (*iaxc_recvfrom_t)(int, void *, size_t, int,
+ struct sockaddr *, socklen_t *);
+#endif
+
+/*!
+ Mask containing all potentially valid audio formats
+*/
+#define IAXC_AUDIO_FORMAT_MASK ((1<<16)-1)
+
+/*!
+ Mask containing all potentially valid video formats
+*/
+#define IAXC_VIDEO_FORMAT_MASK (((1<<25)-1) & ~IAXC_AUDIO_FORMAT_MASK)
+
+/* payload formats : WARNING: must match libiax values!!! */
+/* Data formats for capabilities and frames alike */
+#define IAXC_FORMAT_G723_1 (1 << 0) /*!< G.723.1 compression */
+#define IAXC_FORMAT_GSM (1 << 1) /*!< GSM compression */
+#define IAXC_FORMAT_ULAW (1 << 2) /*!< Raw mu-law data (G.711) */
+#define IAXC_FORMAT_ALAW (1 << 3) /*!< Raw A-law data (G.711) */
+#define IAXC_FORMAT_G726 (1 << 4) /*!< ADPCM, 32kbps */
+#define IAXC_FORMAT_ADPCM (1 << 5) /*!< ADPCM IMA */
+#define IAXC_FORMAT_SLINEAR (1 << 6) /*!< Raw 16-bit Signed Linear (8000 Hz) PCM */
+#define IAXC_FORMAT_LPC10 (1 << 7) /*!< LPC10, 180 samples/frame */
+#define IAXC_FORMAT_G729A (1 << 8) /*!< G.729a Audio */
+#define IAXC_FORMAT_SPEEX (1 << 9) /*!< Speex Audio */
+#define IAXC_FORMAT_ILBC (1 << 10) /*!< iLBC Audio */
+
+#define IAXC_FORMAT_MAX_AUDIO (1 << 15) /*!< Maximum audio format value */
+#define IAXC_FORMAT_JPEG (1 << 16) /*!< JPEG Images */
+#define IAXC_FORMAT_PNG (1 << 17) /*!< PNG Images */
+#define IAXC_FORMAT_H261 (1 << 18) /*!< H.261 Video */
+#define IAXC_FORMAT_H263 (1 << 19) /*!< H.263 Video */
+#define IAXC_FORMAT_H263_PLUS (1 << 20) /*!< H.263+ Video */
+#define IAXC_FORMAT_H264 (1 << 21) /*!< H264 Video */
+#define IAXC_FORMAT_MPEG4 (1 << 22) /*!< MPEG4 Video */
+#define IAXC_FORMAT_THEORA (1 << 24) /*!< Theora Video */
+#define IAXC_FORMAT_MAX_VIDEO (1 << 24) /*!< Maximum Video format value*/
+
+#define IAXC_EVENT_TEXT 1 /*!< Indicates a text event */
+#define IAXC_EVENT_LEVELS 2 /*!< Indicates a level event */
+#define IAXC_EVENT_STATE 3 /*!< Indicates a call state change event */
+#define IAXC_EVENT_NETSTAT 4 /*!< Indicates a network statistics update event */
+#define IAXC_EVENT_URL 5 /*!< Indicates a URL push via IAX(2) */
+#define IAXC_EVENT_VIDEO 6 /*!< Indicates a video event */
+#define IAXC_EVENT_REGISTRATION 8 /*!< Indicates a registration event */
+#define IAXC_EVENT_DTMF 9 /*!< Indicates a DTMF event */
+#define IAXC_EVENT_AUDIO 10 /*!< Indicates an audio event */
+#define IAXC_EVENT_VIDEOSTATS 11 /*!< Indicates a video statistics update event */
+#define IAXC_EVENT_VIDCAP_ERROR 12 /*!< Indicates a video capture error occurred */
+#define IAXC_EVENT_VIDCAP_DEVICE 13 /*!< Indicates a possible video capture device insertion/removal */
+
+#define IAXC_CALL_STATE_FREE 0 /*!< Indicates a call slot is free */
+#define IAXC_CALL_STATE_ACTIVE (1<<1) /*!< Indicates a call is active */
+#define IAXC_CALL_STATE_OUTGOING (1<<2) /*!< Indicates a call is outgoing */
+#define IAXC_CALL_STATE_RINGING (1<<3) /*!< Indicates a call is ringing */
+#define IAXC_CALL_STATE_COMPLETE (1<<4) /*!< Indicates a completed call */
+#define IAXC_CALL_STATE_SELECTED (1<<5) /*!< Indicates the call is selected */
+#define IAXC_CALL_STATE_BUSY (1<<6) /*!< Indicates a call is busy */
+#define IAXC_CALL_STATE_TRANSFER (1<<7) /*!< Indicates the call transfer has been released */
+#define IAXC_CALL_STATE_KEYED (1<<8) /*!< Indicates the call radio is activated */
+
+/*! Indicates that text is for an IAXClient status change */
+#define IAXC_TEXT_TYPE_STATUS 1
+/*! Indicates that text is an IAXClient warning message */
+#define IAXC_TEXT_TYPE_NOTICE 2
+/*! Represents that text is for an IAXClient error message */
+#define IAXC_TEXT_TYPE_ERROR 3
+/*!
+ Represents that text is for an IAXClient fatal error message.
+
+ The User Agent should probably display error message text, then die
+*/
+#define IAXC_TEXT_TYPE_FATALERROR 4
+/*! Represents a message sent from the server across the IAX stream*/
+#define IAXC_TEXT_TYPE_IAX 5
+
+/* registration replys, corresponding to IAX_EVENTs*/
+#define IAXC_REGISTRATION_REPLY_ACK 18 /*!< Indicates the registration was accepted (See IAX_EVENT_REGACC) */
+#define IAXC_REGISTRATION_REPLY_REJ 30 /*!< Indicates the registration was rejected (See IAX_EVENT_REGREJ) */
+#define IAXC_REGISTRATION_REPLY_TIMEOUT 6 /*!< Indicates the registration timed out (See IAX_EVENT_TIMEOUT) */
+
+#define IAXC_URL_URL 1 /*!< URL received */
+#define IAXC_URL_LDCOMPLETE 2 /*!< URL loading complete */
+#define IAXC_URL_LINKURL 3 /*!< URL link request */
+#define IAXC_URL_LINKREJECT 4 /*!< URL link reject */
+#define IAXC_URL_UNLINK 5 /*!< URL unlink */
+
+/* The source of the video or audio data triggering the event. */
+#define IAXC_SOURCE_LOCAL 1 /*!< Indicates that the event data source is local */
+#define IAXC_SOURCE_REMOTE 2 /*!< Indicates that the event data source is remote */
+
+/*!
+ The maximum size of a string contained within an event
+ */
+#define IAXC_EVENT_BUFSIZ 256
+
+/*!
+ A structure containing information about an audio level event.
+*/
+struct iaxc_ev_levels {
+ /*!
+ The input level in dB.
+ */
+ float input;
+
+ /*!
+ The output level in dB.
+ */
+ float output;
+};
+
+/*!
+ A structure containing information about a text event.
+*/
+struct iaxc_ev_text {
+ /*!
+ The type of text event.
+
+ Valid values are from the IAXC_TEXT_TYPE_{} family of defines.
+ \see IAXC_TEXT_TYPE_STATUS, IAXC_TEXT_TYPE_NOTICE, IAXC_TEXT_TYPE_ERROR,
+ IAXC_TEXT_TYPE_FATALERROR, IAXC_TEXT_TYPE_IAX
+ */
+ int type;
+
+ /*!
+ The call the text is associated with or -1 if general text.
+ */
+ int callNo;
+
+ /*!
+ The UTF8 encoded text of the message.
+ */
+ char message[IAXC_EVENT_BUFSIZ];
+};
+
+/*!
+ A structure containing information about a call state change event.
+*/
+struct iaxc_ev_call_state {
+ /*!
+ The call number whose state this is
+ */
+ int callNo;
+
+ /*!
+ The call state represented using the IAXC_CALL_STATE_{} defines.
+
+ \see IAXC_CALL_STATE_FREE, IAXC_CALL_STATE_ACTIVE, IAXC_CALL_STATE_OUTGOING,
+ IAXC_CALL_STATE_RINGING, IAXC_CALL_STATE_COMPLETE, IAXC_CALL_STATE_SELECTED,
+ IAXC_CALL_STATE_BUSY, IAXC_CALL_STATE_TRANSFER
+ */
+ int state;
+
+ /*!
+ The audio format of the call.
+
+ \see IAXC_FORMAT_G723_1, IAXC_FORMAT_GSM, IAXC_FORMAT_ULAW, IAXC_FORMAT_ALAW,
+ IAXC_FORMAT_G726, IAXC_FORMAT_ADPCM, IAXC_FORMAT_SLINEAR, IAXC_FORMAT_LPC10,
+ IAXC_FORMAT_G729A, IAXC_FORMAT_SPEEX, IAXC_FORMAT_ILBC, IAXC_FORMAT_MAX_AUDIO
+ */
+ int format;
+
+ /*!
+ The audio format of the call.
+
+ \see IAXC_FORMAT_JPEG, IAXC_FORMAT_PNG, IAXC_FORMAT_H261, IAXC_FORMAT_H263,
+ IAXC_FORMAT_H263_PLUS, IAXC_FORMAT_H264, IAXC_FORMAT_MPEG4,
+ IAXC_FORMAT_THEORA, IAXC_FORMAT_MAX_VIDEO
+ */
+ int vformat;
+
+ /*!
+ The remote number.
+ */
+ char remote[IAXC_EVENT_BUFSIZ];
+
+ /*!
+ The remote name.
+ */
+ char remote_name[IAXC_EVENT_BUFSIZ];
+
+ /*!
+ The local number.
+ */
+ char local[IAXC_EVENT_BUFSIZ];
+
+ /*!
+ The local calling context.
+ */
+ char local_context[IAXC_EVENT_BUFSIZ];
+};
+
+/*!
+ A structure containing information about a set of network statistics.
+*/
+struct iaxc_netstat {
+ /*!
+ The amount of observed jitter.
+ */
+ int jitter;
+
+ /*!
+ The lost frame percentage.
+ */
+ int losspct;
+
+ /*!
+ The number of missing frames.
+ */
+ int losscnt;
+
+ /*!
+ The number of frames received.
+ */
+ int packets;
+
+ /*!
+ The observed delay.
+ */
+ int delay;
+
+ /*!
+ The number of frames dropped.
+ */
+ int dropped;
+
+ /*!
+ The number of frames received out of order.
+ */
+ int ooo;
+};
+
+/*!
+ A structure containing information about a network statistics event.
+*/
+struct iaxc_ev_netstats {
+ /*!
+ The call whose statistics these are.
+ */
+ int callNo;
+
+ /*!
+ The Round Trip Time
+ */
+ int rtt;
+
+ /*!
+ The locally observed network statistics.
+ */
+ struct iaxc_netstat local;
+
+ /*!
+ The remotely (peer) observed network statistics.
+ */
+ struct iaxc_netstat remote;
+};
+
+/*!
+ A structure containing video statistics data.
+*/
+struct iaxc_video_stats
+{
+ unsigned long received_slices; /*!< Number of received slices. */
+ unsigned long acc_recv_size; /*!< Accumulated size of inbound slices. */
+ unsigned long sent_slices; /*!< Number of sent slices. */
+ unsigned long acc_sent_size; /*!< Accumulated size of outbound slices. */
+
+ unsigned long dropped_frames; /*!< Number of frames dropped by the codec (incomplete frames). */
+ unsigned long inbound_frames; /*!< Number of frames decoded by the codec (complete frames). */
+ unsigned long outbound_frames; /*!< Number of frames sent to the encoder. */
+
+ float avg_inbound_fps; /*!< Average fps of inbound complete frames. */
+ unsigned long avg_inbound_bps; /*!< Average inbound bitrate. */
+ float avg_outbound_fps; /*!< Average fps of outbound frames. */
+ unsigned long avg_outbound_bps; /*!< Average outbound bitrate. */
+
+ struct timeval start_time; /*!< Timestamp of the moment we started measuring. */
+};
+
+/*!
+ A structure containing information about a video statistics event.
+*/
+struct iaxc_ev_video_stats {
+ /*!
+ The call whose statistics these are.
+ */
+ int callNo;
+
+ /*!
+ The video statistics for the call.
+ */
+ struct iaxc_video_stats stats;
+};
+
+/*!
+ A structure containing information about an URL event.
+*/
+struct iaxc_ev_url {
+ /*!
+ The call this is for.
+ */
+ int callNo;
+
+ /*!
+ The type of URL received. See the IAXC_URL_{} defines.
+
+ \see IAXC_URL_URL, IAXC_URL_LINKURL, IAXC_URL_LDCOMPLETE, IAXC_URL_UNLINK,
+ IAXC_URL_LINKREJECT
+ */
+ int type;
+
+ /*!
+ The received URL.
+ */
+ char url[IAXC_EVENT_BUFSIZ];
+};
+
+/*!
+ A structure containing data for a video event.
+*/
+struct iaxc_ev_video {
+ /*!
+ The call this video data is for.
+
+ Will be -1 for local video.
+ */
+ int callNo;
+
+ /*!
+ Timestamp of the video
+ */
+ unsigned int ts;
+
+ /*!
+ The format of the video data.
+
+ \see IAXC_FORMAT_JPEG, IAXC_FORMAT_PNG, IAXC_FORMAT_H261, IAXC_FORMAT_H263,
+ IAXC_FORMAT_H263_PLUS, IAXC_FORMAT_H264, IAXC_FORMAT_MPEG4,
+ IAXC_FORMAT_THEORA, IAXC_FORMAT_MAX_VIDEO
+ */
+ int format;
+
+ /*!
+ The width of the video.
+ */
+ int width;
+
+ /*!
+ The height of the video.
+ */
+ int height;
+
+ /*!
+ Is the data encoded.
+
+ 1 for encoded data, 0 for raw.
+ */
+ int encoded;
+
+ /*!
+ The source of the data.
+
+ \see IAXC_SOURCE_LOCAL, IAXC_SOURCE_REMOTE
+ */
+ int source;
+
+ /*!
+ The size of the video data in bytes.
+ */
+ int size;
+
+ /*!
+ The buffer containing the video data.
+ */
+ char *data;
+};
+
+/*!
+ A structure containing data for an audio event.
+*/
+struct iaxc_ev_audio
+{
+ /*!
+ The call this audio data is for.
+ */
+ int callNo;
+
+ /*!
+ Timestamp of the video
+ */
+ unsigned int ts;
+
+ /*!
+ The format of the data.
+
+ \see IAXC_FORMAT_G723_1, IAXC_FORMAT_GSM, IAXC_FORMAT_ULAW, IAXC_FORMAT_ALAW,
+ IAXC_FORMAT_G726, IAXC_FORMAT_ADPCM, IAXC_FORMAT_SLINEAR, IAXC_FORMAT_LPC10,
+ IAXC_FORMAT_G729A, IAXC_FORMAT_SPEEX, IAXC_FORMAT_ILBC, IAXC_FORMAT_MAX_AUDIO
+ */
+ int format;
+
+ /*!
+ Is the data encoded.
+
+ 1 for encoded data, 0 for raw.
+ */
+ int encoded;
+
+ /*!
+ The source of the data.
+
+ \see IAXC_SOURCE_LOCAL, IAXC_SOURCE_REMOTE
+ */
+ int source;
+
+ /*!
+ The size of the audio data in bytes.
+ */
+ int size;
+
+ /*!
+ The buffer containing the audio data.
+ */
+ unsigned char *data;
+};
+
+/*!
+ A structure containing information about a registration event
+*/
+struct iaxc_ev_registration {
+ /*!
+ Indicates the registration id this event corresponds to.
+
+ \see iaxc_register
+ */
+ int id;
+
+ /*!
+ The registration reply.
+
+ The values are from the IAXC_REGISTRATION_REPLY_{} family of macros.
+ \see IAX_EVENT_REGACC, IAX_EVENT_REGREJ, IAX_EVENT_TIMEOUT
+ */
+ int reply;
+
+ /*!
+ The number of 'voicemail' messages.
+ */
+ int msgcount;
+};
+
+/*!
+ A structure containing information about a DTMF event
+ */
+struct iaxc_ev_dtmf {
+ /*!
+ The call this DTMF event is for.
+ */
+ int callNo;
+
+ /*!
+ The digit represented by this DTMF tone
+ */
+ char digit;
+};
+
+/*!
+ A structure describing a single IAXClient event.
+*/
+typedef struct iaxc_event_struct {
+ /*!
+ Points to the next entry in the event queue
+ \internal
+ */
+ struct iaxc_event_struct *next;
+
+ /*!
+ The type uses one of the IAXC_EVENT_{} macros to describe which type of
+ event is being presented
+ */
+ int type;
+
+ /*!
+ Contains the data specific to the type of event.
+ */
+ union {
+ /*! Contains level data if type = IAXC_EVENT_LEVELS */
+ struct iaxc_ev_levels levels;
+ /*! Contains text data if type = IAXC_EVENT_TEXT */
+ struct iaxc_ev_text text;
+ /*! Contains call state data if type = IAXC_EVENT_STATE */
+ struct iaxc_ev_call_state call;
+ /*! Contains network statistics if type = IAXC_EVENT_NETSTAT */
+ struct iaxc_ev_netstats netstats;
+ /*! Contains video statistics if type = IAXC_EVENT_VIDEOSTATS */
+ struct iaxc_ev_video_stats videostats;
+ /*! Contains url data if type = IAXC_EVENT_URL */
+ struct iaxc_ev_url url;
+ /*! Contains video data if type = IAXC_EVENT_VIDEO */
+ struct iaxc_ev_video video;
+ /*! Contains audio data if type = IAXC_EVENT_AUDIO */
+ struct iaxc_ev_audio audio;
+ /*! Contains registration data if type = IAXC_EVENT_REGISTRATION */
+ struct iaxc_ev_registration reg;
+ /*! Contains DTMF data if type = IAXC_EVENT_DTMF */
+ struct iaxc_ev_dtmf dtmf;
+ } ev;
+} iaxc_event;
+
+/*!
+ Defines the prototype for event callback handlers
+ \param e The event structure being passed to the callback
+
+ \return The result of processing the event; > 0 if successfully handled the event, 0 if not handled, < 0 to indicate an error occurred processing the event.
+*/
+typedef int (*iaxc_event_callback_t)(iaxc_event e);
+
+/*!
+ Sets the callback to call with IAXClient events
+ \param func The callback function to call with events
+*/
+EXPORT void iaxc_set_event_callback(iaxc_event_callback_t func);
+
+/*!
+ Sets iaxclient to post a pointer to a copy of event using o/s specific Post method
+ \param handle
+ \param id
+*/
+EXPORT int iaxc_set_event_callpost(void *handle, int id);
+
+/*!
+ frees event delivered via o/s specific Post method
+ \param e The event to free
+*/
+EXPORT void iaxc_free_event(iaxc_event *e);
+
+
+/* Event Accessors */
+/*!
+ Returns the levels data associated with event \a e.
+ \param e The event to retrieve the levels from.
+*/
+EXPORT struct iaxc_ev_levels *iaxc_get_event_levels(iaxc_event *e);
+
+/*!
+ Returns the text data associated with event \a e.
+ \param e The event to retrieve text from.
+*/
+EXPORT struct iaxc_ev_text *iaxc_get_event_text(iaxc_event *e);
+
+/*!
+ Returns the event state data associated with event \a e.
+ \param e The event to retrieve call state from.
+*/
+EXPORT struct iaxc_ev_call_state *iaxc_get_event_state(iaxc_event *e);
+
+/*!
+ Set Preferred UDP Port:
+ \param sourceUdpPort The source UDP port to prefer
+ 0 Use the default port (4569), <0 Uses a dynamically assigned port, and
+ >0 tries to bind to the specified port
+
+ \note must be called before iaxc_initialize()
+*/
+EXPORT void iaxc_set_preferred_source_udp_port(int sourceUdpPort);
+
+/*!
+ Returns the UDP port that has been bound to.
+
+ \return The UDP port bound to; -1 if no port or
+*/
+EXPORT int iaxc_get_bind_port();
+
+/*!
+ Initializes the IAXClient library
+ \param num_calls The maximum number of simultaneous calls to handle.
+
+ This initializes the IAXClient
+*/
+EXPORT int iaxc_initialize(int num_calls);
+
+/*!
+ Shutsdown the IAXClient library.
+
+ This should be called by applications utilizing iaxclient before they exit.
+ It dumps all calls, and releases any audio/video drivers being used.
+
+ \note It is unsafe to call most IAXClient API's after calling this!
+*/
+EXPORT void iaxc_shutdown();
+
+/*!
+ Sets the formats to be used
+ \param preferred The single preferred audio format
+ \param allowed A mask containing all audio formats to allow
+
+ \see IAXC_FORMAT_G723_1, IAXC_FORMAT_GSM, IAXC_FORMAT_ULAW, IAXC_FORMAT_ALAW,
+ IAXC_FORMAT_G726, IAXC_FORMAT_ADPCM, IAXC_FORMAT_SLINEAR, IAXC_FORMAT_LPC10,
+ IAXC_FORMAT_G729A, IAXC_FORMAT_SPEEX, IAXC_FORMAT_ILBC, IAXC_FORMAT_MAX_AUDIO
+*/
+EXPORT void iaxc_set_formats(int preferred, int allowed);
+
+/*!
+ Sets the minimum outgoing frame size.
+ \param samples The minimum number of samples to include in an outgoing frame.
+*/
+EXPORT void iaxc_set_min_outgoing_framesize(int samples);
+
+/*!
+ Sets the caller id \a name and \a number.
+ \param name The caller id name.
+ \param number The caller id number.
+*/
+EXPORT void iaxc_set_callerid(const char * name, const char * number);
+
+/*!
+ Starts all the internal processing thread(s).
+
+ \note Should be called after iaxc_initialize, but before any call processing
+ related functions.
+*/
+EXPORT int iaxc_start_processing_thread();
+
+/*!
+ Stops all the internal processing thread(s).
+
+ \note Should be called before iaxc_shutdown.
+*/
+EXPORT int iaxc_stop_processing_thread();
+
+/*!
+ Initiates a call to an end point
+ \param num The entity to call in the format of [user[:password]]@@peer[:portno][/exten[@@context]]
+
+ \return The call number upon sucess; -1 otherwise.
+
+ \note This is the same as calling iaxc_call_ex(num, NULL, NULL, 1).
+*/
+EXPORT int iaxc_call(const char * num);
+
+/*!
+ Initiates a call to an end point
+ \param num The entity to call in the format of [user[:password]]@@peer[:portno][/exten[@@context]]
+ \param callerid_name The local caller id name to use
+ \param callerid_number The local caller id number to use
+ \param video 0 indicates no-video. Any non-zero value indicates video is requested
+
+ \return The call number upon sucess; -1 otherwise.
+*/
+EXPORT int iaxc_call_ex(const char* num, const char* callerid_name, const char* callerid_number, int video);
+
+/*!
+ Unregisters IAXClient from a server
+ \param id The registration number returned by iaxc_register.
+*/
+EXPORT int iaxc_unregister( int id );
+
+/*!
+ Registers the IAXClient instance with an IAX server
+ \param user The username to register as
+ \param pass The password to register with
+ \param host The address of the host/peer to register with
+
+ \return The registration id number upon success; -1 otherwise.
+*/
+EXPORT int iaxc_register(const char * user, const char * pass, const char * host);
+
+/*!
+ Registers the IAXClient instance with an IAX server
+ \param user The username to register as
+ \param pass The password to register with
+ \param host The address of the host/peer to register with
+ \param refresh The registration refresh period
+
+ \return The registration id number upon success; -1 otherwise.
+*/
+EXPORT int iaxc_register_ex(const char * user, const char * pass, const char * host, int refresh);
+
+/*!
+ Respond to incoming call \a callNo as busy.
+*/
+EXPORT void iaxc_send_busy_on_incoming_call(int callNo);
+
+/*!
+ Answers the incoming call \a callNo.
+ \param callNo The number of the call to answer.
+*/
+EXPORT void iaxc_answer_call(int callNo);
+
+/*!
+ Radio Transmitter and Receiver Control Activiate
+ \param callNo The number of the call to activate
+*/
+EXPORT void iaxc_key_radio(int callNo);
+
+/*!
+ Radio Transmitter and Receiver Control Deactivate
+ \param callNo The number of the call to deactivate
+*/
+EXPORT void iaxc_unkey_radio(int callNo);
+
+/*!
+ Initiate a blind call transfer of \a callNo to \a number.
+ \param callNo The active call to transfer.
+ \param number The number to transfer the call to. See draft-guy-iax-03 section 8.4.1 for further details.
+*/
+EXPORT void iaxc_blind_transfer_call(int callNo, const char * number);
+
+/*!
+ Setup a transfer of \a sourceCallNo to \a targetCallNo.
+ \param sourceCallNo The number of the active call session to transfer.
+ \param targetCallNo The active call session to be transferred to.
+
+ This is used in performing as the final step in an attended call transfer.
+*/
+EXPORT void iaxc_setup_call_transfer(int sourceCallNo, int targetCallNo);
+
+/*!
+ Hangs up and frees all non-free calls.
+*/
+EXPORT void iaxc_dump_all_calls(void);
+
+/*!
+ Hangs up and frees call \a callNo
+ \param callNo The call number to reject.
+*/
+EXPORT void iaxc_dump_call_number( int callNo );
+
+/*!
+ Hangs up and frees the currently selected call.
+*/
+EXPORT void iaxc_dump_call(void);
+
+/*!
+ Rejects the currently selected call.
+
+ \note This is pretty much a useless API, since the act of selecting a call
+ will answer it.
+*/
+EXPORT void iaxc_reject_call(void);
+
+/*!
+ Rejects the incoming call \a callNo.
+ \param callNo The call number to reject.
+*/
+EXPORT void iaxc_reject_call_number(int callNo);
+
+/*!
+ Sends a DTMF digit to the currently selected call.
+ \param digit The DTMF digit to send (0-9, A-D, *, #).
+*/
+EXPORT void iaxc_send_dtmf(char digit);
+
+/*!
+ Sends text to the currently selected call.
+*/
+EXPORT void iaxc_send_text(const char * text);
+
+/*!
+ Sends \a text to call \a callNo
+*/
+EXPORT void iaxc_send_text_call(int callNo, const char * text);
+
+/*!
+ Sends a URL across the currently selected call
+ \param url The URL to send across.
+ \param link If non-zero the URL is a link
+*/
+EXPORT void iaxc_send_url(const char *url, int link); /* link == 1 ? AST_HTML_LINKURL : AST_HTML_URL */
+
+/*!
+ Suspends thread execution for an interval measured in milliseconds
+ \param ms The number of milliseconds to sleep
+*/
+EXPORT void iaxc_millisleep(long ms);
+
+/*!
+ Sets the silence threshold to \a thr.
+ \param thr The threshold value in dB. A value of 0.0f effectively mutes audio input.
+*/
+EXPORT void iaxc_set_silence_threshold(float thr);
+
+/*!
+ Sets the audio output to \a mode.
+ \param mode The audio mode 0 indicates remote audio should be played; non-zero prevents remote audio from being played.
+*/
+EXPORT void iaxc_set_audio_output(int mode);
+
+/*!
+ Sets \a callNo as the currently selected call
+ \param callNo The call to select or < 0 to indicate no selected call.
+
+ \note Will answer an incoming ringing call as a side effect. Personally I
+ believe this behavior is undesirable and feel it renders iaxc_reject_call
+ pretty much useless.
+*/
+EXPORT int iaxc_select_call(int callNo);
+
+/*!
+ Returns the first free call number.
+*/
+EXPORT int iaxc_first_free_call();
+
+/*!
+ Returns the number of the currently selected call.
+*/
+EXPORT int iaxc_selected_call();
+
+/*!
+ Causes the audio channel for \a callNo to QUELCH (be squelched).
+ \param callNo The number of the active, accepted call to quelch.
+ \param MOH If non-zero Music On Hold should be played on the QUELCH'd call.
+*/
+EXPORT int iaxc_quelch(int callNo, int MOH);
+
+/*!
+ Causes the audio channel for \a callNo to be UNQUELCH (unsquelched).
+*/
+EXPORT int iaxc_unquelch(int callNo);
+
+/*!
+ Returns the current mic boost setting.
+
+ \return 0 if mic boost is disabled; otherwise non-zero.
+*/
+EXPORT int iaxc_mic_boost_get( void ) ;
+
+/*!
+ Sets the mic boost setting.
+ \param enable If non-zero enable the mic boost; otherwise disable.
+*/
+EXPORT int iaxc_mic_boost_set( int enable ) ;
+
+/*!
+ Returns a copy of IAXClient library version
+ \param ver A buffer to store the version string in. It MUST be at least
+ IAXC_EVENT_BUFSIZ bytes in size.
+
+ \return the version string (as stored in \a ver).
+*/
+EXPORT char* iaxc_version(char *ver);
+
+/*!
+ Fine tune jitterbuffer control
+ \param value
+*/
+EXPORT void iaxc_set_jb_target_extra( long value );
+
+/*!
+ Application-defined networking; give substitute sendto and recvfrom
+ functions.
+ \param st The send function to use.
+ \param rf The receive function to use.
+
+ \note Must be called before iaxc_initialize!
+*/
+EXPORT void iaxc_set_networking(iaxc_sendto_t st, iaxc_recvfrom_t rf) ;
+
+/*!
+ wrapper for libiax2 get_netstats
+ \param call
+ \param rtt
+ \param local
+ \param remote
+*/
+EXPORT int iaxc_get_netstats(int call, int *rtt, struct iaxc_netstat *local, struct iaxc_netstat *remote);
+
+/*!
+ A structure containing information about a video capture device.
+*/
+struct iaxc_video_device {
+ /*!
+ The "human readable" name of the device
+ */
+ const char *name;
+
+ /*!
+ unique id of the device
+ */
+ const char *id_string;
+
+ /*!
+ iaxclient id of the device
+ */
+ int id;
+};
+
+#define IAXC_AD_INPUT (1<<0) /*!< Device is usable for input*/
+#define IAXC_AD_OUTPUT (1<<1) /*!< Device is usable for output */
+#define IAXC_AD_RING (1<<2) /*!< Device is usable for ring */
+#define IAXC_AD_INPUT_DEFAULT (1<<3) /*!< Indicates the default input device */
+#define IAXC_AD_OUTPUT_DEFAULT (1<<4) /*!< Indicates the default output device */
+#define IAXC_AD_RING_DEFAULT (1<<5) /*!< Indicates the default ring device */
+
+/*!
+ A structure containing information about an audio device.
+*/
+struct iaxc_audio_device {
+ /*!
+ The "human readable" name of the device
+ */
+ const char * name;
+
+ /*!
+ Capability flags, defined using the IAXC_AD_{} macros.
+ */
+ long capabilities;
+
+ /*!
+ The device driver specific ID.
+ */
+ int devID;
+};
+
+/*! Get audio device information:
+ \param devs Returns an array of iaxc_audio_device structures.
+ The array will will be valid as long as iaxc is initialized.
+ \param nDevs Returns the number of devices in the devs array
+ \param input Returns the currently selected input device
+ \param output Returns the currently selected output device
+ \param ring Returns the currently selected ring device
+ */
+EXPORT int iaxc_audio_devices_get(struct iaxc_audio_device **devs, int *nDevs, int *input, int *output, int *ring);
+
+/*!
+ Sets the current audio devices
+ \param input The device to use for audio input
+ \param output The device to use for audio output
+ \param ring The device to use to present ring sounds
+ */
+EXPORT int iaxc_audio_devices_set(int input, int output, int ring);
+
+/*!
+ Get the audio device input level.
+
+ \return the input level in the range of 0.0f minimum to 1.0f maximum.
+ */
+EXPORT float iaxc_input_level_get();
+
+/*!
+ Get the audio device output level.
+
+ \return the input level in the range of 0.0f minimum to 1.0f maximum.
+ */
+EXPORT float iaxc_output_level_get();
+
+/*!
+ Sets the audio input level to \a level.
+ \param level The level in the range from 0.0f (min) to 1.0f (max).
+*/
+EXPORT int iaxc_input_level_set(float level);
+
+/*!
+ Sets the audio output level to \a level.
+ \param level The level in the range from 0.0f (min) to 1.0f (max).
+ */
+EXPORT int iaxc_output_level_set(float level);
+
+/*!
+ A structure describing a sound to IAXClient
+*/
+struct iaxc_sound {
+ short *data; /*!< Sound sample data in 8KHz 16-bit signed format. */
+ long len; /*!< Length of sample in frames. */
+ int malloced; /*!< Should the library free() the data after it is played? */
+ int channel; /*!< The channel used: 0 for output, 1 for ring. */
+ int repeat; /*!< Number of times to repeat (-1 = infinite). */
+ long pos; /*!< \internal use: current play position. */
+ int id; /*!< \internal use: sound ID. */
+ struct iaxc_sound *next; /*!< \internal use: next in list. */
+};
+
+/*!
+ Play a sound.
+ \param sound An iaxc_sound structure.
+ \param ring 0 to play through output device or 1 to play through the "ring" device.
+
+ \return The id number of the sound being played
+*/
+EXPORT int iaxc_play_sound(struct iaxc_sound *sound, int ring);
+
+/*!
+ Stop sound \a id from being played.
+ \param id The id of a sound to stop as returned from iaxc_play_sound.
+*/
+EXPORT int iaxc_stop_sound(int id);
+
+#define IAXC_FILTER_DENOISE (1<<0) /*!< Noise reduction filter */
+#define IAXC_FILTER_AGC (1<<1) /*!< Automatic Gain Control */
+#define IAXC_FILTER_ECHO (1<<2) /*!< Echo cancellation filter */
+#define IAXC_FILTER_AAGC (1<<3) /*!< Analog (mixer-based) Automatic Gain Control */
+#define IAXC_FILTER_CN (1<<4) /*!< Send Comfort Noise (CN) frames when silence is detected */
+#define IAXC_FILTER_DEREVERB (1<<5) /*!< Reverb reduction filter */
+
+/*!
+ Returns the set of audio filters being applied.
+
+ The IAXC_FILTER_{} defines are used to specify the filters.
+ \see IAXC_FILTER_DENOISE, IAXC_FILTER_AGC, IAXC_FILTER_ECHO, IAXC_FILTER_AAGC,
+ IAXC_FILTER_CN
+ */
+EXPORT int iaxc_get_filters(void);
+
+/*!
+ Sets the current audio filters to apply.
+ \param filters The combination of all the audio filters to use (IAXC_FILTER_{} defines).
+
+ The IAXC_FILTER_{} defines are used to specify the filters.
+ \see IAXC_FILTER_DENOISE, IAXC_FILTER_AGC, IAXC_FILTER_ECHO, IAXC_FILTER_AAGC,
+ IAXC_FILTER_CN
+ */
+EXPORT void iaxc_set_filters(int filters);
+
+/*!
+ Sets speex specific codec settings
+ \param decode_enhance 1/0 perceptual enhancement for decoder
+ \param quality: Generally, set either quality (0-9) or bitrate. -1 for "default"
+ \param bitrate in kbps. Applies to CBR only; -1 for default.
+ (overrides "quality" for CBR mode)
+ \param vbr Variable bitrate mode: 0/1
+ \param abr mode/rate: 0 for not ABR, bitrate for ABR mode
+ \param complexity Algorithmic complexity. Think -N for gzip.
+ Higher numbers take more CPU for better quality. 3 is
+ default and good choice.
+
+ A good choice is (1,-1,-1,0,8000,3): 8kbps ABR
+ */
+EXPORT void iaxc_set_speex_settings(int decode_enhance, float quality, int bitrate, int vbr, int abr, int complexity);
+
+/*
+ Functions and flags for setting and getting audio callback preferences
+ The application can request to receive local/remote, raw/encoded audio
+ through the callback mechanism. Please note that changing callback
+ settings will overwrite all previous settings.
+*/
+/*!
+ Indicates the preference that local audio should be passed to the registered callback in a raw 8KHz 16-bit signed format.
+*/
+#define IAXC_AUDIO_PREF_RECV_LOCAL_RAW (1 << 0)
+
+/*!
+ Indicates the preference that local audio should be passed to the registered callback in the current encoded format.
+*/
+#define IAXC_AUDIO_PREF_RECV_LOCAL_ENCODED (1 << 1)
+
+/*!
+ Indicates the preference that remote audio should be passed to the registered callback in a raw 8KHz 16-bit signed format.
+*/
+#define IAXC_AUDIO_PREF_RECV_REMOTE_RAW (1 << 2)
+
+/*!
+ Indicates the preference that remote audio should be passed to the registered callback in the current encoded format.
+*/
+#define IAXC_AUDIO_PREF_RECV_REMOTE_ENCODED (1 << 3)
+
+/*!
+ Indicates the preference that sending of audio should be disabled.
+*/
+#define IAXC_AUDIO_PREF_SEND_DISABLE (1 << 4)
+
+/*!
+ Returns the various audio delivery preferences.
+
+ The preferences are represented using the AIXC_AUDIO_PREF_{} family of defines.
+*/
+EXPORT unsigned int iaxc_get_audio_prefs(void);
+
+/*!
+ Set the various audio delivery preferences
+ \param prefs The desired preferences to use. They are represented using the AIXC_AUDIO_PREF_{} family of defines.
+
+ \return 0 on success and -1 on error.
+
+ \see IAXC_AUDIO_PREF_RECV_LOCAL_RAW, IAXC_AUDIO_PREF_RECV_LOCAL_ENCODED,
+ IAXC_AUDIO_PREF_RECV_REMOTE_RAW, IAXC_AUDIO_PREF_RECV_REMOTE_ENCODED,
+ IAXC_AUDIO_PREF_SEND_DISABLE
+ */
+EXPORT int iaxc_set_audio_prefs(unsigned int prefs);
+
+/*!
+ Get video capture device information.
+ WARNING: the array pointed to by parameter 'devs' below is owned
+ by iaxclient, and may be freed on subsequent calls to
+ this function.
+ \param devs Returns an array of iaxc_video_device structures.
+ The array will only be valid until this function is
+ called again (if the device list changes), or until
+ iaxc is shutdown.
+ \param nDevs Returns the number of devices in the devs array
+ \param devId Returns the id of the currently selected video capture device
+
+ \return -1 on error, 0 if no change to the device list, 1 if it's been updated
+ */
+EXPORT int iaxc_video_devices_get(struct iaxc_video_device **devs, int *nDevs, int *devId);
+
+/*!
+ Sets the current video capture device
+ \param devId The id of the device to use for video capture
+ */
+EXPORT int iaxc_video_device_set(int devId);
+
+/*
+ * Acceptable range for video rezolution
+ */
+#define IAXC_VIDEO_MAX_WIDTH 704 /*!< Maximum video width */
+#define IAXC_VIDEO_MAX_HEIGHT 576 /*!< Maximum video height */
+#define IAXC_VIDEO_MIN_WIDTH 80 /*!< Minimum video width */
+#define IAXC_VIDEO_MIN_HEIGHT 60 /*!< Minimum video height */
+
+/*
+ Video callback preferences
+ The client application can obtain any combination of
+ remote/local, encoded/raw video through the event callback
+ mechanism
+ Use these flags to specify what kind of video do you want to receive
+ */
+
+/*!
+ Indicates the preference that local video should be passed to the registered callback in a raw format (typically YUV420).
+*/
+#define IAXC_VIDEO_PREF_RECV_LOCAL_RAW (1 << 0)
+
+/*!
+ Indicates the preference that local video should be passed to the registered callback in the current encoded format.
+*/
+#define IAXC_VIDEO_PREF_RECV_LOCAL_ENCODED (1 << 1)
+
+/*!
+ Indicates the preference that remote video should be passed to the registered callback in a raw format (typically YUV420).
+*/
+#define IAXC_VIDEO_PREF_RECV_REMOTE_RAW (1 << 2)
+
+/*!
+ Indicates the preference that remote video should be passed to the registered callback in the current encoded format.
+*/
+#define IAXC_VIDEO_PREF_RECV_REMOTE_ENCODED (1 << 3)
+
+/*!
+ Indicates the preference that sending of video should be disabled.
+*/
+#define IAXC_VIDEO_PREF_SEND_DISABLE (1 << 4)
+
+/*!
+ This flag specifies that you want raw video in RGB32 format
+
+ RGB32: FFRRGGBB aligned 4 bytes per pixel
+ When this flag is set, iaxclient will convert YUV420 raw video into
+ RGB32 before passing it to the main app.
+ */
+#define IAXC_VIDEO_PREF_RECV_RGB32 (1 << 5)
+
+/*!
+ Use this flag to disable/enable camera hardware
+ */
+#define IAXC_VIDEO_PREF_CAPTURE_DISABLE (1 << 6)
+
+/*!
+ Returns the current video preferences.
+
+ The preferences are represented using the AIXC_VIDEO_PREF_{} family of macros.
+
+ \see IAXC_VIDEO_PREF_RECV_LOCAL_RAW, IAXC_VIDEO_PREF_RECV_LOCAL_ENCODED,
+ IAXC_VIDEO_PREF_RECV_REMOTE_RAW, IAXC_VIDEO_PREF_RECV_REMOTE_ENCODED,
+ IAXC_VIDEO_PREF_SEND_DISABLE, IAXC_VIDEO_PREF_RECV_RGB32,
+ IAXC_VIDEO_PREF_CAPTURE_DISABLE
+*/
+EXPORT unsigned int iaxc_get_video_prefs(void);
+
+/*!
+ Sets the current video preferences.
+ \param prefs The desired preferences to use. They are represented using the IAXC_VIDEO_PREF_{} family of defines.
+
+ Please note that this overwrites all previous preferences. In other
+ words, a read-modify-write must be done to change a single preference.
+
+ \return 0 on success and -1 on error.
+
+ \see IAXC_VIDEO_PREF_RECV_LOCAL_RAW, IAXC_VIDEO_PREF_RECV_LOCAL_ENCODED,
+ IAXC_VIDEO_PREF_RECV_REMOTE_RAW, IAXC_VIDEO_PREF_RECV_REMOTE_ENCODED,
+ IAXC_VIDEO_PREF_SEND_DISABLE, IAXC_VIDEO_PREF_RECV_RGB32,
+ IAXC_VIDEO_PREF_CAPTURE_DISABLE
+ */
+EXPORT int iaxc_set_video_prefs(unsigned int prefs);
+
+/*!
+ Returns the video format settings
+ \param preferred Receives the single preferred video format
+ \param allowed Receives the mask of the allowed video formats
+
+ \see IAXC_FORMAT_JPEG, IAXC_FORMAT_PNG, IAXC_FORMAT_H261, IAXC_FORMAT_H263,
+ IAXC_FORMAT_H263_PLUS, IAXC_FORMAT_H264, IAXC_FORMAT_MPEG4,
+ IAXC_FORMAT_THEORA, IAXC_FORMAT_MAX_VIDEO
+*/
+EXPORT void iaxc_video_format_get_cap(int *preferred, int *allowed);
+
+/*!
+ Sets the video format capabilities
+ \param preferred The single preferred video format
+ \param allowed The mask of the allowed video formats
+
+ \see IAXC_FORMAT_JPEG, IAXC_FORMAT_PNG, IAXC_FORMAT_H261, IAXC_FORMAT_H263,
+ IAXC_FORMAT_H263_PLUS, IAXC_FORMAT_H264, IAXC_FORMAT_MPEG4,
+ IAXC_FORMAT_THEORA, IAXC_FORMAT_MAX_VIDEO
+*/
+EXPORT void iaxc_video_format_set_cap(int preferred, int allowed);
+
+/*!
+ Sets the allowed/preferred video formats
+ \param preferred The single preferred video format
+ \param allowed The mask of the allowed video formats
+ \param framerate The video frame rate in fps.
+ \param bitrate The video bitrate in bps.
+ \param width The width of the video.
+ \param height The height of the video.
+ \param fs The video fragment size.
+
+ \see IAXC_FORMAT_JPEG, IAXC_FORMAT_PNG, IAXC_FORMAT_H261, IAXC_FORMAT_H263,
+ IAXC_FORMAT_H263_PLUS, IAXC_FORMAT_H264, IAXC_FORMAT_MPEG4,
+ IAXC_FORMAT_THEORA, IAXC_FORMAT_MAX_VIDEO
+*/
+EXPORT void iaxc_video_format_set(int preferred, int allowed, int framerate, int bitrate, int width, int height, int fs);
+
+/*!
+ Change video params for the current call on the fly
+ This will destroy the existing encoder and create a new one
+ use negative values for parameters that should not change
+ \param framerate The video frame rate in fps.
+ \param bitrate The video bitrate in bps.
+ \param width The width of the video.
+ \param height The height of the video.
+ \param fs The video fragment size.
+*/
+EXPORT void iaxc_video_params_change(int framerate, int bitrate, int width, int height, int fs);
+
+/*! Set holding frame to be used in some kind of video calls */
+EXPORT int iaxc_set_holding_frame(char *);
+
+/*!
+ Helper function to control use of jitter buffer for video events
+
+ \todo make this a video pref, perhaps?
+*/
+
+EXPORT int iaxc_video_bypass_jitter(int);
+
+/*!
+ Returns 1 if the default camera is working; 0 otherwise
+ */
+EXPORT int iaxc_is_camera_working();
+
+/*!
+ Converts a YUV420 image to RGB32
+ \param width The width of the image
+ \param height The height of the image
+ \param src The buffer containing the source image
+ \param dest The buffer to write the converted image to. The buffer should be \a width * height * 4 bytes in size.
+
+ Converts the image based on the forumulas found at
+ http://en.wikipedia.org/wiki/YUV
+*/
+EXPORT void iaxc_YUV420_to_RGB32(int width, int height, const char *src, char *dest);
+
+/*
+ * Test mode functionality
+ * In test mode, iaxclient will do the following:
+ * - skip audio and video hardware initialization
+ * - wait for outgoing media to be provided by the main application
+ * - return incoming media to the calling application if required, via callbacks
+ * - not generate any meaningful statistics
+ * Test mode is designed to be used without a GUI, and with multiple instances of iaxclient
+ * running on the same machine. However, some applications might actually benefit from having
+ * this level of control.
+ * iaxc_set_test_mode() should be called before iaxc_initialize()
+ */
+EXPORT void iaxc_set_test_mode(int);
+
+/*!
+ \brief Sends compressed audio data to the currently selected call.
+ \param data compressed audio data
+ \param size Size of the compressed audio data in bytes
+ \param samples The number of (uncompressed) samples represented by the compressed audio data. We normally use 20ms packets at a sampling rate of 8000Hz, so this would be 160.
+
+ \note Data must be in the audio format that was negotiated for the current call
+ otherwise bad magic may occur on the recieving side.
+*/
+EXPORT int iaxc_push_audio(void *data, unsigned int size, unsigned int samples);
+
+/*!
+ \brief Sends compressed video data to the currently selected call.
+ \param data compressed video data
+ \param size Size of the compressed video data in bytes
+ \param fragment If true, split video frames larger than the current fragsize into multiple fragments, otherwise send the data as jumbo frames.
+
+ \note Data must be in the video format that was negotiated for the current call
+ otherwise bad magic may occur on the recieving side.
+*/
+EXPORT int iaxc_push_video(void *data, unsigned int size, int fragment);
+
+/*!
+ Sets the IAX debug set to \a enable.
+ \param enable If non-zero enable iax protocol debugging
+*/
+EXPORT void iaxc_debug_iax_set(int enable);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Protocols/IAX/m_iax.h b/Protocols/IAX/m_iax.h new file mode 100644 index 0000000..37c46ea --- /dev/null +++ b/Protocols/IAX/m_iax.h @@ -0,0 +1,27 @@ +/*
+Copyright (C) 2009 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+
+#ifndef __M_IAX_H__
+# define __M_IAX_H__
+
+
+
+
+#endif // __M_IAX_H__
diff --git a/Protocols/IAX/options.cpp b/Protocols/IAX/options.cpp new file mode 100644 index 0000000..6fe3edd --- /dev/null +++ b/Protocols/IAX/options.cpp @@ -0,0 +1,96 @@ +/*
+Copyright (C) 2008 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+
+#include "commons.h"
+
+#include "options.h"
+
+
+
+// Prototypes /////////////////////////////////////////////////////////////////////////////////////
+
+HANDLE hOptHook = NULL;
+
+Options opts;
+
+
+static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+
+
+static OptPageControl optionsControls[] = {
+ {0}
+};
+
+static UINT optionsExpertControls[] = {
+ {0}
+};
+
+
+// Functions //////////////////////////////////////////////////////////////////////////////////////
+
+
+int InitOptionsCallback(WPARAM wParam,LPARAM lParam)
+{
+/*
+ OPTIONSDIALOGPAGE odp;
+
+ ZeroMemory(&odp,sizeof(odp));
+ odp.cbSize=sizeof(odp);
+ odp.position=0;
+ odp.hInstance=hInst;
+ odp.ptszGroup = TranslateT("Message Sessions");
+ odp.ptszTitle = TranslateT("Emoticons");
+ odp.pfnDlgProc = OptionsDlgProc;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ odp.expertOnlyControls = optionsExpertControls;
+ odp.nExpertOnlyControls = MAX_REGS(optionsExpertControls);
+ CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+*/
+ return 0;
+}
+
+
+void InitOptions()
+{
+ LoadOptions();
+
+ hOptHook = HookEvent(ME_OPT_INITIALISE, InitOptionsCallback);
+}
+
+
+void DeInitOptions()
+{
+ UnhookEvent(hOptHook);
+}
+
+
+void LoadOptions()
+{
+ LoadOpts(optionsControls, MAX_REGS(optionsControls), MODULE_NAME);
+
+}
+
+static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ return SaveOptsDlgProc(optionsControls, MAX_REGS(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+}
+
+
diff --git a/Protocols/IAX/options.h b/Protocols/IAX/options.h new file mode 100644 index 0000000..7b2616c --- /dev/null +++ b/Protocols/IAX/options.h @@ -0,0 +1,47 @@ +/*
+Copyright (C) 2008 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+
+#ifndef __OPTIONS_H__
+# define __OPTIONS_H__
+
+
+#include <windows.h>
+
+
+struct Options {
+};
+
+extern Options opts;
+
+
+// Initializations needed by options
+void InitOptions();
+
+// Deinitializations needed by options
+void DeInitOptions();
+
+
+// Loads the options from DB
+// It don't need to be called, except in some rare cases
+void LoadOptions();
+
+
+
+#endif // __OPTIONS_H__
diff --git a/Protocols/IAX/resource.h b/Protocols/IAX/resource.h new file mode 100644 index 0000000..5e72d46 --- /dev/null +++ b/Protocols/IAX/resource.h @@ -0,0 +1,32 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by resource.rc
+//
+#define IDD_OPTIONS 119
+#define IDD_OPTIONS_OLD 120
+#define IDD_EMOTICON_SELECTION 126
+#define IDC_INPUT_TOO 1060
+#define IDC_IGNORE_UPPERCASE 1065
+#define IDC_AUTO_USER 1066
+#define IDC_USE_DEFAULT_PACK 1066
+#define IDC_PACK 1075
+#define IDC_GETMORE 1076
+#define IDC_EMOTICONS 1080
+#define IDC_ONLY_ISOLATED 1086
+#define IDC_ONLY_ISOLATED2 1087
+#define IDC_CUSTOM_SMILEYS 1087
+#define IDC_VIDEO 1088
+#define IDC_STATIC -1
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NO_MFC 1
+#define _APS_3D_CONTROLS 1
+#define _APS_NEXT_RESOURCE_VALUE 128
+#define _APS_NEXT_COMMAND_VALUE 40005
+#define _APS_NEXT_CONTROL_VALUE 1087
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/Protocols/IAX/resource.rc b/Protocols/IAX/resource.rc new file mode 100644 index 0000000..1ec4ab6 --- /dev/null +++ b/Protocols/IAX/resource.rc @@ -0,0 +1,130 @@ +//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "resource.h"
+#include "winresrc.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_EMOTICON_SELECTION DIALOGEX 0, 0, 188, 90
+STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_BORDER
+EXSTYLE WS_EX_NOPARENTNOTIFY
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+END
+
+IDD_OPTIONS DIALOGEX 0, 0, 293, 247
+STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg"
+BEGIN
+ LISTBOX IDC_PACK,7,2,277,148,LBS_OWNERDRAWVARIABLE |
+ LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Embed videos",IDC_VIDEO,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,7,159,277,10
+ CONTROL "Enable custom smileys",IDC_CUSTOM_SMILEYS,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,171,277,10
+ CONTROL "Replace emoticons in text input area too",IDC_INPUT_TOO,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,183,277,10
+ CONTROL "Use default emoticon pack for unknown protocols",
+ IDC_USE_DEFAULT_PACK,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,7,195,277,10
+ CONTROL "Only replace emoticons surrounded by spaces",
+ IDC_ONLY_ISOLATED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+ 7,207,277,10
+ CONTROL "Download more emoticon packs",IDC_GETMORE,"Hyperlink",
+ WS_TABSTOP | 0x1,7,231,277,12
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO MOVEABLE PURE
+BEGIN
+ IDD_OPTIONS, DIALOG
+ BEGIN
+ LEFTMARGIN, 1
+ TOPMARGIN, 1
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // Neutral resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (Canada) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE MOVEABLE PURE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE MOVEABLE PURE
+BEGIN
+ "#include ""resource.h""\r\n"
+ "#include ""winresrc.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE MOVEABLE PURE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (Canada) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/Protocols/IAX/sdk/m_folders.h b/Protocols/IAX/sdk/m_folders.h new file mode 100644 index 0000000..c232410 --- /dev/null +++ b/Protocols/IAX/sdk/m_folders.h @@ -0,0 +1,205 @@ +/*
+Custom profile folders plugin for Miranda IM
+
+Copyright © 2005 Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef M_CUSTOM_FOLDERS_H
+#define M_CUSTOM_FOLDERS_H
+
+#define FOLDERS_API 501 //dunno why it's here but it is :)
+
+#define PROFILE_PATH "%profile_path%"
+#define CURRENT_PROFILE "%current_profile%"
+#define MIRANDA_PATH "%miranda_path%"
+#define PLUGINS_PATH "%miranda_path%" "\\plugins"
+
+#define TO_WIDE(x) L ## x
+
+#define PROFILE_PATHW L"%profile_path%"
+#define CURRENT_PROFILEW L"%current_profile%"
+#define MIRANDA_PATHW L"%miranda_path%"
+
+#define FOLDER_AVATARS PROFILE_PATH "\\" CURRENT_PROFILE "\\avatars"
+#define FOLDER_VCARDS PROFILE_PATH "\\" CURRENT_PROFILE "\\vcards"
+#define FOLDER_LOGS PROFILE_PATH "\\" CURRENT_PROFILE "\\logs"
+#define FOLDER_RECEIVED_FILES PROFILE_PATH "\\" CURRENT_PROFILE "\\received files"
+#define FOLDER_DOCS MIRANDA_PATH "\\" "docs"
+
+#define FOLDER_CONFIG PLUGINS_PATH "\\" "config"
+
+#define FOLDER_SCRIPTS MIRANDA_PATH "\\" "scripts"
+
+#define FOLDER_UPDATES MIRANDA_PATH "\\" "updates"
+
+#define FOLDER_CUSTOMIZE MIRANDA_PATH "\\" "customize"
+#define FOLDER_CUSTOMIZE_SOUNDS FOLDER_CUSTOMIZE "\\sounds"
+#define FOLDER_CUSTOMIZE_ICONS FOLDER_CUSTOMIZE "\\icons"
+#define FOLDER_CUSTOMIZE_SMILEYS FOLDER_CUSTOMIZE "\\smileys"
+#define FOLDER_CUSTOMIZE_SKINS FOLDER_CUSTOMIZE "\\skins"
+#define FOLDER_CUSTOMIZE_THEMES FOLDER_CUSTOMIZE "\\themes"
+
+
+#define FOLDERS_NAME_MAX_SIZE 64 //maximum name and section size
+
+#define FF_UNICODE 0x00000001
+
+typedef struct{
+ int cbSize; //size of struct
+ char szSection[FOLDERS_NAME_MAX_SIZE]; //section name, if it doesn't exist it will be created otherwise it will just add this entry to it
+ char szName[FOLDERS_NAME_MAX_SIZE]; //entry name - will be shown in options
+ union{
+ const char *szFormat; //default string format. Fallback string in case there's no entry in the database for this folder. This should be the initial value for the path, users will be able to change it later.
+ const wchar_t *szFormatW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
+ const TCHAR *szFormatT;
+ };
+ DWORD flags; //FF_* flags
+} FOLDERSDATA;
+
+/*Folders/Register/Path service
+ wParam - not used, must be 0
+ lParam - (LPARAM) (const FOLDERDATA *) - Data structure filled with
+ the necessary information.
+ Returns a handle to the registered path or 0 on error.
+ You need to use this to call the other services.
+*/
+#define MS_FOLDERS_REGISTER_PATH "Folders/Register/Path"
+
+/*Folders/Get/PathSize service
+ wParam - (WPARAM) (int) - handle to registered path
+ lParam - (LPARAM) (int *) - pointer to the variable that receives the size of the path
+ string (not including the null character). Depending on the flags set when creating the path
+ it will either call strlen() or wcslen() to get the length of the string.
+ Returns the size of the buffer.
+*/
+#define MS_FOLDERS_GET_SIZE "Folders/Get/PathSize"
+
+typedef struct{
+ int cbSize;
+ int nMaxPathSize; //maximum size of buffer. This represents the number of characters that can be copied to it (so for unicode strings you don't send the number of bytes but the length of the string).
+ union{
+ char *szPath; //pointer to the buffer that receives the path without the last "\\"
+ wchar_t *szPathW; //unicode version of the buffer.
+ TCHAR *szPathT;
+ };
+} FOLDERSGETDATA;
+
+/*Folders/Get/Path service
+ wParam - (WPARAM) (int) - handle to registered path
+ lParam - (LPARAM) (FOLDERSGETDATA *) pointer to a FOLDERSGETDATA that has all the relevant fields filled.
+ Should return 0 on success, or nonzero otherwise.
+*/
+#define MS_FOLDERS_GET_PATH "Folders/Get/Path"
+
+typedef struct{
+ int cbSize;
+ union{
+ char **szPath; //address of a string variable (char *) or (wchar_t*) where the path should be stored (the last \ won't be copied).
+ wchar_t **szPathW; //unicode version of string.
+ TCHAR **szPathT;
+ };
+} FOLDERSGETALLOCDATA;
+
+/*Folders/GetRelativePath/Alloc service
+ wParam - (WPARAM) (int) - Handle to registered path
+ lParam - (LPARAM) (FOLDERSALLOCDATA *) data
+ This service is the same as MS_FOLDERS_GET_PATH with the difference that this service
+ allocates the needed space for the buffer. It uses miranda's memory functions for that and you need
+ to use those to free the resulting buffer.
+ Should return 0 on success, or nonzero otherwise. Currently it only returns 0.
+*/
+#define MS_FOLDERS_GET_PATH_ALLOC "Folders/Get/Path/Alloc"
+
+
+/*Folders/On/Path/Changed
+ wParam - (WPARAM) 0
+ lParam - (LPARAM) 0
+ Triggered when the folders change, you should reget the paths you registered.
+*/
+#define ME_FOLDERS_PATH_CHANGED "Folders/On/Path/Changed"
+
+#ifndef FOLDERS_NO_HELPER_FUNCTIONS
+//#include "../../../include/newpluginapi.h"
+
+__inline static int FoldersRegisterCustomPath(const char *section, const char *name, const char *defaultPath)
+{
+ FOLDERSDATA fd = {0};
+ if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 1;
+ fd.cbSize = sizeof(FOLDERSDATA);
+ strncpy(fd.szSection, section, FOLDERS_NAME_MAX_SIZE);
+ fd.szSection[FOLDERS_NAME_MAX_SIZE - 1] = '\0';
+ strncpy(fd.szName, name, FOLDERS_NAME_MAX_SIZE);
+ fd.szName[FOLDERS_NAME_MAX_SIZE - 1] = '\0';
+ fd.szFormat = defaultPath;
+ return CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd);
+}
+
+__inline static int FoldersRegisterCustomPathW(const char *section, const char *name, const wchar_t *defaultPathW)
+{
+ FOLDERSDATA fd = {0};
+ if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 1;
+ fd.cbSize = sizeof(FOLDERSDATA);
+ strncpy(fd.szSection, section, FOLDERS_NAME_MAX_SIZE);
+ fd.szSection[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; //make sure it's NULL terminated
+ strncpy(fd.szName, name, FOLDERS_NAME_MAX_SIZE);
+ fd.szName[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; //make sure it's NULL terminated
+ fd.szFormatW = defaultPathW;
+ fd.flags = FF_UNICODE;
+ return CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd);
+}
+
+__inline static int FoldersGetCustomPath(HANDLE hFolderEntry, char *path, const int size, char *notFound)
+{
+ FOLDERSGETDATA fgd = {0};
+ fgd.cbSize = sizeof(FOLDERSGETDATA);
+ fgd.nMaxPathSize = size;
+ fgd.szPath = path;
+ int res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ if (res)
+ {
+ strncpy(path, notFound, size);
+ path[size - 1] = '\0'; //make sure it's NULL terminated
+ }
+ return res;
+}
+
+__inline static int FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *pathW, const int count, wchar_t *notFoundW)
+{
+ FOLDERSGETDATA fgd = {0};
+ fgd.cbSize = sizeof(FOLDERSGETDATA);
+ fgd.nMaxPathSize = count;
+ fgd.szPathW = pathW;
+ int res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ if (res)
+ {
+ wcsncpy(pathW, notFoundW, count);
+ pathW[count - 1] = '\0';
+ }
+ return res;
+}
+
+# ifdef _UNICODE
+# define FoldersGetCustomPathT FoldersGetCustomPathW
+# define FoldersRegisterCustomPathT FoldersRegisterCustomPathW
+#else
+# define FoldersGetCustomPathT FoldersGetCustomPath
+# define FoldersRegisterCustomPathT FoldersRegisterCustomPath
+#endif
+
+#endif
+
+#endif //M_CUSTOM_FOLDERS_H
\ No newline at end of file diff --git a/Protocols/IAX/sdk/m_updater.h b/Protocols/IAX/sdk/m_updater.h new file mode 100644 index 0000000..371b743 --- /dev/null +++ b/Protocols/IAX/sdk/m_updater.h @@ -0,0 +1,146 @@ +#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/Protocols/IAX/sdk/m_variables.h b/Protocols/IAX/sdk/m_variables.h new file mode 100644 index 0000000..3f13c96 --- /dev/null +++ b/Protocols/IAX/sdk/m_variables.h @@ -0,0 +1,718 @@ +/*
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef __M_VARS
+#define __M_VARS
+
+#if !defined(_TCHAR_DEFINED)
+#include <tchar.h>
+#endif
+
+#ifndef VARIABLES_NOHELPER
+#include <m_button.h>
+#endif
+
+// --------------------------------------------------------------------------
+// Memory management
+// --------------------------------------------------------------------------
+
+// Release memory that was allocated by the Variables plugin, e.g. returned
+// strings.
+
+#define MS_VARS_FREEMEMORY "Vars/FreeMemory"
+
+// Parameters:
+// ------------------------
+// wParam = (WPARAM)(void *)pntr
+// Pointer to memory that was allocated by the Variables plugin (e.g. a
+// returned string) (can be NULL).
+// lParam = 0
+
+// Return Value:
+// ------------------------
+// Does return 0 on success, nozero otherwise.
+
+// Note: Do only use this service to free memory that was *explicitliy*
+// stated that it should be free with this service.
+
+
+
+#define MS_VARS_GET_MMI "Vars/GetMMI"
+
+// Get Variable's RTL/CRT function poiners to malloc(), free() and
+// realloc().
+
+// Parameters:
+// ------------------------
+// wParam = 0
+// lParam = (LPARAM) &MM_INTERFACE
+// Pointer to a memory manager interface struct (see m_system.h).
+
+// Return Value:
+// ------------------------
+// Returns 0 on success, nozero otherwise
+
+// Note: Works exactly the same as the MS_SYSTEM_GET_MMI service
+// service of m_system.h.
+
+// Helper function for easy using:
+#ifndef VARIABLES_NOHELPER
+__inline static void variables_free(void *pntr) {
+
+ CallService(MS_VARS_FREEMEMORY, (WPARAM)pntr, 0);
+}
+#endif
+
+
+
+// --------------------------------------------------------------------------
+// String formatting
+// --------------------------------------------------------------------------
+
+#define MS_VARS_FORMATSTRING "Vars/FormatString"
+
+// This service can be used to parse tokens in a text. The tokens will be
+// replaced by their resolved values. A token can either be a field or a
+// function. A field takes no arguments and is represented between
+// %-characters, e.g. "%winampsong%". A function can take any number of
+// arguments and is represented by a ? or !-character followed by the name
+// of the function and a list of arguments, e.g. "?add(1,2)".
+
+// Parameters:
+// ------------------------
+// wParam = (WPARAM)(FORMATINFO *)&fi
+// See below.
+// lParam = 0
+
+// Return Value:
+// ------------------------
+// Returns a pointer to the resolved string or NULL in case of an error.
+
+// Note: The returned pointer needs to be freed using MS_VARS_FREEMEMORY.
+
+typedef struct {
+ int cbSize; // Set this to sizeof(FORMATINFO).
+ int flags; // Flags to use (see FIF_* below).
+ union {
+ char *szFormat; // Text in which the tokens will be replaced (can't be
+ // NULL).
+ WCHAR *wszFormat;
+ TCHAR *tszFormat;
+ };
+ union {
+ char *szExtraText; // Extra, context-specific string (can be NULL) ->
+ // The field "extratext" will be replaced by this
+ // string. (Previously szSource).
+ WCHAR *wszExtraText;
+ TCHAR *tszExtraText;
+ };
+ HANDLE hContact; // Handle to contact (can be NULL) -> The field "subject"
+ // represents this contact.
+ int pCount; // (output) Number of succesful parsed tokens, needs to be set
+ // to 0 before the call
+ int eCount; // (output) Number of failed tokens, needs to be set to 0
+ // before the call
+ union {
+ char **szaTemporaryVars; // Temporary variables valid only in the duration of the format call
+ TCHAR **tszaTemporaryVars; // By pos: [i] is var name, [i + 1] is var value
+ WCHAR **wszaTemporaryVars;
+ };
+ int cbTemporaryVarsSize; // Number of elements in szaTemporaryVars array
+
+} FORMATINFO;
+
+#define FORMATINFOV2_SIZE 28
+
+// Possible flags:
+#define FIF_UNICODE 0x01 // Expects and returns unicode text (WCHAR*).
+
+#if defined(UNICODE) || defined(_UNICODE)
+#define FIF_TCHAR FIF_UNICODE // Strings in structure are TCHAR*.
+#else
+#define FIF_TCHAR 0
+#endif
+
+// Helper functions for easy using:
+
+// Helper #1: variables_parse
+// ------------------------
+// The returned string needs to be freed using MS_VARS_FREEMEMORY.
+
+#ifndef VARIABLES_NOHELPER
+__inline static TCHAR *variables_parse(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact) {
+
+ FORMATINFO fi;
+
+ ZeroMemory(&fi, sizeof(fi));
+ fi.cbSize = sizeof(fi);
+ fi.tszFormat = tszFormat;
+ fi.tszExtraText = tszExtraText;
+ fi.hContact = hContact;
+ fi.flags = FIF_TCHAR;
+
+ return (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+}
+#endif
+
+__inline static TCHAR *variables_parse_ex(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact,
+ TCHAR **tszaTemporaryVars, int cbTemporaryVarsSize) {
+
+ FORMATINFO fi;
+
+ ZeroMemory(&fi, sizeof(fi));
+ fi.cbSize = sizeof(fi);
+ fi.tszFormat = tszFormat;
+ fi.tszExtraText = tszExtraText;
+ fi.hContact = hContact;
+ fi.flags = FIF_TCHAR;
+ fi.tszaTemporaryVars = tszaTemporaryVars;
+ fi.cbTemporaryVarsSize = cbTemporaryVarsSize;
+
+ return (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+}
+// Helper #2: variables_parsedup
+// ------------------------
+// Returns a _strdup()'ed copy of the unparsed string when Variables is not
+// installed, returns a strdup()'ed copy of the parsed result otherwise.
+
+// Note: The returned pointer needs to be released using your own free().
+
+#ifndef VARIABLES_NOHELPER
+__inline static TCHAR *variables_parsedup(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact) {
+
+ if (ServiceExists(MS_VARS_FORMATSTRING)) {
+ FORMATINFO fi;
+ TCHAR *tszParsed, *tszResult;
+
+ ZeroMemory(&fi, sizeof(fi));
+ fi.cbSize = sizeof(fi);
+ fi.tszFormat = tszFormat;
+ fi.tszExtraText = tszExtraText;
+ fi.hContact = hContact;
+ fi.flags |= FIF_TCHAR;
+ tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+ if (tszParsed) {
+ tszResult = _tcsdup(tszParsed);
+ CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0);
+ return tszResult;
+ }
+ }
+ return tszFormat?_tcsdup(tszFormat):tszFormat;
+}
+
+__inline static TCHAR *variables_parsedup_ex(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact,
+ TCHAR **tszaTemporaryVars, int cbTemporaryVarsSize) {
+
+ if (ServiceExists(MS_VARS_FORMATSTRING)) {
+ FORMATINFO fi;
+ TCHAR *tszParsed, *tszResult;
+
+ ZeroMemory(&fi, sizeof(fi));
+ fi.cbSize = sizeof(fi);
+ fi.tszFormat = tszFormat;
+ fi.tszExtraText = tszExtraText;
+ fi.hContact = hContact;
+ fi.flags |= FIF_TCHAR;
+ fi.tszaTemporaryVars = tszaTemporaryVars;
+ fi.cbTemporaryVarsSize = cbTemporaryVarsSize;
+ tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+ if (tszParsed) {
+ tszResult = _tcsdup(tszParsed);
+ CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0);
+ return tszResult;
+ }
+ }
+ return tszFormat?_tcsdup(tszFormat):tszFormat;
+}
+#endif
+
+
+
+// --------------------------------------------------------------------------
+// Register tokens
+// --------------------------------------------------------------------------
+
+// Plugins can define tokens which will be parsed by the Variables plugin.
+
+#define MS_VARS_REGISTERTOKEN "Vars/RegisterToken"
+
+// With this service you can define your own token. The newly added tokens
+// using this service are taken into account on every call to
+// MS_VARS_FORMATSTRING.
+
+// Parameters:
+// ------------------------
+// wParam = 0
+// lParam = (LPARAM)(TOKENREGISTER*)&tr
+// See below.
+
+// Return Value:
+// ------------------------
+// Returns 0 on success, nonzero otherwise. Existing tokens will be
+// 'overwritten' if registered twice.
+
+// Needed for szService and parseFunction:
+typedef struct {
+ int cbSize; // You need to check if this is >=sizeof(ARGUMENTSINFO)
+ // (already filled in).
+ FORMATINFO *fi; // Arguments passed to MS_VARS_FORMATSTRING.
+ unsigned int argc; // Number of elements in the argv array.
+ union {
+ char **argv; // Argv[0] will be the token name, the following elements
+ // are the additional arguments.
+ WCHAR **wargv; // If the registered token was registered as a unicode
+ // token, wargv should be accessed.
+ TCHAR **targv;
+ };
+ int flags; // (output) You can set flags here (initially 0), use the
+ // AIF_* flags (see below).
+} ARGUMENTSINFO;
+
+// Available flags for ARGUMENTSINFO:
+// Set the flags of the ARGUMENTSINFO struct to any of these to influence
+// further parsing.
+#define AIF_DONTPARSE 0x01 // Don't parse the result of this function,
+ // usually the result of a token is parsed
+ // again, if the `?` is used as a function
+ // character.
+#define AIF_FALSE 0x02 // The function returned logical false.
+
+// Definition of parse/cleanup functions:
+typedef char* (*VARPARSEFUNCA)(ARGUMENTSINFO *ai);
+typedef WCHAR* (*VARPARSEFUNCW)(ARGUMENTSINFO *ai);
+typedef void (*VARCLEANUPFUNCA)(char *szReturn);
+typedef void (*VARCLEANUPFUNCW)(WCHAR *wszReturn);
+
+#if defined(UNICODE) || defined(_UNICODE)
+#define VARPARSEFUNC VARPARSEFUNCW
+#define VARCLEANUPFUNC VARCLEANUPFUNCW
+#else
+#define VARPARSEFUNC VARPARSEFUNCA
+#define VARCLEANUPFUNC VARCLEANUPFUNCA
+#endif
+
+typedef struct {
+ int cbSize; // Set this to sizeof(TOKENREGISTER).
+ union {
+ char *szTokenString; // Name of the new token to be created, without %,
+ // ?, ! etc. signs (can't be NULL).
+ WCHAR *wszTokenString;
+ TCHAR *tszTokenString;
+ };
+ union {
+ char *szService; // Name of a service that is used to request the
+ // token's value, if no service is used, a function
+ // and TRF_PARSEFUNC must be used.
+ VARPARSEFUNCA parseFunction; // See above, use with TRF_PARSEFUNC.
+ VARPARSEFUNCW parseFunctionW;
+ VARPARSEFUNC parseFunctionT;
+ };
+ union {
+ char *szCleanupService; // Name of a service to be called when the
+ // memory allocated in szService can be freed
+ // (only used when flag VRF_CLEANUP is set,
+ // else set this to NULL).
+ VARCLEANUPFUNCA cleanupFunction; // See above, use with TRF_CLEANUPFUNC.
+ VARCLEANUPFUNCW cleanupFunctionW;
+ VARCLEANUPFUNC cleanupFunctionT;
+ };
+ char *szHelpText; // Help info shown in help dialog (can be NULL). Has to
+ // be in the following format:
+ // "subject\targuments\tdescription"
+ // (Example: "math\t(x, y ,...)\tx + y + ..."), or:
+ // "subject\tdescription"
+ // (Example: "miranda\tPath to the Miranda-IM
+ // executable").
+ // Note: subject and description are translated by
+ // Variables.
+ int memType; // Describes which method Varibale's plugin needs to use to
+ // free the returned buffer, use one of the VR_MEM_* values
+ // (see below). Only valid if the flag VRF_FREEMEM is set,
+ // use TR_MEM_OWNER otherwise).
+ int flags; // Flags to use (see below), one of TRF_* (see below).
+} TOKENREGISTER;
+
+// Available Memory Storage Types:
+// These values describe which method Variables Plugin will use to free the
+// buffer returned by the parse function or service
+#define TR_MEM_VARIABLES 1 // Memory is allocated using the functions
+ // retrieved by MS_VARS_GET_MMI.
+#define TR_MEM_MIRANDA 2 // Memory is allocated using Miranda's Memory
+ // Manager Interface (using the functions
+ // returned by MS_SYSTEM_GET_MMI), if
+ // VRF_FREEMEM is set, the memory will be
+ // freed by Variables.
+#define TR_MEM_OWNER 3 // Memory is owned by the calling plugin
+ // (can't be freed by Variables Plugin
+ // automatically). This should be used if
+ // VRF_FREEMEM is not specified in the flags.
+
+// Available Flags for TOKENREGISTER:
+#define TRF_FREEMEM 0x01 // Variables Plugin will automatically free the
+ // pointer returned by the parse function or
+ // service (which method it will us is
+ // specified in memType -> see above).
+#define TRF_CLEANUP 0x02 // Call cleanup service or function, notifying
+ // that the returned buffer can be freed.
+ // Normally you should use either TRF_FREEMEM
+ // or TRF_CLEANUP.
+#define TRF_PARSEFUNC 0x40 // parseFunction will be used instead of a
+ // service.
+#define TRF_CLEANUPFUNC 0x80 // cleanupFunction will be used instead of a
+ // service.
+#define TRF_USEFUNCS TRF_PARSEFUNC|TRF_CLEANUPFUNC
+#define TRF_UNPARSEDARGS 0x04 // Provide the arguments for the parse
+ // function in their raw (unparsed) form.
+ // By default, arguments are parsed before
+ // presenting them to the parse function.
+#define TRF_FIELD 0x08 // The token can be used as a %field%.
+#define TRF_FUNCTION 0x10 // The token can be used as a ?function().
+ // Normally you should use either TRF_FIELD or
+ // TRF_FUNCTION.
+#define TRF_UNICODE 0x20 // Strings in structure are unicode (WCHAR*).
+ // In this case, the strings pointing to the
+ // arguments in the ARGUMENTS struct are
+ // unicode also. The returned buffer is
+ // expected to be unicode also, and the
+ // unicode parse and cleanup functions are
+ // called.
+
+#if defined(UNICODE) || defined(_UNICODE)
+#define TRF_TCHAR TRF_UNICODE // Strings in structure are TCHAR*.
+#else
+#define TRF_TCHAR 0
+#endif
+
+// Deprecated:
+#define TRF_CALLSVC TRF_CLEANUP
+
+// Callback Service (szService) / parseFunction:
+// ------------------------
+// Service that is called automatically by the Variable's Plugin to resolve a
+// registered variable.
+
+// Parameters:
+// wParam = 0
+// lParam = (LPARAM)(ARGUMENTSINFO *)&ai
+// see above
+
+// Return Value:
+// Needs to return the pointer to a dynamically allocacated string or NULL.
+// A return value of NULL is regarded as an error (eCount will be increaded).
+// Flags in the ARGUMENTSINFO struct can be set (see above).
+
+// Callback Service (szCallbackService) / cleanupFunction:
+// ------------------------
+// This service is called when the memory that was allocated by the parse
+// function or service can be freed. Note: It will only be called when the
+// flag VRF_CLEANUP of TOKENREGISTER is set.
+
+// Parameters:
+// wParam = 0
+// lParam = (LPARAM)(char *)&res
+// Result from parse function or service (pointer to a string).
+
+// Return Value:
+// Should return 0 on success.
+
+
+
+// --------------------------------------------------------------------------
+// Show the help dialog
+// --------------------------------------------------------------------------
+
+// Plugins can invoke Variables' help dialog which can be used for easy input
+// by users.
+
+#define MS_VARS_SHOWHELPEX "Vars/ShowHelpEx"
+
+// This service can be used to open the help dialog of Variables. This dialog
+// provides easy input for the user and/or information about the available
+// tokens.
+
+// Parameters:
+// ------------------------
+// wParam = (WPARAM)(HWND)hwndParent
+// lParam = (LPARAM)(VARHELPINFO)&vhi
+// See below.
+
+// Return Value:
+// ------------------------
+// Returns 0 on succes, any other value on error.
+
+typedef struct {
+ int cbSize; // Set to sizeof(VARHELPINFO).
+ FORMATINFO *fi; // Used for both input and output. If this pointer is not
+ // NULL, the information is used as the initial values for
+ // the dialog.
+ HWND hwndCtrl; // Used for both input and output. The window text of this
+ // window will be read and used as the initial input of the
+ // input dialog. If the user presses the OK button the window
+ // text of this window will be set to the text of the input
+ // field and a EN_CHANGE message via WM_COMMAND is send to
+ // this window. (Can be NULL).
+ char *szSubjectDesc; // The description of the %subject% token will be set
+ // to this text, if not NULL. This is translated
+ // automatically.
+ char *szExtraTextDesc; // The description of the %extratext% token will be
+ // set to this text, if not NULL. This is translated
+ // automatically.
+ int flags; // Flags, see below.
+} VARHELPINFO;
+
+
+// Flags for VARHELPINFO
+#define VHF_TOKENS 0x00000001 // Create a dialog with the list of
+ // tokens
+#define VHF_INPUT 0x00000002 // Create a dialog with an input
+ // field (this contains the list of
+ // tokens as well).
+#define VHF_SUBJECT 0x00000004 // Create a dialog to select a
+ // contact for the %subject% token.
+#define VHF_EXTRATEXT 0x00000008 // Create a dialog to enter a text
+ // for the %extratext% token.
+#define VHF_HELP 0x00000010 // Create a dialog with help info.
+#define VHF_HIDESUBJECTTOKEN 0x00000020 // Hide the %subject% token in the
+ // list of tokens.
+#define VHF_HIDEEXTRATEXTTOKEN 0x00000040 // Hide the %extratext% token in
+ // the list of tokens.
+#define VHF_DONTFILLSTRUCT 0x00000080 // Don't fill the struct with the
+ // new information if OK is pressed
+#define VHF_FULLFILLSTRUCT 0x00000100 // Fill all members of the struct
+ // when OK is pressed. By default
+ // only szFormat is set. With this
+ // flag on, hContact and
+ // szExtraText are also set.
+#define VHF_SETLASTSUBJECT 0x00000200 // Set the last contact that was
+ // used in the %subject% dialog in
+ // case fi.hContact is NULL.
+
+// Predefined flags
+#define VHF_FULLDLG VHF_INPUT|VHF_SUBJECT|VHF_EXTRATEXT|VHF_HELP
+#define VHF_SIMPLEDLG VHF_INPUT|VHF_HELP
+#define VHF_NOINPUTDLG VHF_TOKENS|VHF_HELP
+
+// If the service fills information in the struct for szFormat or szExtraText,
+// these members must be free'd using the free function of Variables.
+// If wParam==NULL, the dialog is created modeless. Only one dialog can be
+// shown at the time.
+// If both hwndCtrl and fi are NULL, the user input will not be retrievable.
+// In this case, the dialog is created with only a "Close" button, instead of
+// the "OK" and "Cancel" buttons.
+// In case of modeless dialog and fi != NULL, please make sure this pointer
+// stays valid while the dialog is open.
+
+// Helper function for easy use in standard case:
+#ifndef VARIABLES_NOHELPER
+__inline static int variables_showhelp(HWND hwndDlg, UINT uIDEdit, int flags, char *szSubjectDesc, char *szExtraDesc) {
+
+ VARHELPINFO vhi;
+
+ ZeroMemory(&vhi, sizeof(VARHELPINFO));
+ vhi.cbSize = sizeof(VARHELPINFO);
+ if (flags == 0) {
+ flags = VHF_SIMPLEDLG;
+ }
+ vhi.flags = flags;
+ vhi.hwndCtrl = GetDlgItem(hwndDlg, uIDEdit);
+ vhi.szSubjectDesc = szSubjectDesc;
+ vhi.szExtraTextDesc = szExtraDesc;
+
+ return CallService(MS_VARS_SHOWHELPEX, (WPARAM)hwndDlg, (LPARAM)&vhi);
+}
+#endif
+
+
+#define MS_VARS_GETSKINITEM "Vars/GetSkinItem"
+
+// This service can be used to get the icon you can use for example on the
+// Variables help button in your options screen. You can also get the tooltip
+// text to use with such a button. If icon library is available the icon will
+// be retrieved from icon library manager, otherwise the default is returned.
+
+// Parameters:
+// ------------------------
+// wParam = (WPARAM)0
+// lParam = (LPARAM)VSI_* (see below)
+
+// Return Value:
+// ------------------------
+// Depends on the information to retrieve (see below).
+
+// VSI_ constants
+#define VSI_HELPICON 1 // Can be used on the button accessing the
+ // Variables help dialog. Returns (HICON)hIcon on
+ // success or NULL on failure;
+#define VSI_HELPTIPTEXT 2 // Returns the tooltip text you can use for the
+ // help button. Returns (char *)szTipText, a
+ // static, translated buffer containing the help
+ // text or NULL on error.
+
+// Helper to set the icon on a button accessing the help dialog.
+// Preferably a 16x14 MButtonClass control, but it works on a standard
+// button control as well. If no icon is availble (because of old version of
+// Variables) the string "V" is shown on the button. If Variables is not
+// available, the button will be hidden.
+#ifndef VARIABLES_NOHELPER
+__inline static int variables_skin_helpbutton(HWND hwndDlg, UINT uIDButton) {
+
+ int res;
+ HICON hIcon;
+ TCHAR tszClass[32];
+
+ hIcon = NULL;
+ res = 0;
+ if (ServiceExists(MS_VARS_GETSKINITEM)) {
+ hIcon = (HICON)CallService(MS_VARS_GETSKINITEM, 0, (LPARAM)VSI_HELPICON);
+ }
+ GetClassName(GetDlgItem(hwndDlg, uIDButton), tszClass, sizeof(tszClass));
+ if (!_tcscmp(tszClass, _T("Button"))) {
+ if (hIcon != NULL) {
+ SetWindowLong(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE, GetWindowLong(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE)|BS_ICON);
+ SendMessage(GetDlgItem(hwndDlg, uIDButton), BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon);
+ }
+ else {
+ SetWindowLong(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE, GetWindowLong(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE)&~BS_ICON);
+ SetDlgItemText(hwndDlg, uIDButton, _T("V"));
+ }
+ }
+ else if (!_tcscmp(tszClass, MIRANDABUTTONCLASS)) {
+ if (hIcon != NULL) {
+ char *szTipInfo;
+
+ SendMessage(GetDlgItem(hwndDlg, uIDButton), BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon);
+ if (ServiceExists(MS_VARS_GETSKINITEM)) {
+ szTipInfo = (char *)CallService(MS_VARS_GETSKINITEM, 0, (LPARAM)VSI_HELPTIPTEXT);
+ }
+ if (szTipInfo == NULL) {
+ szTipInfo = Translate("Open String Formatting Help");
+ }
+ SendMessage(GetDlgItem(hwndDlg, uIDButton), BUTTONADDTOOLTIP, (WPARAM)szTipInfo, 0);
+ SendDlgItemMessage(hwndDlg, uIDButton, BUTTONSETASFLATBTN, 0, 0);
+ }
+ else {
+ SetDlgItemText(hwndDlg, uIDButton, _T("V"));
+ }
+ }
+ else {
+ res = -1;
+ }
+ ShowWindow(GetDlgItem(hwndDlg, uIDButton), ServiceExists(MS_VARS_FORMATSTRING));
+
+ return res;
+}
+#endif
+
+
+#define MS_VARS_SHOWHELP "Vars/ShowHelp"
+
+// WARNING: This service is obsolete, please use MS_VARS_SHOWHELPEX
+
+// Shows a help dialog where all possible tokens are displayed. The tokens
+// are explained on the dialog, too. The user can edit the initial string and
+// insert as many tokens as he likes.
+
+// Parameters:
+// ------------------------
+// wParam = (HWND)hwndEdit
+// Handle to an edit control in which the modified string
+// should be inserted (When the user clicks OK in the dialog the edited
+// string will be set to hwndEdit) (can be NULL).
+// lParam = (char *)pszInitialString
+// String that the user is provided with initially when
+// the dialog gets opened (If this is NULL then the current text in the
+// hwndEdit edit control will be used) (can be NULL).
+
+// Return Value:
+// ------------------------
+// Returns the handle to the help dialog (HWND).
+
+// Note: Only one help dialog can be opened at a time. When the dialog gets
+// closed an EN_CHANGE of the edit controll will be triggered because the
+// contents were updated. (Only when user selected OK).
+
+// Example:
+// CallService(MS_VARS_SHOWHELP, (WPARAM)hwndEdit, (LPARAM)"some initial text");
+
+// --------------------------------------------------------------------------
+// Retrieve a contact's HANDLE given a string
+// --------------------------------------------------------------------------
+
+#define MS_VARS_GETCONTACTFROMSTRING "Vars/GetContactFromString"
+
+// Searching for contacts in the database. You can find contacts in db by
+// searching for their name, e.g first name.
+
+// Parameters:
+// ------------------------
+// wParam = (WPARAM)(CONTACTSINFO *)&ci
+// See below.
+// lParam = 0
+
+// Return Value:
+// ------------------------
+// Returns number of contacts found matching the given string representation.
+// The hContacts array of CONTACTSINFO struct contains these hContacts after
+// the call.
+
+// Note: The hContacts array needs to be freed after use using
+// MS_VARS_FREEMEMORY.
+
+typedef struct {
+ int cbSize; // Set this to sizeof(CONTACTSINFO).
+ union {
+ char *szContact; // String to search for, e.g. last name (can't be NULL).
+ WCHAR *wszContact;
+ TCHAR *tszContact;
+ };
+ HANDLE *hContacts; // (output) Array of contacts found.
+ DWORD flags; // Contact details that will be matched with the search
+ // string (flags can be combined).
+} CONTACTSINFO;
+
+// Possible flags:
+#define CI_PROTOID 0x00000001 // The contact in the string is encoded
+ // in the format <PROTOID:UNIQUEID>, e.g.
+ // <ICQ:12345678>.
+#define CI_NICK 0x00000002 // Search nick names.
+#define CI_LISTNAME 0x00000004 // Search custom names shown in contact
+ // list.
+#define CI_FIRSTNAME 0x00000008 // Search contact's first names (contact
+ // details).
+#define CI_LASTNAME 0x00000010 // Search contact's last names (contact
+ // details).
+#define CI_EMAIL 0x00000020 // Search contact's email adresses
+ // (contact details).
+#define CI_UNIQUEID 0x00000040 // Search unique ids of the contac, e.g.
+ // UIN.
+#define CI_CNFINFO 0x40000000 // Searches one of the CNF_* flags (set
+ // flags to CI_CNFINFO|CNF_X), only one
+ // CNF_ type possible
+#define CI_UNICODE 0x80000000 // tszContact is a unicode string
+ // (WCHAR*).
+
+#if defined(UNICODE) || defined(_UNICODE)
+#define CI_TCHAR CI_UNICODE // Strings in structure are TCHAR*.
+#else
+#define CI_TCHAR 0
+#endif
+
+
+
+#endif //__M_VARS
|