diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2014-06-12 17:49:53 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2014-06-12 17:49:53 +0000 |
commit | 7de38a08b97e0554e318b8c25806cef5d47259e6 (patch) | |
tree | 2400708e16b437245da88623046e96fb833e23b9 /protocols | |
parent | 1b88f240b94fc04aa11ef352b720fda741c0ebc6 (diff) |
headers of not adopted plugins moved to !Deprecated
git-svn-id: http://svn.miranda-ng.org/main/trunk@9438 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/IRCG/src/irc.h | 10 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.cpp | 8 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 209 | ||||
-rw-r--r-- | protocols/IRCG/src/options.cpp | 1 | ||||
-rw-r--r-- | protocols/IRCG/src/scripting.cpp | 53 | ||||
-rw-r--r-- | protocols/IRCG/src/services.cpp | 340 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icqoscar.h | 1 | ||||
-rw-r--r-- | protocols/SkypeClassic/SkypeClassic_12.vcxproj | 48 | ||||
-rw-r--r-- | protocols/SkypeClassic/SkypeClassic_12.vcxproj.filters | 10 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/contacts.cpp | 404 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skype.cpp | 2385 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/voiceservice.cpp | 154 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/voiceservice.h | 18 |
13 files changed, 1687 insertions, 1954 deletions
diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h index 27ef8bc750..89f2edd82d 100644 --- a/protocols/IRCG/src/irc.h +++ b/protocols/IRCG/src/irc.h @@ -73,8 +73,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_string.h"
#include "win2k.h"
-#include "m_ircscript.h"
-
#include "resource.h"
#define IRC_QUICKCONNECT "/QuickConnectMenu"
@@ -459,10 +457,6 @@ struct CIrcProto : public PROTO<CIrcProto> INT_PTR __cdecl Scripting_InsertGuiIn(WPARAM wParam,LPARAM lParam);
INT_PTR __cdecl Scripting_InsertGuiOut(WPARAM wParam,LPARAM lParam);
INT_PTR __cdecl Scripting_GetIrcData(WPARAM wparam, LPARAM lparam);
- BOOL Scripting_TriggerMSPRawIn(char ** pszRaw);
- BOOL Scripting_TriggerMSPRawOut(char ** pszRaw);
- BOOL Scripting_TriggerMSPGuiIn(WPARAM * wparam, GCEVENT *gce);
- BOOL Scripting_TriggerMSPGuiOut(GCHOOK * gch);
// services.cpp
void ConnectToServer(void);
@@ -654,10 +648,6 @@ HICON LoadIconEx(int iIndex, bool big = false); HANDLE GetIconHandle(int iconId);
void ReleaseIconEx(HICON hIcon);
-// services.cpp
-
-extern BOOL bChatInstalled, m_bMbotInstalled;
-
//tools.cpp
int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string);
char* __stdcall IrcLoadFile(TCHAR * szPath);
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 369d2ff6ed..0e1fc195b6 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -276,13 +276,13 @@ void CIrcProto::Notify(const CIrcMessage* pmsg) int CIrcProto::NLSend(const unsigned char* buf, int cbBuf)
{
- if (m_bMbotInstalled && m_scriptingEnabled) {
+ if (m_scriptingEnabled) {
int iVal = NULL;
char * pszTemp = 0;
pszTemp = (char*)mir_alloc(lstrlenA((const char *)buf) + 1);
lstrcpynA(pszTemp, (const char *)buf, lstrlenA((const char *)buf) + 1);
- if (Scripting_TriggerMSPRawOut(&pszTemp) && pszTemp) {
+ if (pszTemp) {
if (con)
iVal = Netlib_Send(con, (const char*)pszTemp, lstrlenA(pszTemp), MSG_DUMPASTEXT);
}
@@ -413,10 +413,10 @@ void CIrcProto::DoReceive() // process single message by monitor objects
if (*pStart) {
- if (m_bMbotInstalled && m_scriptingEnabled) {
+ if (m_scriptingEnabled) {
char* pszTemp = mir_strdup(pStart);
- if (Scripting_TriggerMSPRawIn(&pszTemp) && pszTemp) {
+ if (pszTemp) {
char* p1 = pszTemp;
// replace end-of-line with NULLs
while (*p1 != '\0') {
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index e6a93a0d42..a212afdfdb 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -26,18 +26,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static volatile LONG g_msgid = 1;
-static int CompareSessions( const CDccSession* p1, const CDccSession* p2 )
+static int CompareSessions(const CDccSession* p1, const CDccSession* p2)
{
- return INT_PTR( p1->di->hContact ) - INT_PTR( p2->di->hContact );
+ return INT_PTR(p1->di->hContact) - INT_PTR(p2->di->hContact);
}
CIrcProto::CIrcProto(const char* szModuleName, const TCHAR* tszUserName) :
- PROTO<CIrcProto>(szModuleName, tszUserName),
- m_dcc_chats( 10, CompareSessions ),
- m_dcc_xfers( 10, CompareSessions ),
- m_ignoreItems( 10 ),
- vUserhostReasons( 10 ),
- vWhoInProgress( 10 )
+PROTO<CIrcProto>(szModuleName, tszUserName),
+m_dcc_chats(10, CompareSessions),
+m_dcc_xfers(10, CompareSessions),
+m_ignoreItems(10),
+vUserhostReasons(10),
+vWhoInProgress(10)
{
InitializeCriticalSection(&cs);
InitializeCriticalSection(&m_gchook);
@@ -77,69 +77,69 @@ CIrcProto::CIrcProto(const char* szModuleName, const TCHAR* tszUserName) : CList_SetAllOffline(true);
IRC_MAP_ENTRY("PING", PING)
- IRC_MAP_ENTRY("JOIN", JOIN)
- IRC_MAP_ENTRY("QUIT", QUIT)
- IRC_MAP_ENTRY("KICK", KICK)
- IRC_MAP_ENTRY("MODE", MODE)
- IRC_MAP_ENTRY("NICK", NICK)
- IRC_MAP_ENTRY("PART", PART)
- IRC_MAP_ENTRY("PRIVMSG", PRIVMSG)
- IRC_MAP_ENTRY("TOPIC", TOPIC)
- IRC_MAP_ENTRY("NOTICE", NOTICE)
- IRC_MAP_ENTRY("PING", PINGPONG)
- IRC_MAP_ENTRY("PONG", PINGPONG)
- IRC_MAP_ENTRY("INVITE", INVITE)
- IRC_MAP_ENTRY("ERROR", ERROR)
- IRC_MAP_ENTRY("001", WELCOME)
- IRC_MAP_ENTRY("002", YOURHOST)
- IRC_MAP_ENTRY("005", SUPPORT)
- IRC_MAP_ENTRY("223", WHOIS_OTHER) //CodePage info
- IRC_MAP_ENTRY("254", NOOFCHANNELS)
- IRC_MAP_ENTRY("263", TRYAGAIN)
- IRC_MAP_ENTRY("264", WHOIS_OTHER) //Encryption info (SSL connect)
- IRC_MAP_ENTRY("301", WHOIS_AWAY)
- IRC_MAP_ENTRY("302", USERHOST_REPLY)
- IRC_MAP_ENTRY("305", BACKFROMAWAY)
- IRC_MAP_ENTRY("306", SETAWAY)
- IRC_MAP_ENTRY("307", WHOIS_AUTH)
- IRC_MAP_ENTRY("310", WHOIS_OTHER)
- IRC_MAP_ENTRY("311", WHOIS_NAME)
- IRC_MAP_ENTRY("312", WHOIS_SERVER)
- IRC_MAP_ENTRY("313", WHOIS_OTHER)
- IRC_MAP_ENTRY("315", WHO_END)
- IRC_MAP_ENTRY("317", WHOIS_IDLE)
- IRC_MAP_ENTRY("318", WHOIS_END)
- IRC_MAP_ENTRY("319", WHOIS_CHANNELS)
- IRC_MAP_ENTRY("320", WHOIS_AUTH)
- IRC_MAP_ENTRY("321", LISTSTART)
- IRC_MAP_ENTRY("322", LIST)
- IRC_MAP_ENTRY("323", LISTEND)
- IRC_MAP_ENTRY("324", MODEQUERY)
- IRC_MAP_ENTRY("330", WHOIS_AUTH)
- IRC_MAP_ENTRY("332", INITIALTOPIC)
- IRC_MAP_ENTRY("333", INITIALTOPICNAME)
- IRC_MAP_ENTRY("352", WHO_REPLY)
- IRC_MAP_ENTRY("353", NAMES)
- IRC_MAP_ENTRY("366", ENDNAMES)
- IRC_MAP_ENTRY("367", BANLIST)
- IRC_MAP_ENTRY("368", BANLISTEND)
- IRC_MAP_ENTRY("346", BANLIST)
- IRC_MAP_ENTRY("347", BANLISTEND)
- IRC_MAP_ENTRY("348", BANLIST)
- IRC_MAP_ENTRY("349", BANLISTEND)
- IRC_MAP_ENTRY("371", WHOIS_OTHER)
- IRC_MAP_ENTRY("376", ENDMOTD)
- IRC_MAP_ENTRY("401", WHOIS_NO_USER)
- IRC_MAP_ENTRY("403", JOINERROR)
- IRC_MAP_ENTRY("416", WHOTOOLONG)
- IRC_MAP_ENTRY("421", UNKNOWN)
- IRC_MAP_ENTRY("422", ENDMOTD)
- IRC_MAP_ENTRY("433", NICK_ERR)
- IRC_MAP_ENTRY("471", JOINERROR)
- IRC_MAP_ENTRY("473", JOINERROR)
- IRC_MAP_ENTRY("474", JOINERROR)
- IRC_MAP_ENTRY("475", JOINERROR)
- IRC_MAP_ENTRY("671", WHOIS_OTHER) //Encryption info (SSL connect)
+ IRC_MAP_ENTRY("JOIN", JOIN)
+ IRC_MAP_ENTRY("QUIT", QUIT)
+ IRC_MAP_ENTRY("KICK", KICK)
+ IRC_MAP_ENTRY("MODE", MODE)
+ IRC_MAP_ENTRY("NICK", NICK)
+ IRC_MAP_ENTRY("PART", PART)
+ IRC_MAP_ENTRY("PRIVMSG", PRIVMSG)
+ IRC_MAP_ENTRY("TOPIC", TOPIC)
+ IRC_MAP_ENTRY("NOTICE", NOTICE)
+ IRC_MAP_ENTRY("PING", PINGPONG)
+ IRC_MAP_ENTRY("PONG", PINGPONG)
+ IRC_MAP_ENTRY("INVITE", INVITE)
+ IRC_MAP_ENTRY("ERROR", ERROR)
+ IRC_MAP_ENTRY("001", WELCOME)
+ IRC_MAP_ENTRY("002", YOURHOST)
+ IRC_MAP_ENTRY("005", SUPPORT)
+ IRC_MAP_ENTRY("223", WHOIS_OTHER) //CodePage info
+ IRC_MAP_ENTRY("254", NOOFCHANNELS)
+ IRC_MAP_ENTRY("263", TRYAGAIN)
+ IRC_MAP_ENTRY("264", WHOIS_OTHER) //Encryption info (SSL connect)
+ IRC_MAP_ENTRY("301", WHOIS_AWAY)
+ IRC_MAP_ENTRY("302", USERHOST_REPLY)
+ IRC_MAP_ENTRY("305", BACKFROMAWAY)
+ IRC_MAP_ENTRY("306", SETAWAY)
+ IRC_MAP_ENTRY("307", WHOIS_AUTH)
+ IRC_MAP_ENTRY("310", WHOIS_OTHER)
+ IRC_MAP_ENTRY("311", WHOIS_NAME)
+ IRC_MAP_ENTRY("312", WHOIS_SERVER)
+ IRC_MAP_ENTRY("313", WHOIS_OTHER)
+ IRC_MAP_ENTRY("315", WHO_END)
+ IRC_MAP_ENTRY("317", WHOIS_IDLE)
+ IRC_MAP_ENTRY("318", WHOIS_END)
+ IRC_MAP_ENTRY("319", WHOIS_CHANNELS)
+ IRC_MAP_ENTRY("320", WHOIS_AUTH)
+ IRC_MAP_ENTRY("321", LISTSTART)
+ IRC_MAP_ENTRY("322", LIST)
+ IRC_MAP_ENTRY("323", LISTEND)
+ IRC_MAP_ENTRY("324", MODEQUERY)
+ IRC_MAP_ENTRY("330", WHOIS_AUTH)
+ IRC_MAP_ENTRY("332", INITIALTOPIC)
+ IRC_MAP_ENTRY("333", INITIALTOPICNAME)
+ IRC_MAP_ENTRY("352", WHO_REPLY)
+ IRC_MAP_ENTRY("353", NAMES)
+ IRC_MAP_ENTRY("366", ENDNAMES)
+ IRC_MAP_ENTRY("367", BANLIST)
+ IRC_MAP_ENTRY("368", BANLISTEND)
+ IRC_MAP_ENTRY("346", BANLIST)
+ IRC_MAP_ENTRY("347", BANLISTEND)
+ IRC_MAP_ENTRY("348", BANLIST)
+ IRC_MAP_ENTRY("349", BANLISTEND)
+ IRC_MAP_ENTRY("371", WHOIS_OTHER)
+ IRC_MAP_ENTRY("376", ENDMOTD)
+ IRC_MAP_ENTRY("401", WHOIS_NO_USER)
+ IRC_MAP_ENTRY("403", JOINERROR)
+ IRC_MAP_ENTRY("416", WHOTOOLONG)
+ IRC_MAP_ENTRY("421", UNKNOWN)
+ IRC_MAP_ENTRY("422", ENDMOTD)
+ IRC_MAP_ENTRY("433", NICK_ERR)
+ IRC_MAP_ENTRY("471", JOINERROR)
+ IRC_MAP_ENTRY("473", JOINERROR)
+ IRC_MAP_ENTRY("474", JOINERROR)
+ IRC_MAP_ENTRY("475", JOINERROR)
+ IRC_MAP_ENTRY("671", WHOIS_OTHER) //Encryption info (SSL connect)
}
CIrcProto::~CIrcProto()
@@ -170,7 +170,7 @@ CIrcProto::~CIrcProto() ////////////////////////////////////////////////////////////////////////////////////////
// OnModulesLoaded - performs hook registration
-static COLORREF crCols[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+static COLORREF crCols[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
static int sttCheckPerform(const char *szSetting, LPARAM lParam)
{
@@ -207,42 +207,30 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) nlu.ptszDescriptiveName = name;
hNetlibDCC = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
- if (ServiceExists("MBot/GetFcnTable")) {
- CallService(MS_MBOT_REGISTERIRC, 0, (LPARAM)m_szModuleName);
- m_bMbotInstalled = TRUE;
- }
-
- if (ServiceExists(MS_GC_REGISTER)) {
- GCREGISTER gcr = { sizeof(GCREGISTER) };
- gcr.dwFlags = GC_CHANMGR | GC_BOLD | GC_ITALICS | GC_UNDERLINE | GC_COLOR | GC_BKGCOLOR;
- gcr.nColors = 16;
- gcr.pColors = colors;
- gcr.ptszDispName = m_tszUserName;
- gcr.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr);
-
- HookProtoEvent(ME_GC_EVENT, &CIrcProto::GCEventHook);
- HookProtoEvent(ME_GC_BUILDMENU, &CIrcProto::GCMenuHook);
-
- GCSESSION gcw = { sizeof(GCSESSION) };
- gcw.iType = GCW_SERVER;
- gcw.ptszID = SERVERWINDOW;
- gcw.pszModule = m_szModuleName;
- gcw.ptszName = NEWTSTR_ALLOCA((TCHAR*)_A2T(m_network));
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
-
- GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- if (m_useServer && !m_hideServerWindow)
- CallChatEvent(WINDOW_VISIBLE, (LPARAM)&gce);
- else
- CallChatEvent(WINDOW_HIDDEN, (LPARAM)&gce);
- bChatInstalled = TRUE;
- }
- else {
- if (IDYES == MessageBox(0, TranslateT("The IRC protocol depends on another plugin called 'Chat'\n\nDo you want to download it from the Miranda NG web site now?"), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION))
- CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://miranda-ng.org/");
- }
+ GCREGISTER gcr = { sizeof(GCREGISTER) };
+ gcr.dwFlags = GC_CHANMGR | GC_BOLD | GC_ITALICS | GC_UNDERLINE | GC_COLOR | GC_BKGCOLOR;
+ gcr.nColors = 16;
+ gcr.pColors = colors;
+ gcr.ptszDispName = m_tszUserName;
+ gcr.pszModule = m_szModuleName;
+ CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr);
+
+ HookProtoEvent(ME_GC_EVENT, &CIrcProto::GCEventHook);
+ HookProtoEvent(ME_GC_BUILDMENU, &CIrcProto::GCMenuHook);
+
+ GCSESSION gcw = { sizeof(GCSESSION) };
+ gcw.iType = GCW_SERVER;
+ gcw.ptszID = SERVERWINDOW;
+ gcw.pszModule = m_szModuleName;
+ gcw.ptszName = NEWTSTR_ALLOCA((TCHAR*)_A2T(m_network));
+ CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+
+ GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ if (m_useServer && !m_hideServerWindow)
+ CallChatEvent(WINDOW_VISIBLE, (LPARAM)&gce);
+ else
+ CallChatEvent(WINDOW_HIDDEN, (LPARAM)&gce);
TCHAR szTemp[MAX_PATH];
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%miranda_path%%\\Plugins\\%S_perform.ini"), m_szModuleName);
@@ -774,7 +762,7 @@ struct TFakeAckParam {
__inline TFakeAckParam(MCONTACT _hContact, int _msgid) :
hContact(_hContact), msgid(_msgid)
- {}
+ {}
MCONTACT hContact;
int msgid;
@@ -861,9 +849,6 @@ int __cdecl CIrcProto::SetStatus(int iNewStatus) int CIrcProto::SetStatusInternal(int iNewStatus, bool bIsInternal)
{
- if (!bChatInstalled)
- return 0;
-
if (iNewStatus != ID_STATUS_OFFLINE && !m_network[0]) {
if (m_nick[0] && !m_disableDefaultServer) {
CQuickDlg* dlg = new CQuickDlg(this);
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 5ffdac047a..a5805e266f 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -1026,7 +1026,6 @@ void COtherPrefsDlg::OnInitDialog() m_quitMessage.SetText(m_proto->m_quitMessage);
m_perform.SetState(m_proto->m_perform);
m_scripting.SetState(m_proto->m_scriptingEnabled);
- m_scripting.Enable(m_bMbotInstalled);
m_performCombo.Enable(m_proto->m_perform);
m_pertormEdit.Enable(m_proto->m_perform);
m_add.Enable(m_proto->m_perform);
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index 84dfcc8203..484a2b6739 100644 --- a/protocols/IRCG/src/scripting.cpp +++ b/protocols/IRCG/src/scripting.cpp @@ -25,7 +25,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertRawIn(WPARAM, LPARAM lParam) {
char* pszRaw = (char*)lParam;
- if (m_bMbotInstalled && m_scriptingEnabled && pszRaw && IsConnected()) {
+ if (m_scriptingEnabled && pszRaw && IsConnected()) {
TCHAR* p = mir_a2t(pszRaw);
InsertIncomingEvent(p);
mir_free(p);
@@ -38,7 +38,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertRawIn(WPARAM, LPARAM lParam) INT_PTR __cdecl CIrcProto::Scripting_InsertRawOut( WPARAM, LPARAM lParam )
{
char* pszRaw = (char*)lParam;
- if (m_bMbotInstalled && m_scriptingEnabled && pszRaw && IsConnected()) {
+ if (m_scriptingEnabled && pszRaw && IsConnected()) {
String S = pszRaw;
ReplaceString(S, "%", "%%%%");
NLSendNoScript((const unsigned char *)S.c_str(), lstrlenA(S.c_str()));
@@ -75,7 +75,7 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam) {
GCHOOK* gch = (GCHOOK*)lParam;
- if (m_bMbotInstalled && m_scriptingEnabled && gch) {
+ if (m_scriptingEnabled && gch) {
GCHOOK* gchook = new GCHOOK;
gchook->pDest = new GCDEST;
@@ -107,54 +107,9 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam) return 1;
}
-BOOL CIrcProto::Scripting_TriggerMSPRawIn(char** pszRaw)
-{
- int iVal = CallService(MS_MBOT_IRC_RAW_IN, (WPARAM)m_szModuleName, (LPARAM)pszRaw);
- if (iVal == 0)
- return TRUE;
-
- return iVal > 0 ? FALSE : TRUE;
-}
-
-BOOL CIrcProto::Scripting_TriggerMSPRawOut(char ** pszRaw)
-{
- int iVal = CallService(MS_MBOT_IRC_RAW_OUT, (WPARAM)m_szModuleName, (LPARAM)pszRaw);
- if (iVal == 0)
- return TRUE;
-
- return iVal > 0 ? FALSE : TRUE;
-}
-
-BOOL CIrcProto::Scripting_TriggerMSPGuiIn(WPARAM * wparam, GCEVENT *gce)
-{
- WPARAM_GUI_IN wgi = { 0 };
-
- wgi.pszModule = m_szModuleName;
- wgi.wParam = *wparam;
- if (gce->time == 0)
- gce->time = time(0);
-
- int iVal = CallService(MS_MBOT_IRC_GUI_IN, (WPARAM)&wgi, (LPARAM)gce);
- if (iVal == 0) {
- *wparam = wgi.wParam;
- return TRUE;
- }
-
- return iVal > 0 ? FALSE : TRUE;
-}
-
-BOOL CIrcProto::Scripting_TriggerMSPGuiOut(GCHOOK* gch)
-{
- int iVal = CallService(MS_MBOT_IRC_GUI_OUT, (WPARAM)m_szModuleName, (LPARAM)gch);
- if (iVal == 0)
- return TRUE;
-
- return iVal > 0 ? FALSE : TRUE;
-}
-
INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam)
{
- if (m_bMbotInstalled && m_scriptingEnabled && lparam) {
+ if (m_scriptingEnabled && lparam) {
String sString = (char*)lparam, sRequest;
CMString sOutput, sChannel;
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 1b922570d8..c7aa5a6be6 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "irc.h"
-BOOL bChatInstalled = FALSE, m_bMbotInstalled = FALSE;
-
void CIrcProto::InitMainMenus(void)
{
char temp[MAXMODULELABELLENGTH];
@@ -31,58 +29,56 @@ void CIrcProto::InitMainMenus(void) CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = temp;
- if (bChatInstalled) {
- HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName);
- if (hRoot == NULL) {
- // Root popupmenuitem
- mi.ptszName = m_tszUserName;
- mi.position = -1999901010;
- mi.hParentMenu = HGENMENU_ROOT;
- mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- mi.icolibItem = GetIconHandle(IDI_MAIN);
- hRoot = hMenuRoot = Menu_AddProtoMenuItem(&mi);
- }
- else {
- if (hMenuRoot)
- CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0);
- hMenuRoot = NULL;
- }
-
- mi.flags = CMIF_CHILDPOPUP;
- mi.pszName = LPGEN("&Quick connect");
- mi.icolibItem = GetIconHandle(IDI_QUICK);
- strcpy(d, IRC_QUICKCONNECT);
- mi.position = 201001;
- mi.hParentMenu = hRoot;
- hMenuQuick = Menu_AddProtoMenuItem(&mi);
-
- if (m_iStatus != ID_STATUS_OFFLINE) mi.flags |= CMIF_GRAYED;
-
- mi.pszName = LPGEN("&Join channel");
- mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_JOIN);//GetIconHandle(IDI_JOIN);
- strcpy(d, IRC_JOINCHANNEL);
- mi.position = 201002;
- hMenuJoin = Menu_AddProtoMenuItem(&mi);
-
- mi.pszName = LPGEN("&Change your nickname");
- mi.icolibItem = GetIconHandle(IDI_RENAME);
- strcpy(d, IRC_CHANGENICK);
- mi.position = 201003;
- hMenuNick = Menu_AddProtoMenuItem(&mi);
-
- mi.pszName = LPGEN("Show the &list of available channels");
- mi.icolibItem = GetIconHandle(IDI_LIST);
- strcpy(d, IRC_SHOWLIST);
- mi.position = 201004;
- hMenuList = Menu_AddProtoMenuItem(&mi);
-
- if (m_useServer) mi.flags &= ~CMIF_GRAYED;
- mi.pszName = LPGEN("&Show the server window");
- mi.icolibItem = GetIconHandle(IDI_SERVER);
- strcpy(d, IRC_SHOWSERVER);
- mi.position = 201005;
- hMenuServer = Menu_AddProtoMenuItem(&mi);
+ HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName);
+ if (hRoot == NULL) {
+ // Root popupmenuitem
+ mi.ptszName = m_tszUserName;
+ mi.position = -1999901010;
+ mi.hParentMenu = HGENMENU_ROOT;
+ mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
+ mi.icolibItem = GetIconHandle(IDI_MAIN);
+ hRoot = hMenuRoot = Menu_AddProtoMenuItem(&mi);
}
+ else {
+ if (hMenuRoot)
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0);
+ hMenuRoot = NULL;
+ }
+
+ mi.flags = CMIF_CHILDPOPUP;
+ mi.pszName = LPGEN("&Quick connect");
+ mi.icolibItem = GetIconHandle(IDI_QUICK);
+ strcpy(d, IRC_QUICKCONNECT);
+ mi.position = 201001;
+ mi.hParentMenu = hRoot;
+ hMenuQuick = Menu_AddProtoMenuItem(&mi);
+
+ if (m_iStatus != ID_STATUS_OFFLINE) mi.flags |= CMIF_GRAYED;
+
+ mi.pszName = LPGEN("&Join channel");
+ mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_JOIN);//GetIconHandle(IDI_JOIN);
+ strcpy(d, IRC_JOINCHANNEL);
+ mi.position = 201002;
+ hMenuJoin = Menu_AddProtoMenuItem(&mi);
+
+ mi.pszName = LPGEN("&Change your nickname");
+ mi.icolibItem = GetIconHandle(IDI_RENAME);
+ strcpy(d, IRC_CHANGENICK);
+ mi.position = 201003;
+ hMenuNick = Menu_AddProtoMenuItem(&mi);
+
+ mi.pszName = LPGEN("Show the &list of available channels");
+ mi.icolibItem = GetIconHandle(IDI_LIST);
+ strcpy(d, IRC_SHOWLIST);
+ mi.position = 201004;
+ hMenuList = Menu_AddProtoMenuItem(&mi);
+
+ if (m_useServer) mi.flags &= ~CMIF_GRAYED;
+ mi.pszName = LPGEN("&Show the server window");
+ mi.icolibItem = GetIconHandle(IDI_SERVER);
+ strcpy(d, IRC_SHOWSERVER);
+ mi.position = 201005;
+ hMenuServer = Menu_AddProtoMenuItem(&mi);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -97,8 +93,8 @@ static CIrcProto* IrcGetInstanceByHContact(MCONTACT hContact) return NULL;
for (int i = 0; i < g_Instances.getCount(); i++)
- if (!strcmp(szProto, g_Instances[i]->m_szModuleName))
- return g_Instances[i];
+ if (!strcmp(szProto, g_Instances[i]->m_szModuleName))
+ return g_Instances[i];
return NULL;
}
@@ -439,12 +435,12 @@ static void DoChatFormatting(TCHAR* pszText) break;
case 'c':
{
- lstrcpy(InsertThis, _T("\003"));
- iRemoveChars = 2;
+ lstrcpy(InsertThis, _T("\003"));
+ iRemoveChars = 2;
- TCHAR szTemp[3];
- lstrcpyn(szTemp, p1 + 2, 3);
- iFG = _ttoi(szTemp);
+ TCHAR szTemp[3];
+ lstrcpyn(szTemp, p1 + 2, 3);
+ iFG = _ttoi(szTemp);
}
break;
case 'C':
@@ -534,9 +530,9 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) case GC_USER_PRIVMESS:
{
- TCHAR szTemp[4000];
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("/QUERY %s"), gch->ptszUID);
- PostIrcMessageWnd(p1, NULL, szTemp);
+ TCHAR szTemp[4000];
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("/QUERY %s"), gch->ptszUID);
+ PostIrcMessageWnd(p1, NULL, szTemp);
}
break;
@@ -576,29 +572,29 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) PostIrcMessage(_T("/nickserv DROP"));
break;
case 8: // nickserv Identify
- {
- CQuestionDlg* dlg = new CQuestionDlg(this);
- dlg->Show();
- HWND question_hWnd = dlg->GetHwnd();
- HWND hEditCtrl = GetDlgItem(question_hWnd, IDC_EDIT);
- SetDlgItemText(question_hWnd, IDC_CAPTION, TranslateT("Identify nick"));
- SetWindowText(GetDlgItem(question_hWnd, IDC_TEXT), TranslateT("Please enter your password"));
- SetDlgItemText(question_hWnd, IDC_HIDDENEDIT, _T("/nickserv IDENTIFY %question=\"%s\",\"%s\""));
- SetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE,
- (LONG)GetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE) | ES_PASSWORD);
- SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)_T('*'), 0);
- SetFocus(hEditCtrl);
- dlg->Activate();
- }
+ {
+ CQuestionDlg* dlg = new CQuestionDlg(this);
+ dlg->Show();
+ HWND question_hWnd = dlg->GetHwnd();
+ HWND hEditCtrl = GetDlgItem(question_hWnd, IDC_EDIT);
+ SetDlgItemText(question_hWnd, IDC_CAPTION, TranslateT("Identify nick"));
+ SetWindowText(GetDlgItem(question_hWnd, IDC_TEXT), TranslateT("Please enter your password"));
+ SetDlgItemText(question_hWnd, IDC_HIDDENEDIT, _T("/nickserv IDENTIFY %question=\"%s\",\"%s\""));
+ SetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE,
+ (LONG)GetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE) | ES_PASSWORD);
+ SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)_T('*'), 0);
+ SetFocus(hEditCtrl);
+ dlg->Activate();
+ }
break;
case 9: // nickserv remind password
- {
- DBVARIANT dbv;
- if (!getTString("Nick", &dbv)) {
- PostIrcMessage(_T("/nickserv SENDPASS %s"), dbv.ptszVal);
- db_free(&dbv);
- }
+ {
+ DBVARIANT dbv;
+ if (!getTString("Nick", &dbv)) {
+ PostIrcMessage(_T("/nickserv SENDPASS %s"), dbv.ptszVal);
+ db_free(&dbv);
}
+ }
break;
case 10: // nickserv set new password
PostIrcMessage(_T("/nickserv SET PASSWORD %%question=\"%s\",\"%s\""),
@@ -701,12 +697,12 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) case 10:
PostIrcMessage(_T("/WHOIS %s %s"), gch->ptszUID, gch->ptszUID);
break;
- // case 11:
- // DoUserhostWithReason(1, "I", true, "%s", gch->ptszUID );
- // break;
- // case 12:
- // DoUserhostWithReason(1, "J", true, "%s", gch->ptszUID );
- // break;
+ // case 11:
+ // DoUserhostWithReason(1, "I", true, "%s", gch->ptszUID );
+ // break;
+ // case 12:
+ // DoUserhostWithReason(1, "J", true, "%s", gch->ptszUID );
+ // break;
case 13:
PostIrcMessage(_T("/DCC CHAT %s"), gch->ptszUID);
break;
@@ -743,19 +739,19 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) gch->ptszUID, TranslateT("Please enter the channel name to invite to"), TranslateT("Invite to channel"));
break;
case 30:
- {
- PROTOSEARCHRESULT psr = { 0 };
- psr.cbSize = sizeof(psr);
- psr.flags = PSR_TCHAR;
- psr.id = gch->ptszUID;
- psr.nick = gch->ptszUID;
-
- ADDCONTACTSTRUCT acs = { 0 };
- acs.handleType = HANDLE_SEARCHRESULT;
- acs.szProto = m_szModuleName;
- acs.psr = &psr;
- CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
- }
+ {
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
+ psr.id = gch->ptszUID;
+ psr.nick = gch->ptszUID;
+
+ ADDCONTACTSTRUCT acs = { 0 };
+ acs.handleType = HANDLE_SEARCHRESULT;
+ acs.szProto = m_szModuleName;
+ acs.psr = &psr;
+ CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
+ }
break;
case 31: //slap
PostIrcMessageWnd(p1, NULL, CMString(FORMAT, _T("/slap %s"), gch->ptszUID));
@@ -780,74 +776,74 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
static gc_item logItems[] = {
- { LPGENT("&Change your nickname" ), 1, MENU_ITEM, FALSE },
- { LPGENT("Channel &settings" ), 2, MENU_ITEM, FALSE },
- { _T(""), 0, MENU_SEPARATOR, FALSE },
- { LPGENT("NickServ"), 0, MENU_NEWPOPUP, FALSE },
- { LPGENT("Register nick" ), 5, MENU_POPUPITEM, TRUE },
- { LPGENT("Auth nick" ), 6, MENU_POPUPITEM, FALSE },
- { LPGENT("Delete nick" ), 7, MENU_POPUPITEM, FALSE },
- { LPGENT("Identify nick" ), 8, MENU_POPUPITEM, FALSE },
- { LPGENT("Remind password" ), 9, MENU_POPUPITEM, FALSE },
- { LPGENT("Set new password" ), 10, MENU_POPUPITEM, TRUE },
- { LPGENT("Set language" ), 11, MENU_POPUPITEM, FALSE },
- { LPGENT("Set homepage" ), 12, MENU_POPUPITEM, FALSE },
- { LPGENT("Set e-mail" ), 13, MENU_POPUPITEM, FALSE },
- { LPGENT("Set info" ), 14, MENU_POPUPITEM, FALSE },
- { _T("" ), 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Hide e-mail from info" ), 20, MENU_POPUPITEM, FALSE },
- { LPGENT("Show e-mail in info" ), 21, MENU_POPUPITEM, FALSE },
- { _T("" ), 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Set security for nick" ), 22, MENU_POPUPITEM, FALSE },
- { LPGENT("Remove security for nick" ), 23, MENU_POPUPITEM, FALSE },
- { _T("" ), 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Link nick to current" ), 24, MENU_POPUPITEM, FALSE },
- { LPGENT("Unlink nick from current" ), 25, MENU_POPUPITEM, FALSE },
- { LPGENT("Set main nick" ), 26, MENU_POPUPITEM, FALSE },
- { LPGENT("List all your nicks" ), 27, MENU_POPUPITEM, FALSE },
- { LPGENT("List your channels" ), 28, MENU_POPUPITEM, FALSE },
- { _T("" ), 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Kill unauthorized: off" ), 15, MENU_POPUPITEM, FALSE },
- { LPGENT("Kill unauthorized: on" ), 16, MENU_POPUPITEM, FALSE },
- { LPGENT("Kill unauthorized: quick" ), 17, MENU_POPUPITEM, FALSE },
- { _T("" ), 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("Hide nick from list" ), 18, MENU_POPUPITEM, FALSE },
- { LPGENT("Show nick to list" ), 19, MENU_POPUPITEM, FALSE },
- { LPGENT("Show the server &window" ), 4, MENU_ITEM, FALSE },
- { _T(""), 0, MENU_SEPARATOR, FALSE },
- { LPGENT("&Leave the channel" ), 3, MENU_ITEM, FALSE }
-};
-
-static gc_item nickItems[] = {
- { LPGENT("&WhoIs info"), 10, MENU_ITEM, FALSE }, //0
- { LPGENT("&Invite to channel"), 23, MENU_ITEM, FALSE },
- { LPGENT("Send ¬ice"), 22, MENU_ITEM, FALSE },
- { LPGENT("&Slap"), 31, MENU_ITEM, FALSE },
- { LPGENT("Nickserv info"), 32, MENU_ITEM, FALSE },
- { LPGENT("Nickserv kill ghost"), 33, MENU_ITEM, FALSE }, //5
- { LPGENT("&Control"), 0, MENU_NEWPOPUP, FALSE },
- { LPGENT("Give Owner"), 18, MENU_POPUPITEM, FALSE }, //7
- { LPGENT("Take Owner"), 19, MENU_POPUPITEM, FALSE },
- { LPGENT("Give Admin"), 20, MENU_POPUPITEM, FALSE },
- { LPGENT("Take Admin"), 21, MENU_POPUPITEM, FALSE }, //10
- { LPGENT("Give &Op"), 1, MENU_POPUPITEM, FALSE },
- { LPGENT("Take O&p"), 2, MENU_POPUPITEM, FALSE },
- { LPGENT("Give &Halfop"), 16, MENU_POPUPITEM, FALSE },
- { LPGENT("Take H&alfop"), 17, MENU_POPUPITEM, FALSE },
- { LPGENT("Give &Voice"), 3, MENU_POPUPITEM, FALSE }, //15
- { LPGENT("Take V&oice"), 4, MENU_POPUPITEM, FALSE },
- { _T(""), 0, MENU_POPUPSEPARATOR, FALSE },
- { LPGENT("&Kick"), 5, MENU_POPUPITEM, FALSE },
- { LPGENT("Ki&ck (reason)"), 6, MENU_POPUPITEM, FALSE },
- { LPGENT("&Ban"), 7, MENU_POPUPITEM, FALSE }, //20
- { LPGENT("Ban'&n kick"), 8, MENU_POPUPITEM, FALSE },
- { LPGENT("Ban'n kick (&reason)"), 9, MENU_POPUPITEM, FALSE },
- { LPGENT("&Direct Connection"), 0, MENU_NEWPOPUP, FALSE },
- { LPGENT("Request &Chat"), 13, MENU_POPUPITEM, FALSE },
- { LPGENT("Send &File"), 14, MENU_POPUPITEM, FALSE }, //25
- { LPGENT("Add to &ignore list"), 15, MENU_ITEM, FALSE },
- { _T(""), 12, MENU_SEPARATOR, FALSE },
- { LPGENT("&Add User"), 30, MENU_ITEM, FALSE }
+ { LPGENT("&Change your nickname"), 1, MENU_ITEM, FALSE },
+ { LPGENT("Channel &settings"), 2, MENU_ITEM, FALSE },
+ { _T(""), 0, MENU_SEPARATOR, FALSE },
+ { LPGENT("NickServ"), 0, MENU_NEWPOPUP, FALSE },
+ { LPGENT("Register nick"), 5, MENU_POPUPITEM, TRUE },
+ { LPGENT("Auth nick"), 6, MENU_POPUPITEM, FALSE },
+ { LPGENT("Delete nick"), 7, MENU_POPUPITEM, FALSE },
+ { LPGENT("Identify nick"), 8, MENU_POPUPITEM, FALSE },
+ { LPGENT("Remind password"), 9, MENU_POPUPITEM, FALSE },
+ { LPGENT("Set new password"), 10, MENU_POPUPITEM, TRUE },
+ { LPGENT("Set language"), 11, MENU_POPUPITEM, FALSE },
+ { LPGENT("Set homepage"), 12, MENU_POPUPITEM, FALSE },
+ { LPGENT("Set e-mail"), 13, MENU_POPUPITEM, FALSE },
+ { LPGENT("Set info"), 14, MENU_POPUPITEM, FALSE },
+ { _T(""), 0, MENU_POPUPSEPARATOR, FALSE },
+ { LPGENT("Hide e-mail from info"), 20, MENU_POPUPITEM, FALSE },
+ { LPGENT("Show e-mail in info"), 21, MENU_POPUPITEM, FALSE },
+ { _T(""), 0, MENU_POPUPSEPARATOR, FALSE },
+ { LPGENT("Set security for nick"), 22, MENU_POPUPITEM, FALSE },
+ { LPGENT("Remove security for nick"), 23, MENU_POPUPITEM, FALSE },
+ { _T(""), 0, MENU_POPUPSEPARATOR, FALSE },
+ { LPGENT("Link nick to current"), 24, MENU_POPUPITEM, FALSE },
+ { LPGENT("Unlink nick from current"), 25, MENU_POPUPITEM, FALSE },
+ { LPGENT("Set main nick"), 26, MENU_POPUPITEM, FALSE },
+ { LPGENT("List all your nicks"), 27, MENU_POPUPITEM, FALSE },
+ { LPGENT("List your channels"), 28, MENU_POPUPITEM, FALSE },
+ { _T(""), 0, MENU_POPUPSEPARATOR, FALSE },
+ { LPGENT("Kill unauthorized: off"), 15, MENU_POPUPITEM, FALSE },
+ { LPGENT("Kill unauthorized: on"), 16, MENU_POPUPITEM, FALSE },
+ { LPGENT("Kill unauthorized: quick"), 17, MENU_POPUPITEM, FALSE },
+ { _T(""), 0, MENU_POPUPSEPARATOR, FALSE },
+ { LPGENT("Hide nick from list"), 18, MENU_POPUPITEM, FALSE },
+ { LPGENT("Show nick to list"), 19, MENU_POPUPITEM, FALSE },
+ { LPGENT("Show the server &window"), 4, MENU_ITEM, FALSE },
+ { _T(""), 0, MENU_SEPARATOR, FALSE },
+ { LPGENT("&Leave the channel"), 3, MENU_ITEM, FALSE }
+};
+
+static gc_item nickItems[] = {
+ { LPGENT("&WhoIs info"), 10, MENU_ITEM, FALSE }, //0
+ { LPGENT("&Invite to channel"), 23, MENU_ITEM, FALSE },
+ { LPGENT("Send ¬ice"), 22, MENU_ITEM, FALSE },
+ { LPGENT("&Slap"), 31, MENU_ITEM, FALSE },
+ { LPGENT("Nickserv info"), 32, MENU_ITEM, FALSE },
+ { LPGENT("Nickserv kill ghost"), 33, MENU_ITEM, FALSE }, //5
+ { LPGENT("&Control"), 0, MENU_NEWPOPUP, FALSE },
+ { LPGENT("Give Owner"), 18, MENU_POPUPITEM, FALSE }, //7
+ { LPGENT("Take Owner"), 19, MENU_POPUPITEM, FALSE },
+ { LPGENT("Give Admin"), 20, MENU_POPUPITEM, FALSE },
+ { LPGENT("Take Admin"), 21, MENU_POPUPITEM, FALSE }, //10
+ { LPGENT("Give &Op"), 1, MENU_POPUPITEM, FALSE },
+ { LPGENT("Take O&p"), 2, MENU_POPUPITEM, FALSE },
+ { LPGENT("Give &Halfop"), 16, MENU_POPUPITEM, FALSE },
+ { LPGENT("Take H&alfop"), 17, MENU_POPUPITEM, FALSE },
+ { LPGENT("Give &Voice"), 3, MENU_POPUPITEM, FALSE }, //15
+ { LPGENT("Take V&oice"), 4, MENU_POPUPITEM, FALSE },
+ { _T(""), 0, MENU_POPUPSEPARATOR, FALSE },
+ { LPGENT("&Kick"), 5, MENU_POPUPITEM, FALSE },
+ { LPGENT("Ki&ck (reason)"), 6, MENU_POPUPITEM, FALSE },
+ { LPGENT("&Ban"), 7, MENU_POPUPITEM, FALSE }, //20
+ { LPGENT("Ban'&n kick"), 8, MENU_POPUPITEM, FALSE },
+ { LPGENT("Ban'n kick (&reason)"), 9, MENU_POPUPITEM, FALSE },
+ { LPGENT("&Direct Connection"), 0, MENU_NEWPOPUP, FALSE },
+ { LPGENT("Request &Chat"), 13, MENU_POPUPITEM, FALSE },
+ { LPGENT("Send &File"), 14, MENU_POPUPITEM, FALSE }, //25
+ { LPGENT("Add to &ignore list"), 15, MENU_ITEM, FALSE },
+ { _T(""), 12, MENU_SEPARATOR, FALSE },
+ { LPGENT("&Add User"), 30, MENU_ITEM, FALSE }
};
int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
@@ -913,8 +909,8 @@ int __cdecl CIrcProto::OnPreShutdown(WPARAM, LPARAM) EnterCriticalSection(&cs);
if (m_perform && IsConnected())
- if (DoPerform("Event: Disconnect"))
- Sleep(200);
+ if (DoPerform("Event: Disconnect"))
+ Sleep(200);
DisconnectAllDCCSessions(true);
diff --git a/protocols/IcqOscarJ/src/icqoscar.h b/protocols/IcqOscarJ/src/icqoscar.h index eb64c0ab2c..33e9e5cba0 100644 --- a/protocols/IcqOscarJ/src/icqoscar.h +++ b/protocols/IcqOscarJ/src/icqoscar.h @@ -113,7 +113,6 @@ #include "channels.h"
#include "families.h"
#include "m_icq.h"
-#include "m_icqplus.h"
#include "icq_advsearch.h"
#include "log.h"
diff --git a/protocols/SkypeClassic/SkypeClassic_12.vcxproj b/protocols/SkypeClassic/SkypeClassic_12.vcxproj index d05e962c18..b7868c7487 100644 --- a/protocols/SkypeClassic/SkypeClassic_12.vcxproj +++ b/protocols/SkypeClassic/SkypeClassic_12.vcxproj @@ -61,7 +61,6 @@ <ClCompile Include="src\skypesvc.cpp" />
<ClCompile Include="src\utf8.cpp" />
<ClCompile Include="src\util.cpp" />
- <ClCompile Include="src\voiceservice.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\alogon.h" />
@@ -82,7 +81,6 @@ <ClInclude Include="src\utf8.h" />
<ClInclude Include="src\util.h" />
<ClInclude Include="src\version.h" />
- <ClInclude Include="src\voiceservice.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{5F9243AE-C6C9-4F42-B670-67A97767A50B}</ProjectGuid>
@@ -91,27 +89,23 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
@@ -149,14 +143,10 @@ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
<AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PrecompiledHeaderFile>skype.h</PrecompiledHeaderFile>
<FunctionLevelLinking>true</FunctionLevelLinking>
<FloatingPointModel>Fast</FloatingPointModel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
@@ -167,13 +157,12 @@ </ResourceCompile>
<Link>
<AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib;</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
+ <SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -183,14 +172,10 @@ <MinimalRebuild>true</MinimalRebuild>
<ExceptionHandling>false</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
<AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PrecompiledHeaderFile>skype.h</PrecompiledHeaderFile>
<FunctionLevelLinking>true</FunctionLevelLinking>
<FloatingPointModel>Fast</FloatingPointModel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
@@ -201,12 +186,11 @@ </ResourceCompile>
<Link>
<AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib;</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories>
+ <SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -216,16 +200,12 @@ <IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
- <WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>false</ExceptionHandling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <CompileAs>Default</CompileAs>
<AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PrecompiledHeaderFile>skype.h</PrecompiledHeaderFile>
<FloatingPointModel>Fast</FloatingPointModel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@@ -235,13 +215,13 @@ </ResourceCompile>
<Link>
<AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib;</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -251,17 +231,13 @@ <IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
- <WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>false</ExceptionHandling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <CompileAs>Default</CompileAs>
<AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PrecompiledHeaderFile>skype.h</PrecompiledHeaderFile>
<FloatingPointModel>Fast</FloatingPointModel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@@ -271,13 +247,13 @@ </ResourceCompile>
<Link>
<AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib;</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
diff --git a/protocols/SkypeClassic/SkypeClassic_12.vcxproj.filters b/protocols/SkypeClassic/SkypeClassic_12.vcxproj.filters index eec33c3042..2d9d1be44f 100644 --- a/protocols/SkypeClassic/SkypeClassic_12.vcxproj.filters +++ b/protocols/SkypeClassic/SkypeClassic_12.vcxproj.filters @@ -60,9 +60,6 @@ <ClCompile Include="src\util.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\voiceservice.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\alogon.h">
@@ -119,9 +116,6 @@ <ClInclude Include="src\version.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\voiceservice.h">
- <Filter>Header Files</Filter>
- </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\add.ico">
@@ -190,10 +184,10 @@ </ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\Resource.rc">
- <Filter>Source Files</Filter>
+ <Filter>Resource Files</Filter>
</ResourceCompile>
<ResourceCompile Include="res\Version.rc">
- <Filter>Source Files</Filter>
+ <Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/contacts.cpp b/protocols/SkypeClassic/src/contacts.cpp index bfcd4a4319..92b07eaab2 100644 --- a/protocols/SkypeClassic/src/contacts.cpp +++ b/protocols/SkypeClassic/src/contacts.cpp @@ -7,7 +7,6 @@ #include "debug.h"
#include "pthread.h"
#include "gchat.h"
-#include "voiceservice.h"
#pragma warning (push)
#pragma warning (disable: 4100) // unreferenced formal parameter
@@ -28,179 +27,175 @@ static HANDLE hMenuCallItem, hMenuCallHangup, hMenuSkypeOutCallItem, hMenuHoldCa // Seems to be not neccessary
/*
BOOL SupportAlphaIcons(void) {
- HANDLE hMod;
- DLLVERSIONINFO tDVI={0};
- BOOL retval=FALSE;
- FARPROC pDllGetVersion;
-
- if (!(hMod=LoadLibrary("comctl32.dll"))) return FALSE;
- if (pDllGetVersion=GetProcAddress(hMod, "DllGetVersion")) {
- tDVI.cbSize=sizeof(tDVI);
- if (!pDllGetVersion ((DLLVERSIONINFO *)&tDVI)) {
- if (GetDeviceCaps(GetDC(NULL), BITSPIXEL)*GetDeviceCaps(GetDC(NULL), PLANES)>=32 &&
- tDVI.dwMajorVersion>=6)
- retval=TRUE;
- }
- }
- FreeLibrary(hMod);
- return retval;
+HANDLE hMod;
+DLLVERSIONINFO tDVI={0};
+BOOL retval=FALSE;
+FARPROC pDllGetVersion;
+
+if (!(hMod=LoadLibrary("comctl32.dll"))) return FALSE;
+if (pDllGetVersion=GetProcAddress(hMod, "DllGetVersion")) {
+tDVI.cbSize=sizeof(tDVI);
+if (!pDllGetVersion ((DLLVERSIONINFO *)&tDVI)) {
+if (GetDeviceCaps(GetDC(NULL), BITSPIXEL)*GetDeviceCaps(GetDC(NULL), PLANES)>=32 &&
+tDVI.dwMajorVersion>=6)
+retval=TRUE;
+}
+}
+FreeLibrary(hMod);
+return retval;
}
*/
CLISTMENUITEM CallItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALL));
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.ptszName=LPGENT("Call (Skype)");
- mi.pszService=SKYPE_CALL;
-
+ CLISTMENUITEM mi = { 0 };
+
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000005000;
+ mi.flags = CMIF_NOTOFFLINE | CMIF_TCHAR;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CALL));
+ mi.pszContactOwner = SKYPE_PROTONAME;
+ mi.ptszName = LPGENT("Call (Skype)");
+ mi.pszService = SKYPE_CALL;
+
return mi;
}
CLISTMENUITEM SkypeOutCallItem(void) {
- CLISTMENUITEM mi={0};
+ CLISTMENUITEM mi = { 0 };
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_HIDDEN|CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALLSKYPEOUT));
- mi.ptszName=LPGENT("Call using SkypeOut");
- mi.pszService=SKYPEOUT_CALL;
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000005000;
+ mi.flags = CMIF_HIDDEN | CMIF_TCHAR;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CALLSKYPEOUT));
+ mi.ptszName = LPGENT("Call using SkypeOut");
+ mi.pszService = SKYPEOUT_CALL;
return mi;
}
CLISTMENUITEM HupItem(void) {
- CLISTMENUITEM mi={0};
+ CLISTMENUITEM mi = { 0 };
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_HANGUP));
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.ptszName=LPGENT("Hang up call (Skype)");
- mi.pszService=SKYPE_CALLHANGUP;
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000005000;
+ mi.flags = CMIF_NOTOFFLINE | CMIF_TCHAR;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_HANGUP));
+ mi.pszContactOwner = SKYPE_PROTONAME;
+ mi.ptszName = LPGENT("Hang up call (Skype)");
+ mi.pszService = SKYPE_CALLHANGUP;
return mi;
}
CLISTMENUITEM SkypeOutHupItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_HANGUP));
- mi.ptszName=LPGENT("Hang up SkypeOut call");
- mi.pszService=SKYPEOUT_CALL;
+ CLISTMENUITEM mi = { 0 };
+
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000005000;
+ mi.flags = CMIF_TCHAR;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_HANGUP));
+ mi.ptszName = LPGENT("Hang up SkypeOut call");
+ mi.pszService = SKYPEOUT_CALL;
return mi;
}
CLISTMENUITEM HoldCallItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_HIDDEN|CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_HOLD));
- mi.ptszName=LPGENT("Hold call");
- mi.pszService=SKYPE_HOLDCALL;
+ CLISTMENUITEM mi = { 0 };
+
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000005000;
+ mi.flags = CMIF_HIDDEN | CMIF_NOTOFFLINE | CMIF_TCHAR;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_HOLD));
+ mi.ptszName = LPGENT("Hold call");
+ mi.pszService = SKYPE_HOLDCALL;
return mi;
}
CLISTMENUITEM ResumeCallItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_HIDDEN|CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_RESUME));
- mi.ptszName=LPGENT("Resume call");
- mi.pszService=SKYPE_HOLDCALL;
+ CLISTMENUITEM mi = { 0 };
+
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000005000;
+ mi.flags = CMIF_HIDDEN | CMIF_NOTOFFLINE | CMIF_TCHAR;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RESUME));
+ mi.ptszName = LPGENT("Resume call");
+ mi.pszService = SKYPE_HOLDCALL;
return mi;
}
CLISTMENUITEM FileTransferItem(void) {
- CLISTMENUITEM mi={0};
+ CLISTMENUITEM mi = { 0 };
// Stolen from file.c of Miranda core
- mi.cbSize=sizeof(mi);
- mi.position=-2000020000;
- mi.flags=CMIF_HIDDEN|CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadSkinnedIcon(SKINICON_EVENT_FILE);
- mi.ptszName=LPGENT("&File");
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.pszService=SKYPE_SENDFILE;
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000020000;
+ mi.flags = CMIF_HIDDEN | CMIF_NOTOFFLINE | CMIF_TCHAR;
+ mi.hIcon = LoadSkinnedIcon(SKINICON_EVENT_FILE);
+ mi.ptszName = LPGENT("&File");
+ mi.pszContactOwner = SKYPE_PROTONAME;
+ mi.pszService = SKYPE_SENDFILE;
return mi;
}
CLISTMENUITEM ChatInitItem(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000020000;
- mi.flags=CMIF_HIDDEN|CMIF_NOTOFFLINE|CMIF_TCHAR;
- mi.hIcon=LoadIcon( hInst, MAKEINTRESOURCE( IDI_INVITE ));
- mi.ptszName=LPGENT("&Open group chat");
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.pszService=SKYPE_CHATNEW;
+ CLISTMENUITEM mi = { 0 };
+
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000020000;
+ mi.flags = CMIF_HIDDEN | CMIF_NOTOFFLINE | CMIF_TCHAR;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_INVITE));
+ mi.ptszName = LPGENT("&Open group chat");
+ mi.pszContactOwner = SKYPE_PROTONAME;
+ mi.pszService = SKYPE_CHATNEW;
return mi;
}
HANDLE add_contextmenu(MCONTACT hContact) {
CLISTMENUITEM mi;
-
+
UNREFERENCED_PARAMETER(hContact);
- if (!HasVoiceService()) {
- mi=CallItem();
- hMenuCallItem=Menu_AddContactMenuItem(&mi);
- mi=HupItem();
- hMenuCallHangup=Menu_AddContactMenuItem(&mi);
- }
-
- mi=SkypeOutCallItem();
- hMenuSkypeOutCallItem=Menu_AddContactMenuItem(&mi);
+ mi = CallItem();
+ hMenuCallItem = Menu_AddContactMenuItem(&mi);
+ mi = HupItem();
+ hMenuCallHangup = Menu_AddContactMenuItem(&mi);
- if (!HasVoiceService()) {
- mi=HoldCallItem();
- hMenuHoldCallItem=Menu_AddContactMenuItem(&mi);
- }
+ mi = SkypeOutCallItem();
+ hMenuSkypeOutCallItem = Menu_AddContactMenuItem(&mi);
+
+ mi = HoldCallItem();
+ hMenuHoldCallItem = Menu_AddContactMenuItem(&mi);
- // We cannot use flag PF1_FILESEND for sending files, as Skype opens its own
+ // We cannot use flag PF1_FILESEND for sending files, as Skype opens its own
// sendfile-Dialog.
- mi=FileTransferItem();
- hMenuFileTransferItem=Menu_AddContactMenuItem(&mi);
-
- mi=ChatInitItem();
- hMenuChatInitItem=Menu_AddContactMenuItem(&mi);
-
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_IMPORT));
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.ptszName=LPGENT("Import Skype history");
- mi.pszService=SKYPE_IMPORTHISTORY;
+ mi = FileTransferItem();
+ hMenuFileTransferItem = Menu_AddContactMenuItem(&mi);
+
+ mi = ChatInitItem();
+ hMenuChatInitItem = Menu_AddContactMenuItem(&mi);
+
+
+ ZeroMemory(&mi, sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000005000;
+ mi.flags = CMIF_TCHAR;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_IMPORT));
+ mi.pszContactOwner = SKYPE_PROTONAME;
+ mi.ptszName = LPGENT("Import Skype history");
+ mi.pszService = SKYPE_IMPORTHISTORY;
return Menu_AddContactMenuItem(&mi);
}
HANDLE add_mainmenu(void) {
- CLISTMENUITEM mi={0};
-
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=CMIF_TCHAR;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_ADD));
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.ptszName=LPGENT("Add Skype contact");
- mi.pszService=SKYPE_ADDUSER;
+ CLISTMENUITEM mi = { 0 };
+
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000005000;
+ mi.flags = CMIF_TCHAR;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ADD));
+ mi.pszContactOwner = SKYPE_PROTONAME;
+ mi.ptszName = LPGENT("Add Skype contact");
+ mi.pszService = SKYPE_ADDUSER;
return Menu_AddMainMenuItem(&mi);
}
@@ -216,77 +211,76 @@ int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { if (!(szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0))) return 0;
- if (!HasVoiceService()) {
- // Clear hold-Item in case it exists
- mi=HoldCallItem();
- mi.flags|=CMIM_ALL;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem,(LPARAM)&mi);
- }
+ // Clear hold-Item in case it exists
+ mi = HoldCallItem();
+ mi.flags |= CMIM_ALL;
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem, (LPARAM)&mi);
if (!strcmp(szProto, SKYPE_PROTONAME)) {
- if (!HasVoiceService()) {
- if (!db_get((MCONTACT)wParam, SKYPE_PROTONAME, "CallId", &dbv)) {
- if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "OnHold", 0))
- mi=ResumeCallItem(); else mi=HoldCallItem();
- mi.flags=CMIM_ALL;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem,(LPARAM)&mi);
+ if (!db_get((MCONTACT)wParam, SKYPE_PROTONAME, "CallId", &dbv)) {
+ if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "OnHold", 0))
+ mi = ResumeCallItem(); else mi = HoldCallItem();
+ mi.flags = CMIM_ALL;
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem, (LPARAM)&mi);
- callAvailable = FALSE;
- hangupAvailable = TRUE;
+ callAvailable = FALSE;
+ hangupAvailable = TRUE;
- db_free(&dbv);
- } else { callAvailable = TRUE; hangupAvailable = FALSE; }
-
- if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0)!=0) {
- callAvailable = FALSE;
- hangupAvailable = FALSE;
- }
-
- mi = CallItem();
- mi.flags |= CMIM_ALL | (!callAvailable?CMIF_HIDDEN:0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallItem,(LPARAM)&mi);
+ db_free(&dbv);
+ }
+ else { callAvailable = TRUE; hangupAvailable = FALSE; }
- mi = HupItem();
- mi.flags |= CMIM_ALL | (!hangupAvailable?CMIF_HIDDEN:0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallHangup,(LPARAM)&mi);
+ if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0) != 0) {
+ callAvailable = FALSE;
+ hangupAvailable = FALSE;
}
+ mi = CallItem();
+ mi.flags |= CMIM_ALL | (!callAvailable ? CMIF_HIDDEN : 0);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallItem, (LPARAM)&mi);
+
+ mi = HupItem();
+ mi.flags |= CMIM_ALL | (!hangupAvailable ? CMIF_HIDDEN : 0);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallHangup, (LPARAM)&mi);
+
// Clear SkypeOut menu in case it exists
- mi=SkypeOutCallItem();
- mi.flags|=CMIM_ALL;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuSkypeOutCallItem,(LPARAM)&mi);
+ mi = SkypeOutCallItem();
+ mi.flags |= CMIM_ALL;
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuSkypeOutCallItem, (LPARAM)&mi);
// File sending and groupchat-creation works starting with protocol version 5
- if (protocol>=5) {
- mi=FileTransferItem();
- if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0)==0)
- mi.flags ^= CMIF_HIDDEN;
+ if (protocol >= 5) {
+ mi = FileTransferItem();
+ if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
+ mi.flags ^= CMIF_HIDDEN;
mi.flags |= CMIM_FLAGS;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuFileTransferItem,(LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuFileTransferItem, (LPARAM)&mi);
}
- if (protocol>=5 || bIsImoproxy) {
- mi=ChatInitItem();
+ if (protocol >= 5 || bIsImoproxy) {
+ mi = ChatInitItem();
if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0) &&
- db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0)==0)
- mi.flags ^= CMIF_HIDDEN;
+ db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
+ mi.flags ^= CMIF_HIDDEN;
mi.flags |= CMIM_FLAGS;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuChatInitItem,(LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuChatInitItem, (LPARAM)&mi);
}
- } else if (bSkypeOut) {
+ }
+ else if (bSkypeOut) {
if (!db_get((MCONTACT)wParam, SKYPE_PROTONAME, "CallId", &dbv)) {
- mi=SkypeOutHupItem();
+ mi = SkypeOutHupItem();
db_free(&dbv);
- } else {
- mi=SkypeOutCallItem();
- if(!db_get((MCONTACT)wParam,"UserInfo","MyPhone0",&dbv)) {
+ }
+ else {
+ mi = SkypeOutCallItem();
+ if (!db_get((MCONTACT)wParam, "UserInfo", "MyPhone0", &dbv)) {
db_free(&dbv);
- mi.flags=0;
+ mi.flags = 0;
}
}
- mi.flags|=CMIM_ALL;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuSkypeOutCallItem,(LPARAM)&mi);
+ mi.flags |= CMIM_ALL;
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuSkypeOutCallItem, (LPARAM)&mi);
}
return 0;
@@ -294,15 +288,15 @@ int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { /*
int ClistDblClick(WPARAM wParam, LPARAM lParam) {
- char *szProto;
+char *szProto;
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
- db_get_w((HANDLE)wParam, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE)==ID_STATUS_ONTHEPHONE) {
- SkypeCall(wParam, 0);
- }
+szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
+if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
+db_get_w((HANDLE)wParam, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE)==ID_STATUS_ONTHEPHONE) {
+SkypeCall(wParam, 0);
+}
- return 0;
+return 0;
}
*/
@@ -312,13 +306,13 @@ MCONTACT find_contact(char *name) DBVARIANT dbv;
// already on list?
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact=db_find_next(hContact))
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
- char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==0)
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
+ if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
{
if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue;
- tCompareResult = strcmp(dbv.pszVal, name);
+ tCompareResult = strcmp(dbv.pszVal, name);
db_free(&dbv);
if (tCompareResult) continue;
return hContact; // already there, return handle
@@ -333,13 +327,13 @@ MCONTACT find_contactT(TCHAR *name) DBVARIANT dbv;
// already on list?
- for (MCONTACT hContact=db_find_first(); hContact != NULL; hContact=db_find_next(hContact))
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
- char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==0)
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
+ if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
{
if (db_get_ts(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue;
- tCompareResult = _tcscmp(dbv.ptszVal, name);
+ tCompareResult = _tcscmp(dbv.ptszVal, name);
db_free(&dbv);
if (tCompareResult) continue;
return hContact; // already there, return handle
@@ -354,34 +348,36 @@ MCONTACT add_contact(char *name, DWORD flags) MCONTACT hContact;
// already on list?
- if (hContact=find_contact(name)) {
+ if (hContact = find_contact(name)) {
if (!(flags & PALF_TEMPORARY) && db_get_b(hContact, "CList", "NotOnList", 1)) {
- db_unset( hContact, "CList", "NotOnList" );
- db_unset( hContact, "CList", "Hidden" );
+ db_unset(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "Hidden");
}
LOG(("add_contact: Found %s", name));
return hContact; // already there, return handle
}
// no, so add
-
+
LOG(("add_contact: Adding %s", name));
- hContact=(MCONTACT)CallServiceSync(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = (MCONTACT)CallServiceSync(MS_DB_CONTACT_ADD, 0, 0);
if (hContact) {
- if (CallServiceSync(MS_PROTO_ADDTOCONTACT, hContact,(LPARAM)SKYPE_PROTONAME)!=0) {
+ if (CallServiceSync(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)SKYPE_PROTONAME) != 0) {
LOG(("add_contact: Ouch! MS_PROTO_ADDTOCONTACT failed for some reason"));
CallServiceSync(MS_DB_CONTACT_DELETE, hContact, 0);
return NULL;
}
if (name[0]) db_set_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, name);
- if (flags & PALF_TEMPORARY ) {
+ if (flags & PALF_TEMPORARY) {
db_set_b(hContact, "CList", "NotOnList", 1);
db_set_b(hContact, "CList", "Hidden", 1);
}
if (name[0]) {
SkypeSend("GET USER %s DISPLAYNAME", name);
- } else {LOG(("add_contact: Info: The contact added has no name."));}
- } else {LOG(("add_contact: Ouch! MS_DB_CONTACT_ADD failed for some reason"));}
+ }
+ else { LOG(("add_contact: Info: The contact added has no name.")); }
+ }
+ else { LOG(("add_contact: Ouch! MS_DB_CONTACT_ADD failed for some reason")); }
LOG(("add_contact succeeded"));
return hContact;
}
@@ -389,31 +385,31 @@ MCONTACT add_contact(char *name, DWORD flags) void logoff_contacts(BOOL bCleanup) {
MCONTACT hContact;
char *szProto;
- DBVARIANT dbv={0};
+ DBVARIANT dbv = { 0 };
LOG(("logoff_contacts: Logging off contacts."));
- for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME))
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
+ if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME))
{
- if (db_get_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE)
+ if (db_get_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
db_set_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE);
db_unset(hContact, SKYPE_PROTONAME, "CallId");
- if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1)
+ if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 1)
{
if (db_get_ts(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv)) continue;
- RemChat (dbv.ptszVal);
+ RemChat(dbv.ptszVal);
db_free(&dbv);
}
if (db_get_s(hContact, SKYPE_PROTONAME, "Typing_Stream", &dbv) == 0)
{
- if (bCleanup) SkypeSend ("ALTER APPLICATION libpurple_typing DISCONNECT %s", dbv.pszVal);
+ if (bCleanup) SkypeSend("ALTER APPLICATION libpurple_typing DISCONNECT %s", dbv.pszVal);
db_free(&dbv);
db_unset(hContact, SKYPE_PROTONAME, "Typing_Stream");
}
}
}
- if (bCleanup && (protocol>=5 || bIsImoproxy)) SkypeSend ("DELETE APPLICATION libpurple_typing");
+ if (bCleanup && (protocol >= 5 || bIsImoproxy)) SkypeSend("DELETE APPLICATION libpurple_typing");
}
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index bd65d1bae7..20d4048458 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "pthread.h"
#include "gchat.h"
#include "m_toptoolbar.h"
-#include "voiceservice.h"
#include "msglist.h"
#include "memlist.h"
#include <sys/timeb.h>
@@ -34,9 +33,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF
#endif
#ifdef _WIN64
- #if (_MSC_VER < 1500)
- #pragma comment (lib, "bufferoverflowU.lib")
- #endif
+#if (_MSC_VER < 1500)
+#pragma comment (lib, "bufferoverflowU.lib")
+#endif
#endif
#pragma warning (disable: 4706) // assignment within conditional expression
@@ -44,18 +43,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. POPUPDATAT MessagePopup;
// Exported Globals
-HWND hSkypeWnd=NULL, g_hWnd=NULL, hSkypeWndSecondary=NULL, hForbiddenSkypeWnd = NULL;
-HANDLE SkypeReady, SkypeMsgReceived, hInitChat=NULL, httbButton=NULL, FetchMessageEvent=NULL;
-BOOL SkypeInitialized=FALSE, MirandaShuttingDown=FALSE, PopupServiceExists=FALSE;
-BOOL UseSockets=FALSE, bSkypeOut=FALSE, bProtocolSet=FALSE, bIsImoproxy=FALSE;
-char skype_path[MAX_PATH], protocol=2, *pszProxyCallout=NULL, g_szProtoName[_MAX_FNAME]="SkypeClassic";
-int SkypeStatus=ID_STATUS_OFFLINE, hSearchThread=-1, receivers=1;
+HWND hSkypeWnd = NULL, g_hWnd = NULL, hSkypeWndSecondary = NULL, hForbiddenSkypeWnd = NULL;
+HANDLE SkypeReady, SkypeMsgReceived, hInitChat = NULL, httbButton = NULL, FetchMessageEvent = NULL;
+BOOL SkypeInitialized = FALSE, MirandaShuttingDown = FALSE, PopupServiceExists = FALSE;
+BOOL UseSockets = FALSE, bSkypeOut = FALSE, bProtocolSet = FALSE, bIsImoproxy = FALSE;
+char skype_path[MAX_PATH], protocol = 2, *pszProxyCallout = NULL, g_szProtoName[_MAX_FNAME] = "SkypeClassic";
+int SkypeStatus = ID_STATUS_OFFLINE, hSearchThread = -1, receivers = 1;
long sendwatchers = 0, rcvwatchers = 0;
UINT ControlAPIAttach, ControlAPIDiscover;
-LONG AttachStatus=-1;
+LONG AttachStatus = -1;
HINSTANCE hInst;
HANDLE hProtocolAvatarsFolder;
-char DefaultAvatarsFolder[MAX_PATH+1];
+char DefaultAvatarsFolder[MAX_PATH + 1];
DWORD mirandaVersion;
int hLangpack = 0;
@@ -63,47 +62,47 @@ CRITICAL_SECTION RingAndEndcallMutex, QueryThreadMutex, TimeMutex; // Module Internal Globals
HANDLE MessagePumpReady;
-HANDLE hChatEvent=NULL, hChatMenu=NULL;
-HANDLE hEvInitChat=NULL, hBuddyAdded=NULL;
-HANDLE hMenuAddSkypeContact=NULL;
+HANDLE hChatEvent = NULL, hChatMenu = NULL;
+HANDLE hEvInitChat = NULL, hBuddyAdded = NULL;
+HANDLE hMenuAddSkypeContact = NULL;
DWORD msgPumpThreadId = 0;
#ifdef SKYPEBUG_OFFLN
HANDLE GotUserstatus;
#endif
-BOOL bModulesLoaded=FALSE;
-char *RequestedStatus=NULL; // To fix Skype-API Statusmode-bug
-char cmdMessage[12]="MESSAGE", cmdPartner[8]="PARTNER"; // Compatibility commands
+BOOL bModulesLoaded = FALSE;
+char *RequestedStatus = NULL; // To fix Skype-API Statusmode-bug
+char cmdMessage[12] = "MESSAGE", cmdPartner[8] = "PARTNER"; // Compatibility commands
// Direct assignment of user properties to a DB-Setting
-static const settings_map m_settings[]= {
- {"LANGUAGE", "Language1"},
- {"PROVINCE", "State"},
- {"CITY", "City"},
- {"PHONE_HOME", "Phone"},
- {"PHONE_OFFICE", "CompanyPhone"},
- {"PHONE_MOBILE", "Cellular"},
- {"HOMEPAGE", "Homepage"},
- {"ABOUT", "About"}
- };
+static const settings_map m_settings[] = {
+ { "LANGUAGE", "Language1" },
+ { "PROVINCE", "State" },
+ { "CITY", "City" },
+ { "PHONE_HOME", "Phone" },
+ { "PHONE_OFFICE", "CompanyPhone" },
+ { "PHONE_MOBILE", "Cellular" },
+ { "HOMEPAGE", "Homepage" },
+ { "ABOUT", "About" }
+};
// Imported Globals
extern status_map status_codes[];
-BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
+BOOL(WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
HMODULE hUxTheme = 0;
// function pointers, use typedefs for casting to shut up the compiler when using GetProcAddress()
-typedef BOOL (WINAPI *PITA)();
-typedef HANDLE (WINAPI *POTD)(HWND, LPCWSTR);
-typedef UINT (WINAPI *PDTB)(HANDLE, HDC, int, int, RECT *, RECT *);
-typedef UINT (WINAPI *PCTD)(HANDLE);
-typedef UINT (WINAPI *PDTT)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, RECT *);
+typedef BOOL(WINAPI *PITA)();
+typedef HANDLE(WINAPI *POTD)(HWND, LPCWSTR);
+typedef UINT(WINAPI *PDTB)(HANDLE, HDC, int, int, RECT *, RECT *);
+typedef UINT(WINAPI *PCTD)(HANDLE);
+typedef UINT(WINAPI *PDTT)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, RECT *);
PITA pfnIsThemeActive = 0;
POTD pfnOpenThemeData = 0;
@@ -134,20 +133,20 @@ typedef struct { int InitVSApi()
{
- if((hUxTheme = LoadLibraryA("uxtheme.dll")) == 0)
- return 0;
-
- pfnIsThemeActive = (PITA)GetProcAddress(hUxTheme, "IsThemeActive");
- pfnOpenThemeData = (POTD)GetProcAddress(hUxTheme, "OpenThemeData");
- pfnDrawThemeBackground = (PDTB)GetProcAddress(hUxTheme, "DrawThemeBackground");
- pfnCloseThemeData = (PCTD)GetProcAddress(hUxTheme, "CloseThemeData");
- pfnDrawThemeText = (PDTT)GetProcAddress(hUxTheme, "DrawThemeText");
-
- MyEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
- if(pfnIsThemeActive != 0 && pfnOpenThemeData != 0 && pfnDrawThemeBackground != 0 && pfnCloseThemeData != 0 && pfnDrawThemeText != 0) {
- return 1;
- }
- return 0;
+ if ((hUxTheme = LoadLibraryA("uxtheme.dll")) == 0)
+ return 0;
+
+ pfnIsThemeActive = (PITA)GetProcAddress(hUxTheme, "IsThemeActive");
+ pfnOpenThemeData = (POTD)GetProcAddress(hUxTheme, "OpenThemeData");
+ pfnDrawThemeBackground = (PDTB)GetProcAddress(hUxTheme, "DrawThemeBackground");
+ pfnCloseThemeData = (PCTD)GetProcAddress(hUxTheme, "CloseThemeData");
+ pfnDrawThemeText = (PDTT)GetProcAddress(hUxTheme, "DrawThemeText");
+
+ MyEnableThemeDialogTexture = (BOOL(WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
+ if (pfnIsThemeActive != 0 && pfnOpenThemeData != 0 && pfnDrawThemeBackground != 0 && pfnCloseThemeData != 0 && pfnDrawThemeText != 0) {
+ return 1;
+ }
+ return 0;
}
/*
@@ -156,9 +155,9 @@ int InitVSApi() int FreeVSApi()
{
- if(hUxTheme != 0)
- FreeLibrary(hUxTheme);
- return 0;
+ if (hUxTheme != 0)
+ FreeLibrary(hUxTheme);
+ return 0;
}
// Plugin Info
@@ -173,7 +172,7 @@ PLUGININFOEX pluginInfo = { __AUTHORWEB,
UNICODE_AWARE,
// {A71F8335-7B87-4432-B8A3-81479431C6F5}
- {0xa71f8335, 0x7b87, 0x4432, {0xb8, 0xa3, 0x81, 0x47, 0x94, 0x31, 0xc6, 0xf5}}
+ { 0xa71f8335, 0x7b87, 0x4432, { 0xb8, 0xa3, 0x81, 0x47, 0x94, 0x31, 0xc6, 0xf5 } }
};
#define MAPDND 1 // Map Occupied to DND status and say that you support it
@@ -183,9 +182,9 @@ PLUGININFOEX pluginInfo = { void RegisterToDbeditorpp(void)
{
- // known modules list
- if (ServiceExists("DBEditorpp/RegisterSingleModule"))
- CallService("DBEditorpp/RegisterSingleModule", (WPARAM)SKYPE_PROTONAME, 0);
+ // known modules list
+ if (ServiceExists("DBEditorpp/RegisterSingleModule"))
+ CallService("DBEditorpp/RegisterSingleModule", (WPARAM)SKYPE_PROTONAME, 0);
}
/*
@@ -205,7 +204,7 @@ int ShowMessage(int iconID, TCHAR *lpzText, int mustShow) { if (db_get_b(NULL, SKYPE_PROTONAME, "SuppressErrors", 0)) return -1;
- lpzText=TranslateTS(lpzText);
+ lpzText = TranslateTS(lpzText);
if (bModulesLoaded && PopupServiceExists && ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, SKYPE_PROTONAME, "UsePopup", 0) && !MirandaShuttingDown) {
BOOL showPopup, popupWindowColor;
@@ -215,32 +214,32 @@ int ShowMessage(int iconID, TCHAR *lpzText, int mustShow) { popupTimeSec = db_get_dw(NULL, SKYPE_PROTONAME, "popupTimeSecErr", 4);
popupTextColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupTextColorErr", GetSysColor(COLOR_WINDOWTEXT));
popupBackColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupBackColorErr", GetSysColor(COLOR_BTNFACE));
- popupWindowColor = ( 0 != db_get_b(NULL, SKYPE_PROTONAME, "popupWindowColorErr", TRUE));
- showPopup = ( 0 != db_get_b(NULL, SKYPE_PROTONAME, "showPopupErr", TRUE));
+ popupWindowColor = (0 != db_get_b(NULL, SKYPE_PROTONAME, "popupWindowColorErr", TRUE));
+ showPopup = (0 != db_get_b(NULL, SKYPE_PROTONAME, "showPopupErr", TRUE));
MessagePopup.lchContact = NULL;
- MessagePopup.lchIcon = LoadIcon(hInst,MAKEINTRESOURCE(iconID));
- MessagePopup.colorBack = ! popupWindowColor ? popupBackColor : GetSysColor(COLOR_BTNFACE);
- MessagePopup.colorText = ! popupWindowColor ? popupTextColor : GetSysColor(COLOR_WINDOWTEXT);
+ MessagePopup.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(iconID));
+ MessagePopup.colorBack = !popupWindowColor ? popupBackColor : GetSysColor(COLOR_BTNFACE);
+ MessagePopup.colorText = !popupWindowColor ? popupTextColor : GetSysColor(COLOR_WINDOWTEXT);
MessagePopup.iSeconds = popupTimeSec;
MessagePopup.PluginData = (void *)1;
-
+
lstrcpy(MessagePopup.lptzText, lpzText);
#ifdef _UNICODE
- mbstowcs (MessagePopup.lptzContactName, SKYPE_PROTONAME, strlen(SKYPE_PROTONAME)+1);
+ mbstowcs(MessagePopup.lptzContactName, SKYPE_PROTONAME, strlen(SKYPE_PROTONAME) + 1);
#else
lstrcpy(MessagePopup.lptzContactName, SKYPE_PROTONAME);
#endif
- if(showPopup)
- CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&MessagePopup,0);
+ if (showPopup)
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&MessagePopup, 0);
return 0;
- }
+ }
else {
- if (mustShow==1) MessageBox(NULL,lpzText,_T("Skype Protocol"), MB_OK | MB_ICONWARNING);
+ if (mustShow == 1) MessageBox(NULL, lpzText, _T("Skype Protocol"), MB_OK | MB_ICONWARNING);
return 0;
}
}
@@ -248,11 +247,11 @@ int ShowMessage(int iconID, TCHAR *lpzText, int mustShow) { int ShowMessageA(int iconID, char *lpzText, int mustShow) {
WCHAR *lpwText;
int iRet;
- size_t len = mbstowcs (NULL, lpzText, strlen(lpzText));
- if (len == -1 || !(lpwText = (WCHAR*)calloc(len+1,sizeof(WCHAR)))) return -1;
- mbstowcs (lpwText, lpzText, strlen(lpzText));
+ size_t len = mbstowcs(NULL, lpzText, strlen(lpzText));
+ if (len == -1 || !(lpwText = (WCHAR*)calloc(len + 1, sizeof(WCHAR)))) return -1;
+ mbstowcs(lpwText, lpzText, strlen(lpzText));
iRet = ShowMessage(iconID, lpwText, mustShow);
- free (lpwText);
+ free(lpwText);
return iRet;
}
#endif
@@ -264,8 +263,8 @@ int HookContactAdded(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam);
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME))
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME))
add_contextmenu((MCONTACT)wParam);
return 0;
}
@@ -275,13 +274,13 @@ int HookContactDeleted(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam);
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME)) {
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME)) {
DBVARIANT dbv;
int retval;
if (db_get_s((MCONTACT)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return 1;
- retval=SkypeSend("SET USER %s BUDDYSTATUS 1", dbv.pszVal);
+ retval = SkypeSend("SET USER %s BUDDYSTATUS 1", dbv.pszVal);
db_free(&dbv);
if (retval) return 1;
}
@@ -300,30 +299,30 @@ void GetInfoThread(void *hContact) // fall through there so that message gets added to the queue in order to be
// consumed by SkypeGet
char *pszProps[] = {
- "BIRTHDAY", "COUNTRY", "SEX", "MOOD_TEXT", "TIMEZONE", "IS_VIDEO_CAPABLE"};
+ "BIRTHDAY", "COUNTRY", "SEX", "MOOD_TEXT", "TIMEZONE", "IS_VIDEO_CAPABLE" };
- LOG (("GetInfoThread started."));
- EnterCriticalSection (&QueryThreadMutex);
- if (db_get_s((MCONTACT)hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
+ LOG(("GetInfoThread started."));
+ EnterCriticalSection(&QueryThreadMutex);
+ if (db_get_s((MCONTACT)hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
{
- LOG (("GetInfoThread terminated, cannot find Skype Name for contact %08X.", hContact));
- LeaveCriticalSection (&QueryThreadMutex);
+ LOG(("GetInfoThread terminated, cannot find Skype Name for contact %08X.", hContact));
+ LeaveCriticalSection(&QueryThreadMutex);
return;
}
- if (ptr=SkypeGet ("USER", dbv.pszVal, "DISPLAYNAME")) {
+ if (ptr = SkypeGet("USER", dbv.pszVal, "DISPLAYNAME")) {
// WndProc sets Nick accordingly
if (*ptr) bSetNick = TRUE;
- free (ptr);
+ free(ptr);
}
- if (ptr=SkypeGet ("USER", dbv.pszVal, "FULLNAME")) {
+ if (ptr = SkypeGet("USER", dbv.pszVal, "FULLNAME")) {
if (*ptr && !bSetNick && db_get_b(NULL, SKYPE_PROTONAME, "ShowFullname", 1)) {
// No Displayname and FULLNAME requested
db_set_utf((MCONTACT)hContact, SKYPE_PROTONAME, "Nick", ptr);
bSetNick = TRUE;
}
- free (ptr);
+ free(ptr);
}
if (!bSetNick) {
@@ -334,81 +333,83 @@ void GetInfoThread(void *hContact) if (!bIsImoproxy)
{
- for (i=0; i<sizeof(pszProps)/sizeof(pszProps[0]); i++)
- if (ptr=SkypeGet ("USER", dbv.pszVal, pszProps[i])) free (ptr);
- } else {
- if (ptr=SkypeGet ("USER", dbv.pszVal, "MOOD_TEXT")) free (ptr);
+ for (i = 0; i < sizeof(pszProps) / sizeof(pszProps[0]); i++)
+ if (ptr = SkypeGet("USER", dbv.pszVal, pszProps[i])) free(ptr);
+ }
+ else {
+ if (ptr = SkypeGet("USER", dbv.pszVal, "MOOD_TEXT")) free(ptr);
}
if (protocol >= 7 || bIsImoproxy) {
// Notify about the possibility of an avatar
- ACKDATA ack = {0};
- ack.cbSize = sizeof( ACKDATA );
+ ACKDATA ack = { 0 };
+ ack.cbSize = sizeof(ACKDATA);
ack.szModule = SKYPE_PROTONAME;
ack.hContact = (MCONTACT)hContact;
ack.type = ACKTYPE_AVATAR;
ack.result = ACKRESULT_STATUS;
- CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack );
+ CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack);
//if (ptr=SkypeGet ("USER", dbv.pszVal, "RICH_MOOD_TEXT")) free (ptr);
}
if (!bIsImoproxy)
{
- for (i=0; i<sizeof(m_settings)/sizeof(m_settings[0]); i++)
- if (ptr=SkypeGet ("USER", dbv.pszVal, m_settings[i].SkypeSetting)) free (ptr);
+ for (i = 0; i < sizeof(m_settings) / sizeof(m_settings[0]); i++)
+ if (ptr = SkypeGet("USER", dbv.pszVal, m_settings[i].SkypeSetting)) free(ptr);
}
- ProtoBroadcastAck(SKYPE_PROTONAME, (MCONTACT)hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+ ProtoBroadcastAck(SKYPE_PROTONAME, (MCONTACT)hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
LeaveCriticalSection(&QueryThreadMutex);
db_free(&dbv);
- LOG (("GetInfoThread terminated gracefully."));
+ LOG(("GetInfoThread terminated gracefully."));
}
time_t SkypeTime(time_t *timer)
{
struct _timeb tb;
-
- EnterCriticalSection (&TimeMutex);
+
+ EnterCriticalSection(&TimeMutex);
_ftime(&tb);
- if (timer) *timer=tb.time;
- LeaveCriticalSection (&TimeMutex);
+ if (timer) *timer = tb.time;
+ LeaveCriticalSection(&TimeMutex);
return tb.time;
}
void BasicSearchThread(char *nick) {
- PROTOSEARCHRESULT psr={0};
- char *cmd=NULL, *token=NULL, *ptr=NULL, *nextoken;
+ PROTOSEARCHRESULT psr = { 0 };
+ char *cmd = NULL, *token = NULL, *ptr = NULL, *nextoken;
time_t st;
- LOG (("BasicSearchThread started."));
- EnterCriticalSection (&QueryThreadMutex);
+ LOG(("BasicSearchThread started."));
+ EnterCriticalSection(&QueryThreadMutex);
SkypeTime(&st);
- if (SkypeSend("SEARCH USERS %s", nick)==0 && (cmd=SkypeRcvTime("USERS", st, INFINITE))) {
+ if (SkypeSend("SEARCH USERS %s", nick) == 0 && (cmd = SkypeRcvTime("USERS", st, INFINITE))) {
if (strncmp(cmd, "ERROR", 5)) {
- psr.cbSize=sizeof(psr);
- for (token=strtok_r(cmd+5, ", ", &nextoken); token; token=strtok_r(NULL, ", ", &nextoken)) {
- psr.nick=psr.id=_A2T(token);
- psr.lastName=NULL;
- psr.firstName=NULL;
- psr.email=NULL;
- if (ptr=SkypeGet("USER", token, "FULLNAME")) {
+ psr.cbSize = sizeof(psr);
+ for (token = strtok_r(cmd + 5, ", ", &nextoken); token; token = strtok_r(NULL, ", ", &nextoken)) {
+ psr.nick = psr.id = _A2T(token);
+ psr.lastName = NULL;
+ psr.firstName = NULL;
+ psr.email = NULL;
+ if (ptr = SkypeGet("USER", token, "FULLNAME")) {
// We cannot use strtok() to seperate first & last name here,
// because we already use it for parsing the user list
// So we use our own function
- if (psr.lastName=_A2T(strchr(ptr, ' '))) {
- *psr.lastName=0;
+ if (psr.lastName = _A2T(strchr(ptr, ' '))) {
+ *psr.lastName = 0;
psr.lastName++;
LOG(("BasicSearchThread: lastName=%s", psr.lastName));
}
- psr.firstName=_A2T(ptr);
+ psr.firstName = _A2T(ptr);
LOG(("BasicSearchThread: firstName=%s", psr.firstName));
}
ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)hSearchThread, (LPARAM)(PROTOSEARCHRESULT*)&psr);
if (ptr) free(ptr);
}
- } else {
+ }
+ else {
OUT(cmd);
}
free(cmd);
@@ -416,7 +417,7 @@ void BasicSearchThread(char *nick) { ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)hSearchThread, 0);
free(nick);
LeaveCriticalSection(&QueryThreadMutex);
- LOG (("BasicSearchThread terminated gracefully."));
+ LOG(("BasicSearchThread terminated gracefully."));
return;
}
@@ -426,20 +427,20 @@ void GetDisplaynameThread(char *dummy) { char *ptr;
UNREFERENCED_PARAMETER(dummy);
-
+
LOG(("GetDisplaynameThread started."));
if (db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) {
LOG(("GetDisplaynameThread terminated."));
return;
}
EnterCriticalSection(&QueryThreadMutex);
- if ((ptr=SkypeGet("USER", dbv.pszVal, "FULLNAME"))) {
+ if ((ptr = SkypeGet("USER", dbv.pszVal, "FULLNAME"))) {
if (*ptr) db_set_utf(NULL, SKYPE_PROTONAME, "Nick", ptr);
free(ptr);
}
db_free(&dbv);
LeaveCriticalSection(&QueryThreadMutex);
- LOG(("GetDisplaynameThread terminated gracefully."));
+ LOG(("GetDisplaynameThread terminated gracefully."));
}
@@ -448,11 +449,12 @@ INT_PTR ImportHistory(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv;
UNREFERENCED_PARAMETER(lParam);
-
+
if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0)) {
if (db_get_s((MCONTACT)wParam, SKYPE_PROTONAME, "ChatRoomID", &dbv)) return 0;
- SkypeSend ("GET CHAT %s CHATMESSAGES", dbv.pszVal);
- } else {
+ SkypeSend("GET CHAT %s CHATMESSAGES", dbv.pszVal);
+ }
+ else {
if (db_get_s((MCONTACT)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return 0;
SkypeSend("SEARCH %sS %s", cmdMessage, dbv.pszVal);
}
@@ -466,22 +468,24 @@ int SearchFriends(void) { time_t st;
SkypeTime(&st);
- if (SkypeSend("SEARCH FRIENDS")!=-1 && (ptr=SkypeRcvTime("USERS", st, INFINITE)))
+ if (SkypeSend("SEARCH FRIENDS") != -1 && (ptr = SkypeRcvTime("USERS", st, INFINITE)))
{
if (strncmp(ptr, "ERROR", 5)) {
- if (ptr+5) {
- for (token=strtok_r(ptr+5, ", ", &nextoken); token; token=strtok_r(NULL, ", ", &nextoken)) {
+ if (ptr + 5) {
+ for (token = strtok_r(ptr + 5, ", ", &nextoken); token; token = strtok_r(NULL, ", ", &nextoken)) {
if (!(pStat = SkypeGet("USER", token, "ONLINESTATUS")))
{
iRet = -1;
break;
}
- free (pStat);
+ free(pStat);
}
}
- } else iRet=-1;
+ }
+ else iRet = -1;
free(ptr);
- } else iRet=-1;
+ }
+ else iRet = -1;
return iRet;
}
@@ -491,55 +495,55 @@ void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) { UNREFERENCED_PARAMETER(dummy);
if (SkypeSend("#UWA SEARCH USERSWAITINGMYAUTHORIZATION")) return;
- if (!(cmd=SkypeRcv("#UWA USERS", INFINITE))) return;
+ if (!(cmd = SkypeRcv("#UWA USERS", INFINITE))) return;
if (!strncmp(cmd, "ERROR", 5)) {
free(cmd);
return;
}
- token=strtok_r(cmd+10, ", ", &nextoken);
+ token = strtok_r(cmd + 10, ", ", &nextoken);
while (token) {
- CCSDATA ccs={0};
- PROTORECVEVENT pre={0};
+ CCSDATA ccs = { 0 };
+ PROTORECVEVENT pre = { 0 };
MCONTACT hContact;
- char *firstname=NULL, *lastname=NULL, *pCurBlob;
-
+ char *firstname = NULL, *lastname = NULL, *pCurBlob;
+
LOG(("Awaiting auth: %s", token));
- ccs.szProtoService=PSR_AUTH;
- ccs.hContact=hContact=add_contact(token, PALF_TEMPORARY);
- ccs.wParam=0;
- ccs.lParam=(LPARAM)⪯
- pre.flags=0;
- pre.timestamp=(DWORD)SkypeTime(NULL);
+ ccs.szProtoService = PSR_AUTH;
+ ccs.hContact = hContact = add_contact(token, PALF_TEMPORARY);
+ ccs.wParam = 0;
+ ccs.lParam = (LPARAM)⪯
+ pre.flags = 0;
+ pre.timestamp = (DWORD)SkypeTime(NULL);
/* blob is: */
//DWORD protocolSpecific MCONTACT hContact
//ASCIIZ nick, firstName, lastName, e-mail, requestReason
- if (firstname=SkypeGet("USER", token, "FULLNAME"))
- if (lastname=strchr(firstname, ' ')) {
- *lastname=0;
- lastname++;
+ if (firstname = SkypeGet("USER", token, "FULLNAME"))
+ if (lastname = strchr(firstname, ' ')) {
+ *lastname = 0;
+ lastname++;
}
-
- pre.lParam=sizeof(DWORD)+sizeof(HANDLE)+strlen(token)+5;
- if (firstname) pre.lParam+=strlen(firstname);
- if (lastname) pre.lParam+=strlen(lastname);
- if (pre.szMessage = pCurBlob = (char *)calloc(1, pre.lParam)) {
- pCurBlob+=sizeof(DWORD); // Not used
- memcpy(pCurBlob,&hContact,sizeof(HANDLE)); pCurBlob+=sizeof(HANDLE);
- strcpy((char *)pCurBlob,token); pCurBlob+=strlen((char *)pCurBlob)+1;
+
+ pre.lParam = sizeof(DWORD) + sizeof(HANDLE) + strlen(token) + 5;
+ if (firstname) pre.lParam += strlen(firstname);
+ if (lastname) pre.lParam += strlen(lastname);
+ if (pre.szMessage = pCurBlob = (char *)calloc(1, pre.lParam)) {
+ pCurBlob += sizeof(DWORD); // Not used
+ memcpy(pCurBlob, &hContact, sizeof(HANDLE)); pCurBlob += sizeof(HANDLE);
+ strcpy((char *)pCurBlob, token); pCurBlob += strlen((char *)pCurBlob) + 1;
if (firstname) {
- strcpy((char *)pCurBlob,firstname);
+ strcpy((char *)pCurBlob, firstname);
if (lastname) {
- pCurBlob+=strlen((char *)pCurBlob)+1;
- strcpy((char *)pCurBlob,lastname);
+ pCurBlob += strlen((char *)pCurBlob) + 1;
+ strcpy((char *)pCurBlob, lastname);
}
}
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
free(pre.szMessage);
}
if (firstname) free(firstname);
- token=strtok_r(NULL, ", ", &nextoken);
+ token = strtok_r(NULL, ", ", &nextoken);
}
free(cmd);
return;
@@ -549,13 +553,13 @@ void SearchFriendsThread(char *dummy) { UNREFERENCED_PARAMETER(dummy);
if (!SkypeInitialized) return;
- LOG(("SearchFriendsThread started."));
+ LOG(("SearchFriendsThread started."));
EnterCriticalSection(&QueryThreadMutex);
- SkypeInitialized=FALSE;
+ SkypeInitialized = FALSE;
SearchFriends();
- SkypeInitialized=TRUE;
+ SkypeInitialized = TRUE;
LeaveCriticalSection(&QueryThreadMutex);
- LOG(("SearchFriendsThread terminated gracefully."));
+ LOG(("SearchFriendsThread terminated gracefully."));
}
void __cdecl SearchRecentChats(void *dummy) {
@@ -564,14 +568,14 @@ void __cdecl SearchRecentChats(void *dummy) { UNREFERENCED_PARAMETER(dummy);
if (SkypeSend("#RCH SEARCH RECENTCHATS")) return;
- if (!(cmd=SkypeRcv("#RCH CHATS", INFINITE))) return;
+ if (!(cmd = SkypeRcv("#RCH CHATS", INFINITE))) return;
if (!strncmp(cmd, "ERROR", 5)) {
free(cmd);
return;
}
- for (token=strtok_r(cmd+10, ", ", &nextoken); token; token=strtok_r(NULL, ", ", &nextoken)) {
- char *pszStatus = SkypeGet ("CHAT", token, "STATUS");
+ for (token = strtok_r(cmd + 10, ", ", &nextoken); token; token = strtok_r(NULL, ", ", &nextoken)) {
+ char *pszStatus = SkypeGet("CHAT", token, "STATUS");
if (pszStatus) {
if (!strcmp(pszStatus, "MULTI_SUBSCRIBED")) {
@@ -579,26 +583,26 @@ void __cdecl SearchRecentChats(void *dummy) { /*if (!find_chatA(token)) */{
char *pszTopic;
- EnterCriticalSection (&QueryThreadMutex);
+ EnterCriticalSection(&QueryThreadMutex);
ChatStart(token, TRUE);
- if (pszTopic = SkypeGet ("CHAT", token, "TOPIC")) {
+ if (pszTopic = SkypeGet("CHAT", token, "TOPIC")) {
TCHAR *psztChatName, *psztTopic;
if (!*pszTopic) {
- free (pszTopic);
- pszTopic = SkypeGet ("CHAT", token, "FRIENDLYNAME");
+ free(pszTopic);
+ pszTopic = SkypeGet("CHAT", token, "FRIENDLYNAME");
}
psztChatName = make_nonutf_tchar_string((const unsigned char*)token);
psztTopic = make_tchar_string((const unsigned char*)pszTopic);
- SetChatTopic (psztChatName, psztTopic, FALSE);
+ SetChatTopic(psztChatName, psztTopic, FALSE);
free_nonutf_tchar_string(psztChatName);
- free (psztTopic);
- free (pszTopic);
+ free(psztTopic);
+ free(pszTopic);
+ }
+ LeaveCriticalSection(&QueryThreadMutex);
}
- LeaveCriticalSection (&QueryThreadMutex);
- }
}
- free (pszStatus);
+ free(pszStatus);
}
}
free(cmd);
@@ -607,33 +611,33 @@ void __cdecl SearchRecentChats(void *dummy) { void __cdecl SkypeSystemInit(char *dummy) {
- static BOOL Initializing=FALSE;
- DBVARIANT dbv={0};
+ static BOOL Initializing = FALSE;
+ DBVARIANT dbv = { 0 };
UNREFERENCED_PARAMETER(dummy);
- LOG (("SkypeSystemInit thread started."));
+ LOG(("SkypeSystemInit thread started."));
if (SkypeInitialized || Initializing)
{
- LOG (("SkypeSystemInit terminated, nothing to do."));
+ LOG(("SkypeSystemInit terminated, nothing to do."));
return;
}
- Initializing=TRUE;
-// Do initial Skype-Tasks
+ Initializing = TRUE;
+ // Do initial Skype-Tasks
logoff_contacts(FALSE);
-// Add friends
+ // Add friends
// Clear currentuserhandle entries from queue
- while (testfor ("CURRENTUSERHANDLE", 0));
- if (SkypeSend(SKYPE_PROTO)==-1 || !testfor("PROTOCOL", INFINITE) ||
- SkypeSend("GET CURRENTUSERHANDLE")==-1 ||
- SkypeSend("GET PRIVILEGE SKYPEOUT")==-1) {
- Initializing=FALSE;
- LOG (("SkypeSystemInit thread stopped with failure."));
- return;
+ while (testfor("CURRENTUSERHANDLE", 0));
+ if (SkypeSend(SKYPE_PROTO) == -1 || !testfor("PROTOCOL", INFINITE) ||
+ SkypeSend("GET CURRENTUSERHANDLE") == -1 ||
+ SkypeSend("GET PRIVILEGE SKYPEOUT") == -1) {
+ Initializing = FALSE;
+ LOG(("SkypeSystemInit thread stopped with failure."));
+ return;
}
- if(db_get_s(NULL,SKYPE_PROTONAME,"LoginUserName",&dbv) == 0)
+ if (db_get_s(NULL, SKYPE_PROTONAME, "LoginUserName", &dbv) == 0)
{
if (*dbv.pszVal)
{
@@ -641,24 +645,24 @@ void __cdecl SkypeSystemInit(char *dummy) { // Username is set in Plugin, therefore we need to match it
// against CURRENTUSERHANDLE
- if (pszUser = SkypeRcv ("CURRENTUSERHANDLE", INFINITE))
+ if (pszUser = SkypeRcv("CURRENTUSERHANDLE", INFINITE))
{
- memmove (pszUser, pszUser+18, strlen(pszUser+17));
+ memmove(pszUser, pszUser + 18, strlen(pszUser + 17));
if (_stricmp(dbv.pszVal, pszUser))
{
char szError[256];
// Doesn't match, maybe we have a second Skype instance we have to take
// care of? If in doubt, let's wait a while for it to report its hWnd to us.
- LOG (("Userhandle %s doesn't match username %s from settings", pszUser, dbv.pszVal));
+ LOG(("Userhandle %s doesn't match username %s from settings", pszUser, dbv.pszVal));
if (!hSkypeWndSecondary) Sleep(3000);
- if (hSkypeWndSecondary)
+ if (hSkypeWndSecondary)
{
hSkypeWnd = hSkypeWndSecondary;
hSkypeWndSecondary = NULL;
- Initializing=FALSE;
- while (testfor ("CURRENTUSERHANDLE", 0));
- LOG (("Trying to init secondary Skype instance"));
+ Initializing = FALSE;
+ while (testfor("CURRENTUSERHANDLE", 0));
+ LOG(("Trying to init secondary Skype instance"));
SkypeSystemInit(dummy);
}
else
@@ -667,38 +671,38 @@ void __cdecl SkypeSystemInit(char *dummy) { // If we need to start Skype as secondary instance, we should do it now
if (db_get_b(NULL, SKYPE_PROTONAME, "StartSkype", 1) &&
- db_get_b(NULL, SKYPE_PROTONAME, "secondary", 0))
+ db_get_b(NULL, SKYPE_PROTONAME, "secondary", 0))
{
int oldstatus;
hSkypeWnd = NULL;
- AttachStatus=-1;
- if (g_hWnd) KillTimer (g_hWnd, 1);
+ AttachStatus = -1;
+ if (g_hWnd) KillTimer(g_hWnd, 1);
oldstatus = SkypeStatus;
InterlockedExchange((long *)&SkypeStatus, ID_STATUS_CONNECTING);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
+ ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, SkypeStatus);
ConnectToSkypeAPI(skype_path, 1);
}
- if (hForbiddenSkypeWnd == hSkypeWnd && !hSkypeWndSecondary)
+ if (hForbiddenSkypeWnd == hSkypeWnd && !hSkypeWndSecondary)
{
int oldstatus;
- sprintf (szError, "Username '%s' provided by Skype API doesn't match username '%s' in "
+ sprintf(szError, "Username '%s' provided by Skype API doesn't match username '%s' in "
"your settings. Please either remove username setting in you configuration or correct "
"it. Will not connect!", pszUser, dbv.pszVal);
- OUTPUTA (szError);
- Initializing=FALSE;
- AttachStatus=-1;
+ OUTPUTA(szError);
+ Initializing = FALSE;
+ AttachStatus = -1;
logoff_contacts(FALSE);
- if (g_hWnd) KillTimer (g_hWnd, 1);
+ if (g_hWnd) KillTimer(g_hWnd, 1);
hSkypeWnd = NULL;
oldstatus = SkypeStatus;
InterlockedExchange((long *)&SkypeStatus, ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
+ ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, SkypeStatus);
}
}
}
- free (pszUser);
+ free(pszUser);
}
}
db_free(&dbv);
@@ -706,76 +710,76 @@ void __cdecl SkypeSystemInit(char *dummy) { }
#ifdef SKYPEBUG_OFFLN
- if (!ResetEvent(GotUserstatus) || SkypeSend("GET USERSTATUS")==-1 ||
- WaitForSingleObject(GotUserstatus, INFINITE)==WAIT_FAILED)
+ if (!ResetEvent(GotUserstatus) || SkypeSend("GET USERSTATUS") == -1 ||
+ WaitForSingleObject(GotUserstatus, INFINITE) == WAIT_FAILED)
{
- LOG (("SkypeSystemInit thread stopped with failure."));
- Initializing=FALSE;
+ LOG(("SkypeSystemInit thread stopped with failure."));
+ Initializing = FALSE;
return;
}
- if (SkypeStatus!=ID_STATUS_OFFLINE)
+ if (SkypeStatus != ID_STATUS_OFFLINE)
#endif
- if (SearchFriends()==-1) {
- LOG (("SkypeSystemInit thread stopped with failure."));
- Initializing=FALSE;
- return;
- }
- if (protocol>=5 || bIsImoproxy) {
- SkypeSend ("CREATE APPLICATION libpurple_typing");
- testfor ("CREATE APPLICATION libpurple_typing", 2000);
+ if (SearchFriends() == -1) {
+ LOG(("SkypeSystemInit thread stopped with failure."));
+ Initializing = FALSE;
+ return;
+ }
+ if (protocol >= 5 || bIsImoproxy) {
+ SkypeSend("CREATE APPLICATION libpurple_typing");
+ testfor("CREATE APPLICATION libpurple_typing", 2000);
}
- if (protocol>=5 || bIsImoproxy) {
+ if (protocol >= 5 || bIsImoproxy) {
SearchUsersWaitingMyAuthorization(NULL);
if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0))
SearchRecentChats(NULL);
}
SkypeSend("SEARCH MISSED%sS", cmdMessage);
-
+
#ifndef SKYPEBUG_OFFLN
if (SkypeSend("GET USERSTATUS")==-1)
{
- LOG (("SkypeSystemInit thread stopped with failure."));
+ LOG (("SkypeSystemInit thread stopped with failure."));
Initializing=FALSE;
return;
}
#endif
- SetTimer (g_hWnd, 1, PING_INTERVAL, NULL);
- SkypeInitialized=TRUE;
- Initializing=FALSE;
- LOG (("SkypeSystemInit thread terminated gracefully."));
+ SetTimer(g_hWnd, 1, PING_INTERVAL, NULL);
+ SkypeInitialized = TRUE;
+ Initializing = FALSE;
+ LOG(("SkypeSystemInit thread terminated gracefully."));
return;
}
void FirstLaunch(char *dummy) {
- int counter=0;
+ int counter = 0;
UNREFERENCED_PARAMETER(dummy);
- LOG (("FirstLaunch thread started."));
- if (!db_get_b(NULL, SKYPE_PROTONAME, "StartSkype", 1) || ConnectToSkypeAPI(skype_path, FALSE)==-1)
+ LOG(("FirstLaunch thread started."));
+ if (!db_get_b(NULL, SKYPE_PROTONAME, "StartSkype", 1) || ConnectToSkypeAPI(skype_path, FALSE) == -1)
{
- int oldstatus=SkypeStatus;
+ int oldstatus = SkypeStatus;
- LOG(("OnModulesLoaded starting offline.."));
+ LOG(("OnModulesLoaded starting offline.."));
InterlockedExchange((long *)&SkypeStatus, ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
+ ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, SkypeStatus);
}
- if (AttachStatus==-1 || AttachStatus==SKYPECONTROLAPI_ATTACH_REFUSED || AttachStatus==SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE) {
- LOG (("FirstLaunch thread stopped because of invalid Attachstatus."));
+ if (AttachStatus == -1 || AttachStatus == SKYPECONTROLAPI_ATTACH_REFUSED || AttachStatus == SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE) {
+ LOG(("FirstLaunch thread stopped because of invalid Attachstatus."));
return;
}
-
+
// When you launch Skype and Attach is Successfull, it still takes some time
// until it becomes available for receiving messages.
// Let's probe this with PINGing
LOG(("CheckIfApiIsResponding Entering test loop"));
- for ( ;; ) {
+ for (;;) {
LOG(("Test #%d", counter));
- if (SkypeSend("PING")==-1) counter ++; else break;
- if (counter>=20) {
+ if (SkypeSend("PING") == -1) counter++; else break;
+ if (counter >= 20) {
OUTPUT(_T("Cannot reach Skype API, plugin disfunct."));
- LOG (("FirstLaunch thread stopped: cannot reach Skype API."));
+ LOG(("FirstLaunch thread stopped: cannot reach Skype API."));
return;
}
Sleep(500);
@@ -783,28 +787,28 @@ void FirstLaunch(char *dummy) { LOG(("CheckIfApiIsResponding: Testing for PONG"));
testfor("PONG", 2000); // Flush PONG from MsgQueue
- pthread_create(( pThreadFunc )SkypeSystemInit, NULL);
- LOG (("FirstLaunch thread terminated gracefully."));
+ pthread_create((pThreadFunc)SkypeSystemInit, NULL);
+ LOG(("FirstLaunch thread terminated gracefully."));
}
int CreateTopToolbarButton(WPARAM wParam, LPARAM lParam) {
- TTBButton ttb={0};
-
+ TTBButton ttb = { 0 };
+
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
ttb.cbSize = sizeof(ttb);
- ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP;
- ttb.hIconHandleDn = ttb.hIconHandleUp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_CALL));
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
+ ttb.hIconHandleDn = ttb.hIconHandleUp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CALL));
ttb.pszService = SKYPEOUT_CALL;
- ttb.name=Translate("Do a SkypeOut-call");
- if ((int)(TopToolbar_AddButton(&ttb))==-1) httbButton=0;
+ ttb.name = Translate("Do a SkypeOut-call");
+ if ((int)(TopToolbar_AddButton(&ttb)) == -1) httbButton = 0;
return 0;
}
int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
- bModulesLoaded=TRUE;
+ bModulesLoaded = TRUE;
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
@@ -815,31 +819,30 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { HookEventsLoaded();
RegisterToDbeditorpp();
- VoiceServiceModulesLoaded();
GCInit();
add_contextmenu(NULL);
- if ( ServiceExists( MS_GC_REGISTER ))
+ if (ServiceExists(MS_GC_REGISTER))
{
- static COLORREF crCols[1] = {0};
+ static COLORREF crCols[1] = { 0 };
char szEvent[MAXMODULELABELLENGTH];
GCREGISTER gcr = { sizeof(gcr) };
gcr.dwFlags = GC_CHANMGR; // |GC_ACKMSG; // TODO: Not implemented yet
gcr.ptszDispName = _T("Skype protocol");
gcr.pszModule = SKYPE_PROTONAME;
- if (CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr))
+ if (CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr))
OUTPUT(_T("Unable to register with Groupchat module!"));
- _snprintf (szEvent, sizeof(szEvent), "%s\\ChatInit", SKYPE_PROTONAME);
+ _snprintf(szEvent, sizeof(szEvent), "%s\\ChatInit", SKYPE_PROTONAME);
hInitChat = CreateHookableEvent(szEvent);
hEvInitChat = HookEvent(szEvent, ChatInit);
hChatEvent = HookEvent(ME_GC_EVENT, GCEventHook);
hChatMenu = HookEvent(ME_GC_BUILDMENU, GCMenuHook);
- CreateServiceFunction (SKYPE_CHATNEW, SkypeChatCreate);
- CreateProtoService (PS_LEAVECHAT, GCOnLeaveChat);
- CreateProtoService (PS_JOINCHAT, GCOnJoinChat);
+ CreateServiceFunction(SKYPE_CHATNEW, SkypeChatCreate);
+ CreateProtoService(PS_LEAVECHAT, GCOnLeaveChat);
+ CreateProtoService(PS_JOINCHAT, GCOnJoinChat);
}
// Try folder service first
hProtocolAvatarsFolder = NULL;
@@ -847,83 +850,84 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { {
char *tmpPath;
- if (!ServiceExists (MS_UTILS_REPLACEVARS) || !(tmpPath = Utils_ReplaceVars("%miranda_avatarcache%")))
+ if (!ServiceExists(MS_UTILS_REPLACEVARS) || !(tmpPath = Utils_ReplaceVars("%miranda_avatarcache%")))
tmpPath = PROFILE_PATH;
mir_snprintf(DefaultAvatarsFolder, sizeof(DefaultAvatarsFolder), "%s\\%s", tmpPath, SKYPE_PROTONAME);
- hProtocolAvatarsFolder = (HANDLE) FoldersRegisterCustomPath(SKYPE_PROTONAME, "Avatars Cache", DefaultAvatarsFolder);
+ hProtocolAvatarsFolder = (HANDLE)FoldersRegisterCustomPath(SKYPE_PROTONAME, "Avatars Cache", DefaultAvatarsFolder);
}
-
+
if (hProtocolAvatarsFolder == NULL)
{
// Use defaults
- CallService(MS_DB_GETPROFILEPATH, (WPARAM) MAX_PATH, (LPARAM) DefaultAvatarsFolder);
+ CallService(MS_DB_GETPROFILEPATH, (WPARAM)MAX_PATH, (LPARAM)DefaultAvatarsFolder);
mir_snprintf(DefaultAvatarsFolder, sizeof(DefaultAvatarsFolder), "%s\\%s", DefaultAvatarsFolder, SKYPE_PROTONAME);
CreateDirectoryA(DefaultAvatarsFolder, NULL);
}
- pthread_create(( pThreadFunc )FirstLaunch, NULL);
+ pthread_create((pThreadFunc)FirstLaunch, NULL);
return 0;
}
void FetchMessageThread(fetchmsg_arg *pargs) {
- char *who=NULL, *type=NULL, *chat=NULL, *users=NULL, *msg=NULL, *status=NULL;
+ char *who = NULL, *type = NULL, *chat = NULL, *users = NULL, *msg = NULL, *status = NULL;
char *ptr, *msgptr, szPartnerHandle[32], szBuf[128];
- int direction=0, msglen = 0;
- DWORD timestamp = 0, lwr=0;
- CCSDATA ccs={0};
- PROTORECVEVENT pre={0};
+ int direction = 0, msglen = 0;
+ DWORD timestamp = 0, lwr = 0;
+ CCSDATA ccs = { 0 };
+ PROTORECVEVENT pre = { 0 };
MCONTACT hContact = NULL, hChat = NULL;
HANDLE hDbEvent;
- DBEVENTINFO dbei={0};
- DBVARIANT dbv={0};
+ DBEVENTINFO dbei = { 0 };
+ DBVARIANT dbv = { 0 };
fetchmsg_arg args;
- BOOL bEmoted=FALSE, isGroupChat=FALSE, bHasPartList=FALSE;
+ BOOL bEmoted = FALSE, isGroupChat = FALSE, bHasPartList = FALSE;
BOOL bUseGroupChat = db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0);
if (!pargs) return;
args = *pargs;
- free (pargs);
-
- sprintf (szPartnerHandle, "%s_HANDLE", cmdPartner);
+ free(pargs);
+
+ sprintf(szPartnerHandle, "%s_HANDLE", cmdPartner);
pre.lParam = strtoul(args.msgnum, NULL, 10);
if (args.bIsRead) pre.flags |= PREF_CREATEREAD;
//pEvent = MsgList_FindMessage(pre.lParam);
// Get Timestamp
if (!args.pMsgEntry || !args.pMsgEntry->tEdited) {
- if (!(ptr=SkypeGet (cmdMessage, args.msgnum, "TIMESTAMP"))) return;
- if (strncmp(ptr, "ERROR", 5)) timestamp=atol(ptr);
- else timestamp=(DWORD)SkypeTime(NULL);
+ if (!(ptr = SkypeGet(cmdMessage, args.msgnum, "TIMESTAMP"))) return;
+ if (strncmp(ptr, "ERROR", 5)) timestamp = atol(ptr);
+ else timestamp = (DWORD)SkypeTime(NULL);
free(ptr);
- } else timestamp=(DWORD)(args.pMsgEntry->tEdited);
+ }
+ else timestamp = (DWORD)(args.pMsgEntry->tEdited);
__try {
// Get Chatname (also to determine if we need to relay this to a groupchat)
- if (!(chat=SkypeGetErr (cmdMessage, args.msgnum, "CHATNAME"))) __leave;
- if (hChat = find_chatA(chat)) isGroupChat=TRUE;
+ if (!(chat = SkypeGetErr(cmdMessage, args.msgnum, "CHATNAME"))) __leave;
+ if (hChat = find_chatA(chat)) isGroupChat = TRUE;
// Get chat status
- if ((status=SkypeGetErr ("CHAT", chat, "STATUS")) &&
- !strcmp(status, "MULTI_SUBSCRIBED")) isGroupChat=TRUE;
-
+ if ((status = SkypeGetErr("CHAT", chat, "STATUS")) &&
+ !strcmp(status, "MULTI_SUBSCRIBED")) isGroupChat = TRUE;
+
// Get chat type
- if (!(type=SkypeGetErr (cmdMessage, args.msgnum, "TYPE"))) __leave;
- bEmoted = strcmp(type, "EMOTED")==0;
- if (strcmp(type, "MULTI_SUBSCRIBED")==0) isGroupChat=TRUE;
+ if (!(type = SkypeGetErr(cmdMessage, args.msgnum, "TYPE"))) __leave;
+ bEmoted = strcmp(type, "EMOTED") == 0;
+ if (strcmp(type, "MULTI_SUBSCRIBED") == 0) isGroupChat = TRUE;
// Group chat handling
if (isGroupChat && strcmp(type, "TEXT") && strcmp(type, "SAID") && strcmp(type, "UNKNOWN") && !bEmoted) {
if (bUseGroupChat) {
BOOL bAddedMembers = FALSE;
- if (!strcmp(type,"SAWMEMBERS") || !strcmp(type, "CREATEDCHATWITH"))
+ if (!strcmp(type, "SAWMEMBERS") || !strcmp(type, "CREATEDCHATWITH"))
{
// We have a new Groupchat
LOG(("FetchMessageThread CHAT SAWMEMBERS"));
if (!hChat) ChatStart(chat, FALSE);
__leave;
}
- if (!strcmp(type,"KICKED"))
+ if (!strcmp(type, "KICKED"))
{
if (!hChat) __leave;
GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_KICK };
@@ -931,29 +935,29 @@ void FetchMessageThread(fetchmsg_arg *pargs) { gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
- if (users=SkypeGetErr (cmdMessage, args.msgnum, "USERS")) {
- CONTACTINFO ci = {0};
+ if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
+ CONTACTINFO ci = { 0 };
ci.hContact = find_contact(users);
- gce.ptszUID= make_nonutf_tchar_string((const unsigned char*)users);
- if (who=SkypeGetErr (cmdMessage, args.msgnum, szPartnerHandle)) {
- gce.ptszStatus= make_nonutf_tchar_string((const unsigned char*)who);
+ gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)users);
+ if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
+ gce.ptszStatus = make_nonutf_tchar_string((const unsigned char*)who);
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
- else gce.ptszNick=gce.ptszUID;
-
+ if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) gce.ptszNick = ci.pszVal;
+ else gce.ptszNick = gce.ptszUID;
+
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- RemChatContact (GetChat(gcd.ptszID), gce.ptszUID);
+ RemChatContact(GetChat(gcd.ptszID), gce.ptszUID);
free_nonutf_tchar_string((void*)gce.ptszStatus);
- if (ci.pszVal) mir_free (ci.pszVal);
+ if (ci.pszVal) mir_free(ci.pszVal);
}
free_nonutf_tchar_string((void*)gce.ptszUID);
}
free_nonutf_tchar_string((void*)gcd.ptszID);
__leave;
}
- if (!strcmp(type,"SETROLE"))
+ if (!strcmp(type, "SETROLE"))
{
gchat_contact *gcContact;
char *pszRole;
@@ -967,70 +971,70 @@ void FetchMessageThread(fetchmsg_arg *pargs) { gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
- if (users=SkypeGetErr (cmdMessage, args.msgnum, "USERS")) {
- gce.ptszUID= make_nonutf_tchar_string((const unsigned char*)users);
- if (who=SkypeGetErr (cmdMessage, args.msgnum, szPartnerHandle)) {
- CONTACTINFO ci = {0};
+ if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
+ gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)users);
+ if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
ci.hContact = find_contact(who);
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) {
- gce.ptszText=_tcsdup(ci.pszVal);
- mir_free (ci.pszVal);
+ if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ gce.ptszText = _tcsdup(ci.pszVal);
+ mir_free(ci.pszVal);
ci.pszVal = NULL;
}
- else gce.ptszText=make_tchar_string((const unsigned char*)who);
+ else gce.ptszText = make_tchar_string((const unsigned char*)who);
ci.hContact = find_contact(users);
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
- else gce.ptszNick=gce.ptszUID;
+ if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) gce.ptszNick = ci.pszVal;
+ else gce.ptszNick = gce.ptszUID;
if (gcContact = GetChatContact(GetChat(gcd.ptszID), gce.ptszUID))
{
gce.ptszStatus = gcContact->szRole;
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
}
- if (pszRole=SkypeGetErr (cmdMessage, args.msgnum, "ROLE")) {
+ if (pszRole = SkypeGetErr(cmdMessage, args.msgnum, "ROLE")) {
gce.ptszStatus = make_nonutf_tchar_string((const unsigned char*)pszRole);
gcd.iType = GC_EVENT_ADDSTATUS;
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
free_nonutf_tchar_string((void*)gce.ptszStatus);
- free (pszRole);
+ free(pszRole);
}
free((void*)gce.ptszText);
- if (ci.pszVal) mir_free (ci.pszVal);
+ if (ci.pszVal) mir_free(ci.pszVal);
}
free_nonutf_tchar_string((void*)gce.ptszUID);
}
free_nonutf_tchar_string((void*)gcd.ptszID);
__leave;
}
- if (!strcmp(type,"SETTOPIC"))
+ if (!strcmp(type, "SETTOPIC"))
{
LOG(("FetchMessageThread CHAT SETTOPIC"));
GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_TOPIC };
GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
- if (who=SkypeGetErr (cmdMessage, args.msgnum, szPartnerHandle)) {
- CONTACTINFO ci = {0};
+ if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
+ CONTACTINFO ci = { 0 };
ci.hContact = find_contact(who);
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
- else gce.ptszNick=gce.ptszUID;
+ if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) gce.ptszNick = ci.pszVal;
+ else gce.ptszNick = gce.ptszUID;
- if (ptr=SkypeGetErr (cmdMessage, args.msgnum, "BODY")) {
+ if (ptr = SkypeGetErr(cmdMessage, args.msgnum, "BODY")) {
gce.ptszText = make_tchar_string((const unsigned char*)ptr);
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- free ((void*)gce.ptszText);
- free (ptr);
+ free((void*)gce.ptszText);
+ free(ptr);
}
- free_nonutf_tchar_string ((void*)gce.ptszUID);
- if (ci.pszVal) mir_free (ci.pszVal);
+ free_nonutf_tchar_string((void*)gce.ptszUID);
+ if (ci.pszVal) mir_free(ci.pszVal);
}
free_nonutf_tchar_string((void*)gcd.ptszID);
if (!args.bDontMarkSeen)
@@ -1040,7 +1044,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
__leave;
}
- if (!strcmp(type,"LEFT") || (bAddedMembers = strcmp(type,"ADDEDMEMBERS")==0))
+ if (!strcmp(type, "LEFT") || (bAddedMembers = strcmp(type, "ADDEDMEMBERS") == 0))
{
LOG(("FetchMessageThread CHAT LEFT or ADDEDMEMBERS"));
if (bAddedMembers) {
@@ -1048,37 +1052,37 @@ void FetchMessageThread(fetchmsg_arg *pargs) { GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
- if (users=SkypeGetErr (cmdMessage, args.msgnum, "USERS")) {
+ if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
CMString(FORMAT, _T("%S %s"), users, TranslateT("invited"));
- gce.ptszText= make_tchar_string((const unsigned char*)users);
- if (who=SkypeGetErr (cmdMessage, args.msgnum, szPartnerHandle)) {
+ gce.ptszText = make_tchar_string((const unsigned char*)users);
+ if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
DBVARIANT dbv;
- if (db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv)==0) {
- gce.bIsMe = strcmp(who, dbv.pszVal)==0;
+ if (db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0) {
+ gce.bIsMe = strcmp(who, dbv.pszVal) == 0;
db_free(&dbv);
}
- gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
+ gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
- CONTACTINFO ci = {0};
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
if (!gce.bIsMe)
ci.hContact = find_contact(who);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci))
- gce.ptszNick = ci.pszVal;
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci))
+ gce.ptszNick = ci.pszVal;
else
gce.ptszNick = gce.ptszUID;
-
+
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
free_nonutf_tchar_string((void*)gce.ptszUID);
- if (ci.pszVal) mir_free (ci.pszVal);
+ if (ci.pszVal) mir_free(ci.pszVal);
}
- if (gce.ptszText) free ((void*)gce.ptszText);
+ if (gce.ptszText) free((void*)gce.ptszText);
}
- free_nonutf_tchar_string ((void*)gcd.ptszID);
+ free_nonutf_tchar_string((void*)gcd.ptszID);
}
- if (!args.QueryMsgDirection) SkypeSend ("GET CHAT %s MEMBERS", chat);
+ if (!args.QueryMsgDirection) SkypeSend("GET CHAT %s MEMBERS", chat);
__leave;
}
}
@@ -1089,103 +1093,104 @@ void FetchMessageThread(fetchmsg_arg *pargs) { if (args.getstatus) {
char *status;
- if (protocol<4) InterlockedIncrement (&rcvwatchers);
- status=SkypeGetID(cmdMessage, args.msgnum, "STATUS");
- if (protocol<4) InterlockedDecrement (&rcvwatchers);
+ if (protocol < 4) InterlockedIncrement(&rcvwatchers);
+ status = SkypeGetID(cmdMessage, args.msgnum, "STATUS");
+ if (protocol < 4) InterlockedDecrement(&rcvwatchers);
if (!status) __leave;
- if (!strcmp(status, "SENT")) direction=DBEF_SENT;
+ if (!strcmp(status, "SENT")) direction = DBEF_SENT;
free(status);
}
// Who sent it?
- if (!(who=SkypeGetErr (cmdMessage, args.msgnum, szPartnerHandle))) __leave;
+ if (!(who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle))) __leave;
// Get contact handle
LOG(("FetchMessageThread Finding contact handle"));
db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv);
- if (dbv.pszVal && !strcmp (who, dbv.pszVal))
+ if (dbv.pszVal && !strcmp(who, dbv.pszVal))
{
char *pTok, *nextoken;
// It's from me.. But to whom?
// CHATMESSAGE .. USERS doesn't return anything, so we have to query the CHAT-Object
- if (!(ptr=SkypeGetErr ("CHAT", chat, "ACTIVEMEMBERS"))) {
- db_free (&dbv);
+ if (!(ptr = SkypeGetErr("CHAT", chat, "ACTIVEMEMBERS"))) {
+ db_free(&dbv);
__leave;
}
- for (pTok = strtok_r (ptr, " ", &nextoken); pTok; pTok=strtok_r(NULL, " ", &nextoken)) {
- if (strcmp (pTok, dbv.pszVal)) break; // Take the first dude in the list who is not me
+ for (pTok = strtok_r(ptr, " ", &nextoken); pTok; pTok = strtok_r(NULL, " ", &nextoken)) {
+ if (strcmp(pTok, dbv.pszVal)) break; // Take the first dude in the list who is not me
}
if (!pTok) {
- free (ptr);
- db_free (&dbv);
+ free(ptr);
+ db_free(&dbv);
__leave; // We failed
}
- free (who);
- who=(char *)memmove (ptr, pTok, strlen(pTok)+1);
+ free(who);
+ who = (char *)memmove(ptr, pTok, strlen(pTok) + 1);
direction = DBEF_SENT;
}
- db_free (&dbv);
+ db_free(&dbv);
- if (!(hContact=find_contact(who))) {
+ if (!(hContact = find_contact(who))) {
// Permanent adding of user obsolete, we use the BUDDYSTATUS now (bug #0000005)
ResetEvent(hBuddyAdded);
SkypeSend("GET USER %s BUDDYSTATUS", who);
WaitForSingleObject(hBuddyAdded, INFINITE);
- if (!(hContact=find_contact(who))) {
+ if (!(hContact = find_contact(who))) {
// Arrgh, the user has been deleted from contact list.
// In this case, we add him temp. to receive the msg at least.
- hContact=add_contact(who, PALF_TEMPORARY);
+ hContact = add_contact(who, PALF_TEMPORARY);
}
}
// Text which was sent (on edited msg, BODY may already be in queue, check)
- sprintf (szBuf, "GET %s %s BODY", cmdMessage, args.msgnum);
- if (!args.pMsgEntry || !args.pMsgEntry->tEdited || !(ptr=SkypeRcv(szBuf+4, 1000)))
+ sprintf(szBuf, "GET %s %s BODY", cmdMessage, args.msgnum);
+ if (!args.pMsgEntry || !args.pMsgEntry->tEdited || !(ptr = SkypeRcv(szBuf + 4, 1000)))
{
- if (SkypeSend(szBuf)==-1 || !(ptr=SkypeRcv(szBuf+4, INFINITE)))
+ if (SkypeSend(szBuf) == -1 || !(ptr = SkypeRcv(szBuf + 4, INFINITE)))
__leave;
}
if (strncmp(ptr, "ERROR", 5)) {
- msgptr = ptr+strlen(szBuf+4)+1;
- bHasPartList = strncmp(msgptr,"<partlist ",10)==0;
+ msgptr = ptr + strlen(szBuf + 4) + 1;
+ bHasPartList = strncmp(msgptr, "<partlist ", 10) == 0;
if (args.pMsgEntry && args.pMsgEntry->tEdited) {
// Mark the message as edited
if (!*msgptr && args.pMsgEntry->hEvent != INVALID_HANDLE_VALUE) {
// Empty message and edited -> Delete event
if ((int)(hContact = db_event_getContact(args.pMsgEntry->hEvent)) != -1) {
db_event_delete(hContact, args.pMsgEntry->hEvent);
- free (ptr);
+ free(ptr);
__leave;
}
- } else {
- msgptr-=9;
- memcpy (msgptr, "[EDITED] ", 9);
+ }
+ else {
+ msgptr -= 9;
+ memcpy(msgptr, "[EDITED] ", 9);
}
}
- if( bEmoted && !isGroupChat) {
- CONTACTINFO ci = {0};
+ if (bEmoted && !isGroupChat) {
+ CONTACTINFO ci = { 0 };
int newlen;
- char *pMsg, *pszUTFnick=NULL;
+ char *pMsg, *pszUTFnick = NULL;
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
if (ci.hContact = hContact) {
- CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci);
+ CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci);
if (ci.pszVal) {
#ifdef _UNICODE
pszUTFnick = (char*)make_utf8_string(ci.pszVal);
#else
utf8_encode (ci.pszVal, &pszUTFnick);
#endif
- mir_free (ci.pszVal);
+ mir_free(ci.pszVal);
}
}
- newlen = int(strlen(msgptr) + (pszUTFnick?strlen(pszUTFnick):0) + 9);
+ newlen = int(strlen(msgptr) + (pszUTFnick ? strlen(pszUTFnick) : 0) + 9);
if (pMsg = (char *)malloc(newlen)) {
- sprintf (pMsg, "** %s%s%s **", (pszUTFnick?pszUTFnick:""),(pszUTFnick?" ":""),(char*)msgptr);
- free (ptr);
+ sprintf(pMsg, "** %s%s%s **", (pszUTFnick ? pszUTFnick : ""), (pszUTFnick ? " " : ""), (char*)msgptr);
+ free(ptr);
ptr = msgptr = pMsg;
}
if (pszUTFnick) free(pszUTFnick);
@@ -1195,47 +1200,48 @@ void FetchMessageThread(fetchmsg_arg *pargs) { !isGroupChat) { // I guess Groupchat doesn't support UTF8?
msg = ptr;
pre.flags |= PREF_UTF;
- } else { // Older version has to decode either UTF8->ANSI or UTF8->UNICODE
+ }
+ else { // Older version has to decode either UTF8->ANSI or UTF8->UNICODE
// This could be replaced by mir_getUTFI - functions for Miranda 0.5+ builds, but we stay
// 0.4 compatible for backwards compatibility. Unfortunately this requires us to link with utf8.c
#ifdef _UNICODE
int wcLen;
#endif
- if (utf8_decode(msgptr, &msg)==-1) {
+ if (utf8_decode(msgptr, &msg) == -1) {
free(ptr);
__leave;
}
#ifdef _UNICODE
- msglen = (int)strlen(msg)+1;
- msgptr = (char*)make_unicode_string ((const unsigned char*)msgptr);
- wcLen = int(_tcslen((TCHAR*)msgptr)+1)*sizeof(TCHAR);
- msg=(char*)realloc(msg, msglen+wcLen);
- memcpy (msg+msglen, msgptr, wcLen);
+ msglen = (int)strlen(msg) + 1;
+ msgptr = (char*)make_unicode_string((const unsigned char*)msgptr);
+ wcLen = int(_tcslen((TCHAR*)msgptr) + 1)*sizeof(TCHAR);
+ msg = (char*)realloc(msg, msglen + wcLen);
+ memcpy(msg + msglen, msgptr, wcLen);
free(msgptr);
pre.flags |= PREF_UNICODE;
#endif
msgptr = msg;
- free (ptr);
+ free(ptr);
}
- msglen = (int)strlen(msgptr)+1;
+ msglen = (int)strlen(msgptr) + 1;
}
else {
- free (ptr);
+ free(ptr);
__leave;
}
// skype sends some xml statics after a call has finished. Check if thats the case and suppress it if necessary...
- if ((db_get_b(NULL, SKYPE_PROTONAME, "SuppressCallSummaryMessage", 1) &&
- bHasPartList) || msgptr[0]==0) __leave;
+ if ((db_get_b(NULL, SKYPE_PROTONAME, "SuppressCallSummaryMessage", 1) &&
+ bHasPartList) || msgptr[0] == 0) __leave;
if (isGroupChat && bUseGroupChat) {
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
LOG(("FetchMessageThread This is a group chat message"));
if (!hChat) ChatStart(chat, FALSE);
GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), bEmoted ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
- if ((gce.bIsMe = (direction&DBEF_SENT)?TRUE:FALSE) && db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv)==0)
+ if ((gce.bIsMe = (direction&DBEF_SENT) ? TRUE : FALSE) && db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0)
{
free(who);
who = _strdup(dbv.pszVal);
@@ -1244,19 +1250,19 @@ void FetchMessageThread(fetchmsg_arg *pargs) { gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
gce.ptszNick = gce.ptszUID;
- CONTACTINFO ci = {0};
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
ci.hContact = !gce.bIsMe ? hContact : NULL;
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci))
- gce.ptszNick = ci.pszVal;
- gce.time = timestamp > 0 ? timestamp : (DWORD)SkypeTime(NULL);
- gce.ptszText = (TCHAR*)(msgptr+msglen);
+ gce.ptszNick = ci.pszVal;
+ gce.time = timestamp > 0 ? timestamp : (DWORD)SkypeTime(NULL);
+ gce.ptszText = (TCHAR*)(msgptr + msglen);
gce.dwFlags = GCEF_ADDTOLOG;
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
MsgList_Add(pre.lParam, INVALID_HANDLE_VALUE); // Mark as groupchat
- if (ci.pszVal) mir_free (ci.pszVal);
+ if (ci.pszVal) mir_free(ci.pszVal);
free_nonutf_tchar_string((void*)gce.ptszUID);
free_nonutf_tchar_string((void*)gcd.ptszID);
@@ -1268,33 +1274,33 @@ void FetchMessageThread(fetchmsg_arg *pargs) { if (args.QueryMsgDirection || (direction&DBEF_SENT)) {
// Check if the timestamp is valid
- dbei.cbSize=sizeof(dbei);
- dbei.cbBlob=0;
+ dbei.cbSize = sizeof(dbei);
+ dbei.cbBlob = 0;
if (hDbEvent = db_event_first(hContact)) {
- db_event_get(hDbEvent,&dbei);
- lwr=dbei.timestamp;
+ db_event_get(hDbEvent, &dbei);
+ lwr = dbei.timestamp;
}
- dbei.cbSize=sizeof(dbei);
- dbei.cbBlob=0;
- dbei.timestamp=0;
- if (hDbEvent=db_event_last(hContact))
+ dbei.cbSize = sizeof(dbei);
+ dbei.cbBlob = 0;
+ dbei.timestamp = 0;
+ if (hDbEvent = db_event_last(hContact))
db_event_get(hDbEvent, &dbei);
LOG(("FetchMessageThread timestamp %ld between %ld and %ld", timestamp, lwr, dbei.timestamp));
- if (timestamp<lwr || (direction&DBEF_SENT)) {
+ if (timestamp < lwr || (direction&DBEF_SENT)) {
TYP_MSGLENTRY *pme;
LOG(("FetchMessageThread Adding event"));
- if (!(dbei.szModule=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0)))
- dbei.szModule=SKYPE_PROTONAME;
- dbei.cbBlob=msglen;
+ if (!(dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0)))
+ dbei.szModule = SKYPE_PROTONAME;
+ dbei.cbBlob = msglen;
if (pre.flags & PREF_UNICODE)
- dbei.cbBlob += sizeof(WCHAR)*( (DWORD)wcslen((WCHAR*)&msgptr[dbei.cbBlob])+1);
- dbei.pBlob=(PBYTE)msgptr;
- dbei.timestamp=timestamp>0?timestamp:(DWORD)SkypeTime(NULL);
- dbei.flags=direction;
- if (pre.flags & PREF_CREATEREAD) dbei.flags|=DBEF_READ;
- if (pre.flags & PREF_UTF) dbei.flags|=DBEF_UTF;
- dbei.eventType=EVENTTYPE_MESSAGE;
+ dbei.cbBlob += sizeof(WCHAR)*((DWORD)wcslen((WCHAR*)&msgptr[dbei.cbBlob]) + 1);
+ dbei.pBlob = (PBYTE)msgptr;
+ dbei.timestamp = timestamp > 0 ? timestamp : (DWORD)SkypeTime(NULL);
+ dbei.flags = direction;
+ if (pre.flags & PREF_CREATEREAD) dbei.flags |= DBEF_READ;
+ if (pre.flags & PREF_UTF) dbei.flags |= DBEF_UTF;
+ dbei.eventType = EVENTTYPE_MESSAGE;
pme = MsgList_Add(pre.lParam, db_event_add(hContact, &dbei));
// We could call MS_PROTO_CHAINSEND if we want to have MetaContact adding the history for us,
@@ -1307,30 +1313,30 @@ void FetchMessageThread(fetchmsg_arg *pargs) { MCONTACT hMetaContact;
if (dwMetaLink != MAXDWORD && (hMetaContact = GetMetaHandle(dwMetaLink))) {
- dbei.szModule=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hMetaContact, 0);
+ dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hMetaContact, 0);
pme->hMetaEvent = db_event_add(hMetaContact, &dbei);
}
}
- if (!args.QueryMsgDirection && !args.bDontMarkSeen)
+ if (!args.QueryMsgDirection && !args.bDontMarkSeen)
SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum);
}
}
- if (!(direction&DBEF_SENT) && (!args.QueryMsgDirection || (args.QueryMsgDirection && timestamp>dbei.timestamp))) {
+ if (!(direction&DBEF_SENT) && (!args.QueryMsgDirection || (args.QueryMsgDirection && timestamp > dbei.timestamp))) {
LOG(("FetchMessageThread Normal message add..."));
// Normal message received, process it
ccs.szProtoService = PSR_MESSAGE;
ccs.hContact = hContact;
ccs.wParam = 0;
ccs.lParam = (LPARAM)⪯
- pre.flags |= direction;
- if(isGroupChat && db_get_b(NULL, SKYPE_PROTONAME, "MarkGroupchatRead", 0))
+ pre.flags |= direction;
+ if (isGroupChat && db_get_b(NULL, SKYPE_PROTONAME, "MarkGroupchatRead", 0))
pre.flags |= PREF_CREATEREAD;
- pre.timestamp = timestamp>0?timestamp:(DWORD)SkypeTime(NULL);
+ pre.timestamp = timestamp > 0 ? timestamp : (DWORD)SkypeTime(NULL);
pre.szMessage = msgptr;
- CallServiceSync(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
+ CallServiceSync(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
// Yes, we have successfully read the msg
if (!args.bDontMarkSeen) SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum);
@@ -1342,7 +1348,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { if (users) free(users);
if (chat) free(chat);
if (type) free(type);
- if (who) free (who);
+ if (who) free(who);
}
}
@@ -1351,61 +1357,61 @@ void FetchMessageThreadSync(fetchmsg_arg *pargs) { // Secure this thread with a mutex.
// This is needed to ensure that we get called after an old msg in the queue has
// been added so that MsgList_FindEntry will find it.
- WaitForSingleObject (FetchMessageEvent, 30000); // Wait max. 30 sec. for previous message fetch to complete
+ WaitForSingleObject(FetchMessageEvent, 30000); // Wait max. 30 sec. for previous message fetch to complete
if ((pargs->pMsgEntry = MsgList_FindMessage(strtoul(pargs->msgnum, NULL, 10))) && !pargs->pMsgEntry->tEdited) {
// Better don't do this, as we set the msg as read and with this code, we would
// mark messages not opened by user as read which isn't that good
/*
if (pargs->bIsRead && pMsgEvent->hEvent != INVALID_HANDLE_VALUE)
{
- MCONTACT hContact;
- if ((int)(hContact = (MCONTACT)CallService (MS_DB_EVENT_GETCONTACT, (WPARAM)pMsgEntry->hEvent, 0)) != -1)
- CallService (MS_DB_EVENT_MARKREAD, hContact, (LPARAM)hDBEvent);
+ MCONTACT hContact;
+ if ((int)(hContact = (MCONTACT)CallService (MS_DB_EVENT_GETCONTACT, (WPARAM)pMsgEntry->hEvent, 0)) != -1)
+ CallService (MS_DB_EVENT_MARKREAD, hContact, (LPARAM)hDBEvent);
}
*/
- free (pargs);
+ free(pargs);
}
- else FetchMessageThread (pargs);
- SetEvent (FetchMessageEvent);
+ else FetchMessageThread(pargs);
+ SetEvent(FetchMessageEvent);
}
-static int MsglCmpProc(const void *pstPElement,const void *pstPToFind)
+static int MsglCmpProc(const void *pstPElement, const void *pstPToFind)
{
- return strcmp ((char*)((fetchmsg_arg*)pstPElement)->pMsgEntry, (char*)((fetchmsg_arg*)pstPToFind)->pMsgEntry);
+ return strcmp((char*)((fetchmsg_arg*)pstPElement)->pMsgEntry, (char*)((fetchmsg_arg*)pstPToFind)->pMsgEntry);
}
void MessageListProcessingThread(char *str) {
- char *token, *nextoken, *chat=NULL;
+ char *token, *nextoken, *chat = NULL;
fetchmsg_arg *args;
TYP_LIST *hListMsgs = List_Init(32);
int i, nCount;
// Frst we need to sort the message timestamps
- for ((token=strtok_r(str, ", ", &nextoken)); token; token=strtok_r(NULL, ", ", &nextoken)) {
- if (args=(fetchmsg_arg*)calloc(1, sizeof(fetchmsg_arg)+sizeof(DWORD))) {
- strncpy (args->msgnum, token, sizeof(args->msgnum));
- args->getstatus=TRUE;
- args->bIsRead=TRUE;
- args->bDontMarkSeen=TRUE;
- args->QueryMsgDirection=TRUE;
- args->pMsgEntry = (TYP_MSGLENTRY*) SkypeGet ("CHATMESSAGE", token, "TIMESTAMP");
- if (!chat) chat=SkypeGet ("CHATMESSAGE", token, "CHATNAME");
- if (args->pMsgEntry) List_InsertSort (hListMsgs, MsglCmpProc, args);
+ for ((token = strtok_r(str, ", ", &nextoken)); token; token = strtok_r(NULL, ", ", &nextoken)) {
+ if (args = (fetchmsg_arg*)calloc(1, sizeof(fetchmsg_arg) + sizeof(DWORD))) {
+ strncpy(args->msgnum, token, sizeof(args->msgnum));
+ args->getstatus = TRUE;
+ args->bIsRead = TRUE;
+ args->bDontMarkSeen = TRUE;
+ args->QueryMsgDirection = TRUE;
+ args->pMsgEntry = (TYP_MSGLENTRY*)SkypeGet("CHATMESSAGE", token, "TIMESTAMP");
+ if (!chat) chat = SkypeGet("CHATMESSAGE", token, "CHATNAME");
+ if (args->pMsgEntry) List_InsertSort(hListMsgs, MsglCmpProc, args);
else free(args);
}
}
- for (i=0, nCount=List_Count(hListMsgs); i<nCount; i++) {
- args = (fetchmsg_arg*)List_ElementAt (hListMsgs, i);
- free (args->pMsgEntry);
+ for (i = 0, nCount = List_Count(hListMsgs); i < nCount; i++) {
+ args = (fetchmsg_arg*)List_ElementAt(hListMsgs, i);
+ free(args->pMsgEntry);
args->pMsgEntry = NULL;
- FetchMessageThreadSync (args);
+ FetchMessageThreadSync(args);
}
if (chat) {
- SkypeSend ("GET CHAT %s MEMBERS", chat);
- free (chat);
+ SkypeSend("GET CHAT %s MEMBERS", chat);
+ free(chat);
}
- List_Exit (hListMsgs);
- free (str);
+ List_Exit(hListMsgs);
+ free(str);
}
char *GetCallerHandle(char *szSkypeMsg) {
@@ -1416,15 +1422,15 @@ char *GetCallerHandle(char *szSkypeMsg) { MCONTACT GetCallerContact(char *szSkypeMsg)
{
char *szHandle;
- MCONTACT hContact=NULL;
+ MCONTACT hContact = NULL;
- if (!(szHandle=GetCallerHandle(szSkypeMsg))) return NULL;
- if (!(hContact=find_contact(szHandle))) {
+ if (!(szHandle = GetCallerHandle(szSkypeMsg))) return NULL;
+ if (!(hContact = find_contact(szHandle))) {
// If it's a SkypeOut-contact, PARTNER_HANDLE = SkypeOUT number
DBVARIANT dbv;
int tCompareResult;
- for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) {
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
if (db_get_s(hContact, SKYPE_PROTONAME, "SkypeOutNr", &dbv)) continue;
tCompareResult = strcmp(dbv.pszVal, szHandle);
db_free(&dbv);
@@ -1432,48 +1438,48 @@ MCONTACT GetCallerContact(char *szSkypeMsg) }
}
free(szHandle);
- if (!hContact) {LOG(("GetCallerContact Not found!"));}
+ if (!hContact) { LOG(("GetCallerContact Not found!")); }
return hContact;
}
MCONTACT GetMetaHandle(DWORD dwId)
{
- for (MCONTACT hContact=db_find_first(); hContact != NULL; hContact=db_find_next(hContact)) {
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
char *szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(szProto, "MetaContacts") &&
- db_get_dw(hContact, "MetaContacts", "MetaID", MAXDWORD)==dwId)
+ db_get_dw(hContact, "MetaContacts", "MetaID", MAXDWORD) == dwId)
return hContact;
- }
+ }
return 0;
}
-LRESULT CALLBACK InCallPopUpProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+LRESULT CALLBACK InCallPopUpProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch (msg)
{
- case WM_COMMAND:
- break;
-
- case WM_CONTEXTMENU:
- SendMessage(hwnd,UM_DESTROYPOPUP,0,0);
- break;
- case UM_FREEPLUGINDATA:
- //Here we'd free our own data, if we had it.
- return FALSE;
- case UM_INITPOPUP:
- break;
- case UM_DESTROYPOPUP:
- break;
- case WM_NOTIFY:
- default:
- break;
- }
- return DefWindowProc(hwnd,msg,wParam,lParam);
+ case WM_COMMAND:
+ break;
+
+ case WM_CONTEXTMENU:
+ SendMessage(hwnd, UM_DESTROYPOPUP, 0, 0);
+ break;
+ case UM_FREEPLUGINDATA:
+ //Here we'd free our own data, if we had it.
+ return FALSE;
+ case UM_INITPOPUP:
+ break;
+ case UM_DESTROYPOPUP:
+ break;
+ case WM_NOTIFY:
+ default:
+ break;
+ }
+ return DefWindowProc(hwnd, msg, wParam, lParam);
}
void RingThread(char *szSkypeMsg) {
MCONTACT hContact;
- DBEVENTINFO dbei={0};
+ DBEVENTINFO dbei = { 0 };
DBVARIANT dbv;
char *ptr = NULL;
@@ -1489,37 +1495,32 @@ void RingThread(char *szSkypeMsg) { // skype doesnt accept status-changes for finished calls. The CriticalSection syncronizes
// the threads and the messages are processed in correct order.
// Not the best solution, but it works.
- EnterCriticalSection (&RingAndEndcallMutex);
+ EnterCriticalSection(&RingAndEndcallMutex);
- LOG(("RingThread started."));
- if (protocol >= 5) SkypeSend ("MINIMIZE");
- if (hContact=GetCallerContact(szSkypeMsg)) {
+ LOG(("RingThread started."));
+ if (protocol >= 5) SkypeSend("MINIMIZE");
+ if (hContact = GetCallerContact(szSkypeMsg)) {
// Make sure that an answering thread is not already in progress so that we don't get
// the 'Incoming call' event twice
if (!db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv)) {
db_free(&dbv);
- LOG(("RingThread terminated."));
+ LOG(("RingThread terminated."));
goto l_exitRT;
}
db_set_s(hContact, SKYPE_PROTONAME, "CallId", szSkypeMsg);
}
-
- if (!(ptr=SkypeGet(szSkypeMsg, "TYPE", ""))) {
- LOG(("RingThread terminated."));
+
+ if (!(ptr = SkypeGet(szSkypeMsg, "TYPE", ""))) {
+ LOG(("RingThread terminated."));
goto l_exitRT;;
}
- if (!strncmp(ptr, "INCOMING", 8))
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_RINGING);
- else
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_CALLING);
-
if (!strncmp(ptr, "INCOMING", 8)) {
if (!hContact) {
char *szHandle;
-
- if (szHandle=GetCallerHandle(szSkypeMsg)) {
- if (!(hContact=add_contact(szHandle, PALF_TEMPORARY))) {
+
+ if (szHandle = GetCallerHandle(szSkypeMsg)) {
+ if (!(hContact = add_contact(szHandle, PALF_TEMPORARY))) {
free(szHandle);
goto l_exitRT;
}
@@ -1527,33 +1528,29 @@ void RingThread(char *szSkypeMsg) { db_set_w(hContact, SKYPE_PROTONAME, "Status", (WORD)SkypeStatusToMiranda("SKYPEOUT"));
db_set_s(hContact, SKYPE_PROTONAME, "SkypeOutNr", szHandle);
free(szHandle);
- } else goto l_exitRT;
+ }
+ else goto l_exitRT;
}
}
- if (HasVoiceService()) {
- // Voice service will handle it
- goto l_exitRT;
- }
-
- dbei.cbSize=sizeof(dbei);
- dbei.eventType=EVENTTYPE_CALL;
- dbei.szModule=SKYPE_PROTONAME;
- dbei.timestamp=(DWORD)SkypeTime(NULL);
- dbei.pBlob=(unsigned char*)Translate("Phone call");
- dbei.cbBlob=strlen((const char*)dbei.pBlob)+1;
- if (!strncmp(ptr, "INCOMING", 8))
+ dbei.cbSize = sizeof(dbei);
+ dbei.eventType = EVENTTYPE_CALL;
+ dbei.szModule = SKYPE_PROTONAME;
+ dbei.timestamp = (DWORD)SkypeTime(NULL);
+ dbei.pBlob = (unsigned char*)Translate("Phone call");
+ dbei.cbBlob = strlen((const char*)dbei.pBlob) + 1;
+ if (!strncmp(ptr, "INCOMING", 8))
{
- CLISTEVENT cle={0};
+ CLISTEVENT cle = { 0 };
char toolTip[256];
- if(PopupServiceExists)
+ if (PopupServiceExists)
{
BOOL showPopup, popupWindowColor;
unsigned int popupBackColor, popupTextColor;
int popupTimeSec;
POPUPDATAT InCallPopup;
- TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,GCDNF_TCHAR);
+ TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
popupTimeSec = db_get_dw(NULL, SKYPE_PROTONAME, "popupTimeSec", 4);
popupTextColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupTextColor", GetSysColor(COLOR_WINDOWTEXT));
@@ -1562,47 +1559,47 @@ void RingThread(char *szSkypeMsg) { showPopup = (0 != db_get_b(NULL, SKYPE_PROTONAME, "showPopup", TRUE));
InCallPopup.lchContact = hContact;
- InCallPopup.lchIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALL));
- InCallPopup.colorBack = ! popupWindowColor ? popupBackColor : GetSysColor(COLOR_BTNFACE);
- InCallPopup.colorText = ! popupWindowColor ? popupTextColor : GetSysColor(COLOR_WINDOWTEXT);
+ InCallPopup.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CALL));
+ InCallPopup.colorBack = !popupWindowColor ? popupBackColor : GetSysColor(COLOR_BTNFACE);
+ InCallPopup.colorText = !popupWindowColor ? popupTextColor : GetSysColor(COLOR_WINDOWTEXT);
InCallPopup.iSeconds = popupTimeSec;
InCallPopup.PluginWindowProc = (WNDPROC)InCallPopUpProc;
InCallPopup.PluginData = (void *)1;
-
+
lstrcpy(InCallPopup.lptzText, TranslateT("Incoming Skype Call"));
lstrcpy(InCallPopup.lptzContactName, lpzContactName);
- if(showPopup)
- CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&InCallPopup,0);
+ if (showPopup)
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&InCallPopup, 0);
}
- cle.cbSize=sizeof(cle);
- cle.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALL));
- cle.pszService=SKYPE_ANSWERCALL;
- dbei.flags=DBEF_READ;
- cle.hContact=hContact;
- cle.hDbEvent=db_event_add(hContact, &dbei);
- _snprintf(toolTip,sizeof(toolTip),Translate("Incoming call from %s"),(char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,0));
- cle.pszTooltip=toolTip;
- CallServiceSync(MS_CLIST_ADDEVENT,0,(LPARAM)&cle);
- }
- else
+ cle.cbSize = sizeof(cle);
+ cle.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CALL));
+ cle.pszService = SKYPE_ANSWERCALL;
+ dbei.flags = DBEF_READ;
+ cle.hContact = hContact;
+ cle.hDbEvent = db_event_add(hContact, &dbei);
+ _snprintf(toolTip, sizeof(toolTip), Translate("Incoming call from %s"), (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0));
+ cle.pszTooltip = toolTip;
+ CallServiceSync(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
+ }
+ else
{
- dbei.flags=DBEF_SENT;
+ dbei.flags = DBEF_SENT;
db_event_add(hContact, &dbei);
}
l_exitRT:
- if (ptr) free (ptr);
+ if (ptr) free(ptr);
free(szSkypeMsg);
- LeaveCriticalSection (&RingAndEndcallMutex);
+ LeaveCriticalSection(&RingAndEndcallMutex);
}
void EndCallThread(char *szSkypeMsg) {
- MCONTACT hContact=NULL;
+ MCONTACT hContact = NULL;
HANDLE hDbEvent;
- DBEVENTINFO dbei={0};
+ DBEVENTINFO dbei = { 0 };
DBVARIANT dbv;
int tCompareResult;
@@ -1618,11 +1615,11 @@ void EndCallThread(char *szSkypeMsg) { // skype doesnt accept status-changes for finished calls. The CriticalSection syncronizes
// the threads and the messages are processed in correct order.
// Not the best solution, but it works.
- EnterCriticalSection (&RingAndEndcallMutex);
+ EnterCriticalSection(&RingAndEndcallMutex);
- LOG(("EndCallThread started."));
+ LOG(("EndCallThread started."));
if (szSkypeMsg) {
- for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) {
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
if (db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv)) continue;
tCompareResult = strcmp(dbv.pszVal, szSkypeMsg);
db_free(&dbv);
@@ -1631,48 +1628,43 @@ void EndCallThread(char *szSkypeMsg) { }
if (hContact)
{
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_ENDED);
-
db_unset(hContact, SKYPE_PROTONAME, "CallId");
- if (!HasVoiceService()) {
- dbei.cbSize=sizeof(dbei);
- hDbEvent = db_event_firstUnread(hContact);
- while(hDbEvent) {
- dbei.cbBlob=0;
- db_event_get(hDbEvent, &dbei);
- if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType==EVENTTYPE_CALL) {
- db_event_markRead(hContact,hDbEvent);
- CallService(MS_CLIST_REMOVEEVENT,hContact,(LPARAM)hDbEvent);
- }
- free(dbei.pBlob);
- hDbEvent=db_event_next(hContact, hDbEvent);
+ dbei.cbSize = sizeof(dbei);
+ hDbEvent = db_event_firstUnread(hContact);
+ while (hDbEvent) {
+ dbei.cbBlob = 0;
+ db_event_get(hDbEvent, &dbei);
+ if (!(dbei.flags&(DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_CALL) {
+ db_event_markRead(hContact, hDbEvent);
+ CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)hDbEvent);
}
+ free(dbei.pBlob);
+ hDbEvent = db_event_next(hContact, hDbEvent);
}
if (!db_get_s(hContact, SKYPE_PROTONAME, "SkypeOutNr", &dbv)) {
db_free(&dbv);
- if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0), SKYPE_PROTONAME) &&
+ if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0), SKYPE_PROTONAME) &&
db_get_b(hContact, "CList", "NotOnList", 0)
- )
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ )
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
}
}
free(szSkypeMsg);
- LeaveCriticalSection (&RingAndEndcallMutex);
+ LeaveCriticalSection(&RingAndEndcallMutex);
}
void HoldCallThread(char *szSkypeMsg) {
MCONTACT hContact;
LOG(("HoldCallThread started"));
- if (!szSkypeMsg) {
+ if (!szSkypeMsg) {
LOG(("HoldCallThread terminated."));
return;
}
- if (hContact=GetCallerContact(szSkypeMsg)) {
+ if (hContact = GetCallerContact(szSkypeMsg)) {
db_set_b(hContact, SKYPE_PROTONAME, "OnHold", 1);
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_ON_HOLD);
}
free(szSkypeMsg);
LOG(("HoldCallThread terminated gracefully"));
@@ -1686,117 +1678,117 @@ void ResumeCallThread(char *szSkypeMsg) { LOG(("ResumeCallThread terminated."));
return;
}
- if (hContact=GetCallerContact(szSkypeMsg)) {
+ if (hContact = GetCallerContact(szSkypeMsg)) {
db_unset(hContact, SKYPE_PROTONAME, "OnHold");
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_TALKING);
}
free(szSkypeMsg);
- LOG(("ResumeCallThread terminated gracefully."));
+ LOG(("ResumeCallThread terminated gracefully."));
}
int SetUserStatus(void) {
- if (RequestedStatus && AttachStatus!=-1) {
- if (SkypeSend("SET USERSTATUS %s", RequestedStatus)==-1) return 1;
- }
- return 0;
+ if (RequestedStatus && AttachStatus != -1) {
+ if (SkypeSend("SET USERSTATUS %s", RequestedStatus) == -1) return 1;
+ }
+ return 0;
}
void LaunchSkypeAndSetStatusThread(void *newStatus) {
-/* if (!db_get_b(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0)) {
- logoff_contacts();
- return 1;
- }
-*/
- int oldStatus=SkypeStatus;
+ /* if (!db_get_b(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0)) {
+ logoff_contacts();
+ return 1;
+ }
+ */
+ int oldStatus = SkypeStatus;
static BOOL bLaunching = FALSE;
UNREFERENCED_PARAMETER(newStatus);
if (bLaunching) return;
bLaunching = TRUE;
- LOG (("LaunchSkypeAndSetStatusThread started."));
+ LOG(("LaunchSkypeAndSetStatusThread started."));
InterlockedExchange((long *)&SkypeStatus, (int)ID_STATUS_CONNECTING);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, SkypeStatus);
-
- if (ConnectToSkypeAPI(skype_path, 1)!=-1) {
- pthread_create(( pThreadFunc )SkypeSystemInit, NULL);
+ ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, SkypeStatus);
+
+ if (ConnectToSkypeAPI(skype_path, 1) != -1) {
+ pthread_create((pThreadFunc)SkypeSystemInit, NULL);
//InterlockedExchange((long *)&SkypeStatus, (int)newStatus);
//ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, SkypeStatus);
SetUserStatus();
}
- LOG (("LaunchSkypeAndSetStatusThread terminated gracefully."));
+ LOG(("LaunchSkypeAndSetStatusThread terminated gracefully."));
bLaunching = FALSE;
}
-LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
-{
- PCOPYDATASTRUCT CopyData;
- char *ptr, *szSkypeMsg=NULL, *nick, *buf;
- static char *onlinestatus=NULL;
- static BOOL RestoreUserStatus=FALSE;
+LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
+{
+ PCOPYDATASTRUCT CopyData;
+ char *ptr, *szSkypeMsg = NULL, *nick, *buf;
+ static char *onlinestatus = NULL;
+ static BOOL RestoreUserStatus = FALSE;
int sstat, oldstatus, flag;
MCONTACT hContact;
fetchmsg_arg *args;
static int iReentranceCnt = 0;
iReentranceCnt++;
- switch (message)
- {
- case WM_COPYDATA:
- LOG(("WM_COPYDATA start"));
- if(hSkypeWnd==(HWND)wParam) {
+ switch (message)
+ {
+ case WM_COPYDATA:
+ LOG(("WM_COPYDATA start"));
+ if (hSkypeWnd == (HWND)wParam) {
char *pData;
- CopyData=(PCOPYDATASTRUCT)lParam;
+ CopyData = (PCOPYDATASTRUCT)lParam;
pData = (char*)CopyData->lpData;
- while (*pData==' ') pData++;
- szSkypeMsg=_strdup((char*)pData);
+ while (*pData == ' ') pData++;
+ szSkypeMsg = _strdup((char*)pData);
ReplyMessage(1);
LOG(("< %s", szSkypeMsg));
- if (!strncmp(szSkypeMsg, "CONNSTATUS", 10)) {
- if (!strncmp(szSkypeMsg+11, "LOGGEDOUT", 9)) {
- SkypeInitialized=FALSE;
+ if (!strncmp(szSkypeMsg, "CONNSTATUS", 10)) {
+ if (!strncmp(szSkypeMsg + 11, "LOGGEDOUT", 9)) {
+ SkypeInitialized = FALSE;
ResetEvent(SkypeReady);
- AttachStatus=-1;
- sstat=ID_STATUS_OFFLINE;
- if (g_hWnd) KillTimer (g_hWnd, 1);
+ AttachStatus = -1;
+ sstat = ID_STATUS_OFFLINE;
+ if (g_hWnd) KillTimer(g_hWnd, 1);
logoff_contacts(TRUE);
- } else
- sstat=SkypeStatusToMiranda(szSkypeMsg+11);
+ }
+ else
+ sstat = SkypeStatusToMiranda(szSkypeMsg + 11);
if (sstat) {
- oldstatus=SkypeStatus;
+ oldstatus = SkypeStatus;
InterlockedExchange((long*)&SkypeStatus, sstat);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
- if (sstat!=ID_STATUS_OFFLINE) {
- if (sstat!=ID_STATUS_CONNECTING && (oldstatus==ID_STATUS_OFFLINE || oldstatus==ID_STATUS_CONNECTING)) {
+ ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, SkypeStatus);
+ if (sstat != ID_STATUS_OFFLINE) {
+ if (sstat != ID_STATUS_CONNECTING && (oldstatus == ID_STATUS_OFFLINE || oldstatus == ID_STATUS_CONNECTING)) {
- SkypeInitialized=FALSE;
- pthread_create(( pThreadFunc )SkypeSystemInit, NULL);
+ SkypeInitialized = FALSE;
+ pthread_create((pThreadFunc)SkypeSystemInit, NULL);
}
- if (db_get_b(NULL, SKYPE_PROTONAME, "KeepState", 0)) RestoreUserStatus=TRUE;
+ if (db_get_b(NULL, SKYPE_PROTONAME, "KeepState", 0)) RestoreUserStatus = TRUE;
}
-// if (SkypeStatus==ID_STATUS_ONLINE) SkypeSend("SEARCH MISSEDMESSAGES");
+ // if (SkypeStatus==ID_STATUS_ONLINE) SkypeSend("SEARCH MISSEDMESSAGES");
}
-// break;
+ // break;
}
if (!strncmp(szSkypeMsg, "USERSTATUS", 10)) {
-// if ((sstat=SkypeStatusToMiranda(szSkypeMsg+11)) && SkypeStatus!=ID_STATUS_CONNECTING) {
- if ((sstat=SkypeStatusToMiranda(szSkypeMsg+11))) {
- if (RestoreUserStatus && RequestedStatus) {
- RestoreUserStatus=FALSE;
- SkypeSend ("SET USERSTATUS %s", RequestedStatus);
- }
- oldstatus=SkypeStatus;
- InterlockedExchange((long*)&SkypeStatus, sstat);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, sstat);
+ // if ((sstat=SkypeStatusToMiranda(szSkypeMsg+11)) && SkypeStatus!=ID_STATUS_CONNECTING) {
+ if ((sstat = SkypeStatusToMiranda(szSkypeMsg + 11))) {
+ if (RestoreUserStatus && RequestedStatus) {
+ RestoreUserStatus = FALSE;
+ SkypeSend("SET USERSTATUS %s", RequestedStatus);
+ }
+ oldstatus = SkypeStatus;
+ InterlockedExchange((long*)&SkypeStatus, sstat);
+ ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, sstat);
#ifdef SKYPEBUG_OFFLN
- if ((oldstatus==ID_STATUS_OFFLINE || oldstatus==ID_STATUS_CONNECTING) &&
- SkypeStatus!=ID_STATUS_CONNECTING && SkypeStatus!=ID_STATUS_OFFLINE)
- pthread_create(( pThreadFunc )SearchFriendsThread, NULL);
+ if ((oldstatus == ID_STATUS_OFFLINE || oldstatus == ID_STATUS_CONNECTING) &&
+ SkypeStatus != ID_STATUS_CONNECTING && SkypeStatus != ID_STATUS_OFFLINE)
+ pthread_create((pThreadFunc)SearchFriendsThread, NULL);
#endif
}
#ifdef SKYPEBUG_OFFLN
@@ -1807,35 +1799,35 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) if (!strncmp(szSkypeMsg, "APPLICATION libpurple_typing", 28)) {
char *nextoken, *p;
- if (p=strtok_r(szSkypeMsg+29, " ", &nextoken))
+ if (p = strtok_r(szSkypeMsg + 29, " ", &nextoken))
{
- if (!strcmp (p, "STREAMS")) {
+ if (!strcmp(p, "STREAMS")) {
char *pStr;
- while (p=strtok_r(NULL, " ", &nextoken)) {
+ while (p = strtok_r(NULL, " ", &nextoken)) {
if (pStr = strchr(p, ':')) {
- *pStr=0;
- if (hContact=find_contact(p)) {
- *pStr=':';
+ *pStr = 0;
+ if (hContact = find_contact(p)) {
+ *pStr = ':';
db_set_s(hContact, SKYPE_PROTONAME, "Typing_Stream", p);
}
}
}
}
- else if (!strcmp (p, "DATAGRAM")) {
- if (p=strtok_r(NULL, " ", &nextoken)) {
+ else if (!strcmp(p, "DATAGRAM")) {
+ if (p = strtok_r(NULL, " ", &nextoken)) {
char *pStr;
if (pStr = strchr(p, ':')) {
- *pStr=0;
- if (hContact=find_contact(p)) {
- *pStr=':';
+ *pStr = 0;
+ if (hContact = find_contact(p)) {
+ *pStr = ':';
db_set_s(hContact, SKYPE_PROTONAME, "Typing_Stream", p);
- if (p=strtok_r(NULL, " ", &nextoken)) {
+ if (p = strtok_r(NULL, " ", &nextoken)) {
LPARAM lTyping = PROTOTYPE_CONTACTTYPING_OFF;
- if (!strcmp(p, "PURPLE_TYPING")) lTyping=PROTOTYPE_CONTACTTYPING_INFINITE;
+ if (!strcmp(p, "PURPLE_TYPING")) lTyping = PROTOTYPE_CONTACTTYPING_INFINITE;
CallService(MS_PROTO_CONTACTISTYPING, hContact, lTyping);
break;
}
@@ -1848,28 +1840,28 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) if (!strncmp(szSkypeMsg, "USER ", 5)) {
char *nextoken;
- buf=_strdup(szSkypeMsg+5);
- nick=strtok_r(buf, " ", &nextoken);
- ptr=strtok_r(NULL, " ", &nextoken);
+ buf = _strdup(szSkypeMsg + 5);
+ nick = strtok_r(buf, " ", &nextoken);
+ ptr = strtok_r(NULL, " ", &nextoken);
if (strcmp(ptr, "BUDDYSTATUS")) {
if (!strcmp(ptr, "RECEIVEDAUTHREQUEST")) {
- pthread_create(( pThreadFunc )SearchUsersWaitingMyAuthorization, NULL);
- free (buf);
+ pthread_create((pThreadFunc)SearchUsersWaitingMyAuthorization, NULL);
+ free(buf);
break;
}
- if (!(hContact=find_contact(nick)) && strcmp(ptr, "FULLNAME")) {
+ if (!(hContact = find_contact(nick)) && strcmp(ptr, "FULLNAME")) {
SkypeSend("GET USER %s BUDDYSTATUS", nick);
- free (buf);
+ free(buf);
break;
- }
+ }
if (!strcmp(ptr, "ONLINESTATUS")) {
- if (SkypeStatus!=ID_STATUS_OFFLINE)
+ if (SkypeStatus != ID_STATUS_OFFLINE)
{
- db_set_w(hContact, SKYPE_PROTONAME, "Status", (WORD)SkypeStatusToMiranda(ptr+13));
- if((WORD)SkypeStatusToMiranda(ptr+13) != ID_STATUS_OFFLINE)
+ db_set_w(hContact, SKYPE_PROTONAME, "Status", (WORD)SkypeStatusToMiranda(ptr + 13));
+ if ((WORD)SkypeStatusToMiranda(ptr + 13) != ID_STATUS_OFFLINE)
{
LOG(("WndProc Status is not offline so get user info"));
pthread_create(GetInfoThread, (void*)hContact);
@@ -1891,7 +1883,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) * If we don't remove the ERRORs from the list, another consumer may see the ERROR
* as a reply to his query and process it.
* In case the SKYPE Protocol really broadcasts one of these messages without being
- * requested by GetInfoThread (i.e. MOOD_TEXT), the garbage collector will take
+ * requested by GetInfoThread (i.e. MOOD_TEXT), the garbage collector will take
* care of them and remove them after some time.
* This may not be the most efficient way, but ensures that we finally do proper
* error handling.
@@ -1902,56 +1894,64 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) if (nm = strtok_r(NULL, " ", &nextoken))
{
db_set_utf(hContact, SKYPE_PROTONAME, "FirstName", nm);
- if (!(nm=strtok_r(NULL, "", &nextoken))) db_unset(hContact, SKYPE_PROTONAME, "LastName");
- else
+ if (!(nm = strtok_r(NULL, "", &nextoken))) db_unset(hContact, SKYPE_PROTONAME, "LastName");
+ else
db_set_utf(hContact, SKYPE_PROTONAME, "LastName", nm);
}
- } else
- if (!strcmp(ptr, "BIRTHDAY")) {
+ }
+ else
+ if (!strcmp(ptr, "BIRTHDAY")) {
unsigned int y, m, d;
- if (sscanf(ptr+9, "%04d%02d%02d", &y, &m, &d)==3) {
+ if (sscanf(ptr + 9, "%04d%02d%02d", &y, &m, &d) == 3) {
db_set_w(hContact, SKYPE_PROTONAME, "BirthYear", (WORD)y);
db_set_b(hContact, SKYPE_PROTONAME, "BirthMonth", (BYTE)m);
db_set_b(hContact, SKYPE_PROTONAME, "BirthDay", (BYTE)d);
- } else {
+ }
+ else {
db_unset(hContact, SKYPE_PROTONAME, "BirthYear");
db_unset(hContact, SKYPE_PROTONAME, "BirthMonth");
db_unset(hContact, SKYPE_PROTONAME, "BirthDay");
}
- } else
- if (!strcmp(ptr, "COUNTRY")) {
+ }
+ else
+ if (!strcmp(ptr, "COUNTRY")) {
if (ptr[8]) {
struct CountryListEntry *countries;
int countryCount, i;
CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries);
- for (i=0; i<countryCount; i++) {
+ for (i = 0; i < countryCount; i++) {
if (countries[i].id == 0 || countries[i].id == 0xFFFF) continue;
- if (!_stricmp(countries[i].szName, ptr+8))
+ if (!_stricmp(countries[i].szName, ptr + 8))
{
db_set_w(hContact, SKYPE_PROTONAME, "Country", (BYTE)countries[i].id);
break;
}
}
- } else db_unset(hContact, SKYPE_PROTONAME, "Country");
- } else
- if (!strcmp(ptr, "SEX")) {
+ }
+ else db_unset(hContact, SKYPE_PROTONAME, "Country");
+ }
+ else
+ if (!strcmp(ptr, "SEX")) {
if (ptr[4]) {
- BYTE sex=0;
- if (!_stricmp(ptr+4, "MALE")) sex=0x4D;
- if (!_stricmp(ptr+4, "FEMALE")) sex=0x46;
+ BYTE sex = 0;
+ if (!_stricmp(ptr + 4, "MALE")) sex = 0x4D;
+ if (!_stricmp(ptr + 4, "FEMALE")) sex = 0x46;
if (sex) db_set_b(hContact, SKYPE_PROTONAME, "Gender", sex);
- } else db_unset(hContact, SKYPE_PROTONAME, "Gender");
- } else
- if (!strcmp(ptr, "MOOD_TEXT")){
+ }
+ else db_unset(hContact, SKYPE_PROTONAME, "Gender");
+ }
+ else
+ if (!strcmp(ptr, "MOOD_TEXT")){
LOG(("WndProc MOOD_TEXT"));
- db_set_utf(hContact, "CList", "StatusMsg", ptr+10);
- } else
- if (!strcmp(ptr, "TIMEZONE")){
+ db_set_utf(hContact, "CList", "StatusMsg", ptr + 10);
+ }
+ else
+ if (!strcmp(ptr, "TIMEZONE")){
time_t temp;
struct tm tms;
- int value=atoi(ptr+9), tz;
+ int value = atoi(ptr + 9), tz;
LOG(("WndProc: TIMEZONE %s", nick));
@@ -1960,59 +1960,65 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) tms = *localtime(&temp);
//memcpy(&tms,localtime(&temp), sizeof(tm));
//tms = localtime(&temp)
- tz=(value >= 86400 )?(256-((2*(atoi(ptr+9)-86400))/3600)):((-2*(atoi(ptr+9)-86400))/3600);
- if (tms.tm_isdst == 1 && db_get_b(NULL, SKYPE_PROTONAME, "UseTimeZonePatch", 0))
+ tz = (value >= 86400) ? (256 - ((2 * (atoi(ptr + 9) - 86400)) / 3600)) : ((-2 * (atoi(ptr + 9) - 86400)) / 3600);
+ if (tms.tm_isdst == 1 && db_get_b(NULL, SKYPE_PROTONAME, "UseTimeZonePatch", 0))
{
LOG(("WndProc: Using the TimeZonePatch"));
- db_set_b(hContact, "UserInfo", "Timezone", (BYTE)(tz+2));
+ db_set_b(hContact, "UserInfo", "Timezone", (BYTE)(tz + 2));
}
else
{
LOG(("WndProc: Not using the TimeZonePatch"));
- db_set_b(hContact, "UserInfo", "Timezone", (BYTE)(tz+0));
+ db_set_b(hContact, "UserInfo", "Timezone", (BYTE)(tz + 0));
}
- } else {
+ }
+ else {
LOG(("WndProc: Deleting the TimeZone in UserInfo Section"));
db_unset(hContact, "UserInfo", "Timezone");
}
- } else
- if (!strcmp(ptr, "IS_VIDEO_CAPABLE")){
+ }
+ else
+ if (!strcmp(ptr, "IS_VIDEO_CAPABLE")){
if (!_stricmp(ptr + 17, "True"))
db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype 2.0");
else
db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype");
- } else
- if (!strcmp(ptr, "RICH_MOOD_TEXT")) {
+ }
+ else
+ if (!strcmp(ptr, "RICH_MOOD_TEXT")) {
db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype 3.0");
- } else
- if (!strcmp(ptr, "DISPLAYNAME")) {
+ }
+ else
+ if (!strcmp(ptr, "DISPLAYNAME")) {
// Skype Bug? -> If nickname isn't customised in the Skype-App, this won't return anything :-(
- if (ptr[12])
- db_set_utf(hContact, SKYPE_PROTONAME, "Nick", ptr+12);
- } else // Other proerties that can be directly assigned to a DB-Value
- {
- int i;
- char *pszProp;
-
- for (i=0; i<sizeof(m_settings)/sizeof(m_settings[0]); i++) {
- if (!strcmp(ptr, m_settings[i].SkypeSetting)) {
- pszProp = ptr+strlen(m_settings[i].SkypeSetting)+1;
- if (*pszProp)
- db_set_utf(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting, pszProp);
- else
- db_unset(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting);
- }
- }
- }
- } else { // BUDDYSTATUS:
- flag=0;
- switch(atoi(ptr+12)) {
- case 1: if (hContact=find_contact(nick)) CallService(MS_DB_CONTACT_DELETE, hContact, 0); break;
- case 0: break;
- case 2: flag=PALF_TEMPORARY;
- case 3: add_contact(nick, flag);
- SkypeSend("GET USER %s ONLINESTATUS", nick);
- break;
+ if (ptr[12])
+ db_set_utf(hContact, SKYPE_PROTONAME, "Nick", ptr + 12);
+ }
+ else // Other proerties that can be directly assigned to a DB-Value
+ {
+ int i;
+ char *pszProp;
+
+ for (i = 0; i < sizeof(m_settings) / sizeof(m_settings[0]); i++) {
+ if (!strcmp(ptr, m_settings[i].SkypeSetting)) {
+ pszProp = ptr + strlen(m_settings[i].SkypeSetting) + 1;
+ if (*pszProp)
+ db_set_utf(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting, pszProp);
+ else
+ db_unset(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting);
+ }
+ }
+ }
+ }
+ else { // BUDDYSTATUS:
+ flag = 0;
+ switch (atoi(ptr + 12)) {
+ case 1: if (hContact = find_contact(nick)) CallService(MS_DB_CONTACT_DELETE, hContact, 0); break;
+ case 0: break;
+ case 2: flag = PALF_TEMPORARY;
+ case 3: add_contact(nick, flag);
+ SkypeSend("GET USER %s ONLINESTATUS", nick);
+ break;
}
free(buf);
if (!SetEvent(hBuddyAdded)) TellError(GetLastError());
@@ -2021,20 +2027,20 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) free(buf);
}
if (!strncmp(szSkypeMsg, "CURRENTUSERHANDLE", 17)) { // My username
- DBVARIANT dbv={0};
+ DBVARIANT dbv = { 0 };
- if(db_get_s(NULL,SKYPE_PROTONAME,"LoginUserName",&dbv) ||
- !*dbv.pszVal || _stricmp (szSkypeMsg+18, dbv.pszVal)==0)
+ if (db_get_s(NULL, SKYPE_PROTONAME, "LoginUserName", &dbv) ||
+ !*dbv.pszVal || _stricmp(szSkypeMsg + 18, dbv.pszVal) == 0)
{
- db_set_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, szSkypeMsg+18);
- db_set_s(NULL, SKYPE_PROTONAME, "Nick", szSkypeMsg+18);
- pthread_create(( pThreadFunc )GetDisplaynameThread, NULL);
+ db_set_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, szSkypeMsg + 18);
+ db_set_s(NULL, SKYPE_PROTONAME, "Nick", szSkypeMsg + 18);
+ pthread_create((pThreadFunc)GetDisplaynameThread, NULL);
}
if (dbv.pszVal) db_free(&dbv);
}
- if (strstr(szSkypeMsg, "AUTOAWAY") || !strncmp(szSkypeMsg, "OPEN ",5) ||
- (SkypeInitialized && !strncmp (szSkypeMsg, "PONG", 4)) ||
- !strncmp (szSkypeMsg, "MINIMIZE", 8))
+ if (strstr(szSkypeMsg, "AUTOAWAY") || !strncmp(szSkypeMsg, "OPEN ", 5) ||
+ (SkypeInitialized && !strncmp(szSkypeMsg, "PONG", 4)) ||
+ !strncmp(szSkypeMsg, "MINIMIZE", 8))
{
// Currently we do not process these messages
break;
@@ -2042,122 +2048,127 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) if (!strncmp(szSkypeMsg, "CHAT ", 5)) {
// Currently we only process these notifications
if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0) &&
- (ptr = strchr (szSkypeMsg, ' ')) && (ptr = strchr (++ptr, ' ')))
+ (ptr = strchr(szSkypeMsg, ' ')) && (ptr = strchr(++ptr, ' ')))
{
if (strncmp(ptr, " MEMBERS", 8) == 0) {
LOG(("WndProc AddMembers"));
- pthread_create(( pThreadFunc )AddMembersThread, _strdup(szSkypeMsg));
- } else
- if (strncmp(ptr, " FRIENDLYNAME ", 14) == 0) {
+ pthread_create((pThreadFunc)AddMembersThread, _strdup(szSkypeMsg));
+ }
+ else
+ if (strncmp(ptr, " FRIENDLYNAME ", 14) == 0) {
// Chat session name
MCONTACT hContact;
- *ptr=0;
- if (hContact = find_chatA(szSkypeMsg+5))
+ *ptr = 0;
+ if (hContact = find_chatA(szSkypeMsg + 5))
{
if (db_get_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE) !=
ID_STATUS_OFFLINE)
{
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)szSkypeMsg+5), GC_EVENT_CHANGESESSIONAME };
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)szSkypeMsg + 5), GC_EVENT_CHANGESESSIONAME };
GCEVENT gce = { sizeof(gce), &gcd };
- gce.ptszText = make_tchar_string((const unsigned char*)ptr+14);
+ gce.ptszText = make_tchar_string((const unsigned char*)ptr + 14);
if (gce.ptszText) {
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- db_set_ts (hContact, SKYPE_PROTONAME, "Nick", gce.ptszText);
+ db_set_ts(hContact, SKYPE_PROTONAME, "Nick", gce.ptszText);
free((void*)gce.ptszText);
}
free_nonutf_tchar_string((void*)gcd.ptszID);
}
}
- *ptr=' ';
- } else
- if (strncmp(ptr, " CHATMESSAGES ", 14) == 0) {
- pthread_create(( pThreadFunc )MessageListProcessingThread, _strdup(ptr+14));
+ *ptr = ' ';
+ }
+ else
+ if (strncmp(ptr, " CHATMESSAGES ", 14) == 0) {
+ pthread_create((pThreadFunc)MessageListProcessingThread, _strdup(ptr + 14));
break;
- }
+ }
}
}
- if (!strncmp(szSkypeMsg, "CALL ",5)) {
+ if (!strncmp(szSkypeMsg, "CALL ", 5)) {
// incoming calls are already processed by Skype, so no need for us
// to do this.
// However we can give a user the possibility to hang up a call via Miranda's
// context menu
- if (ptr=strstr(szSkypeMsg, " STATUS ")) {
- ptr[0]=0; ptr+=8;
- if (!strcmp(ptr, "RINGING") || !strcmp(ptr, "ROUTING")) pthread_create(( pThreadFunc )RingThread, _strdup(szSkypeMsg));
+ if (ptr = strstr(szSkypeMsg, " STATUS ")) {
+ ptr[0] = 0; ptr += 8;
+ if (!strcmp(ptr, "RINGING") || !strcmp(ptr, "ROUTING")) pthread_create((pThreadFunc)RingThread, _strdup(szSkypeMsg));
if (!strcmp(ptr, "FAILED") || !strcmp(ptr, "FINISHED") ||
- !strcmp(ptr, "MISSED") || !strcmp(ptr, "REFUSED") ||
- !strcmp(ptr, "BUSY") || !strcmp(ptr, "CANCELLED"))
- pthread_create(( pThreadFunc )EndCallThread, _strdup(szSkypeMsg));
+ !strcmp(ptr, "MISSED") || !strcmp(ptr, "REFUSED") ||
+ !strcmp(ptr, "BUSY") || !strcmp(ptr, "CANCELLED"))
+ pthread_create((pThreadFunc)EndCallThread, _strdup(szSkypeMsg));
if (!strcmp(ptr, "ONHOLD") || !strcmp(ptr, "LOCALHOLD") ||
- !strcmp(ptr, "REMOTEHOLD")) pthread_create(( pThreadFunc )HoldCallThread, _strdup(szSkypeMsg));
- if (!strcmp(ptr, "INPROGRESS")) pthread_create(( pThreadFunc )ResumeCallThread, _strdup(szSkypeMsg));
+ !strcmp(ptr, "REMOTEHOLD")) pthread_create((pThreadFunc)HoldCallThread, _strdup(szSkypeMsg));
+ if (!strcmp(ptr, "INPROGRESS")) pthread_create((pThreadFunc)ResumeCallThread, _strdup(szSkypeMsg));
break;
- } else if ((!strstr(szSkypeMsg, "PARTNER_HANDLE") && !strstr(szSkypeMsg, "FROM_HANDLE"))
- && !strstr(szSkypeMsg, "TYPE")) break;
+ }
+ else if ((!strstr(szSkypeMsg, "PARTNER_HANDLE") && !strstr(szSkypeMsg, "FROM_HANDLE"))
+ && !strstr(szSkypeMsg, "TYPE")) break;
}
if (!strncmp(szSkypeMsg, "PRIVILEGE SKYPEOUT", 18)) {
- if (!strncmp(szSkypeMsg+19, "TRUE", 4)) {
+ if (!strncmp(szSkypeMsg + 19, "TRUE", 4)) {
if (!bSkypeOut) {
- CLISTMENUITEM mi={0};
-
- bSkypeOut=TRUE;
- mi.cbSize=sizeof(mi);
- mi.position=-2000005000;
- mi.flags=0;
- mi.hIcon=LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALLSKYPEOUT));
- mi.pszContactOwner=SKYPE_PROTONAME;
- mi.pszName=Translate("Do a SkypeOut-call");
- mi.pszService=SKYPEOUT_CALL;
+ CLISTMENUITEM mi = { 0 };
+
+ bSkypeOut = TRUE;
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000005000;
+ mi.flags = 0;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CALLSKYPEOUT));
+ mi.pszContactOwner = SKYPE_PROTONAME;
+ mi.pszName = Translate("Do a SkypeOut-call");
+ mi.pszService = SKYPEOUT_CALL;
Menu_AddMainMenuItem(&mi);
}
- } else {
- bSkypeOut=FALSE;
+ }
+ else {
+ bSkypeOut = FALSE;
if (httbButton) {
CallService(MS_TTB_REMOVEBUTTON, (WPARAM)httbButton, 0);
- httbButton=0;
+ httbButton = 0;
}
}
break;
}
if (!strncmp(szSkypeMsg, "MESSAGES", 8) || !strncmp(szSkypeMsg, "CHATMESSAGES", 12)) {
- if (strlen(szSkypeMsg)<=(UINT)(strchr(szSkypeMsg, ' ')-szSkypeMsg+1))
+ if (strlen(szSkypeMsg) <= (UINT)(strchr(szSkypeMsg, ' ') - szSkypeMsg + 1))
{
- LOG(( "%s %d %s %d", szSkypeMsg,(UINT)(strchr(szSkypeMsg, ' ')-szSkypeMsg+1),
+ LOG(("%s %d %s %d", szSkypeMsg, (UINT)(strchr(szSkypeMsg, ' ') - szSkypeMsg + 1),
strchr(szSkypeMsg, ' '), strlen(szSkypeMsg)));
break;
}
LOG(("MessageListProcessingThread launched"));
- pthread_create(( pThreadFunc )MessageListProcessingThread, _strdup(strchr(szSkypeMsg, ' ')+1));
+ pthread_create((pThreadFunc)MessageListProcessingThread, _strdup(strchr(szSkypeMsg, ' ') + 1));
break;
}
- if (!strncmp(szSkypeMsg, "MESSAGE", 7) || !strncmp(szSkypeMsg, "CHATMESSAGE", 11))
+ if (!strncmp(szSkypeMsg, "MESSAGE", 7) || !strncmp(szSkypeMsg, "CHATMESSAGE", 11))
{
char *pMsgNum;
TYP_MSGLENTRY *pEntry;
- if ((pMsgNum = strchr (szSkypeMsg, ' ')) && (ptr = strchr (++pMsgNum, ' ')))
+ if ((pMsgNum = strchr(szSkypeMsg, ' ')) && (ptr = strchr(++pMsgNum, ' ')))
{
BOOL bFetchMsg = FALSE;
if (strncmp(ptr, " EDITED_TIMESTAMP", 17) == 0) {
- ptr[0]=0;
+ ptr[0] = 0;
if (pEntry = MsgList_FindMessage(strtoul(pMsgNum, NULL, 10))) {
- pEntry->tEdited = atol(ptr+18);
+ pEntry->tEdited = atol(ptr + 18);
}
bFetchMsg = TRUE;
- } else bFetchMsg = (strncmp(ptr, " STATUS RE", 10) == 0 && !rcvwatchers) ||
+ }
+ else bFetchMsg = (strncmp(ptr, " STATUS RE", 10) == 0 && !rcvwatchers) ||
(strncmp(ptr, " STATUS SENT", 12) == 0 && !sendwatchers);
if (bFetchMsg) {
// If new message is available, fetch it
- ptr[0]=0;
- if (!(args=(fetchmsg_arg *)calloc(1, sizeof(*args)))) break;
- strncpy (args->msgnum, pMsgNum, sizeof(args->msgnum));
- args->getstatus=FALSE;
+ ptr[0] = 0;
+ if (!(args = (fetchmsg_arg *)calloc(1, sizeof(*args)))) break;
+ strncpy(args->msgnum, pMsgNum, sizeof(args->msgnum));
+ args->getstatus = FALSE;
//args->bIsRead = strncmp(ptr+8, "READ", 4) == 0;
- pthread_create(( pThreadFunc )FetchMessageThreadSync, args);
+ pthread_create((pThreadFunc)FetchMessageThreadSync, args);
break;
}
}
@@ -2167,14 +2178,14 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) break;
}
if (!strncmp(szSkypeMsg, "PROTOCOL ", 9)) {
- if ((protocol=(char)atoi(szSkypeMsg+9))>=3) {
+ if ((protocol = (char)atoi(szSkypeMsg + 9)) >= 3) {
strcpy(cmdMessage, "CHATMESSAGE");
strcpy(cmdPartner, "FROM");
}
bProtocolSet = TRUE;
- if (protocol<5 && !hMenuAddSkypeContact &&
- db_get_b(NULL, SKYPE_PROTONAME, "EnableMenu", 1))
+ if (protocol < 5 && !hMenuAddSkypeContact &&
+ db_get_b(NULL, SKYPE_PROTONAME, "EnableMenu", 1))
{
hMenuAddSkypeContact = add_mainmenu();
}
@@ -2183,72 +2194,72 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) SkypeMsgAdd(szSkypeMsg);
ReleaseSemaphore(SkypeMsgReceived, receivers, NULL);
}
- break;
-
- case WM_TIMER:
- if (iReentranceCnt>1) break;
- if (!bIsImoproxy) SkypeSend("PING");
- SkypeMsgCollectGarbage(MAX_MSG_AGE);
- MsgList_CollectGarbage();
- if (receivers>1)
+ break;
+
+ case WM_TIMER:
+ if (iReentranceCnt > 1) break;
+ if (!bIsImoproxy) SkypeSend("PING");
+ SkypeMsgCollectGarbage(MAX_MSG_AGE);
+ MsgList_CollectGarbage();
+ if (receivers > 1)
+ {
+ LOG(("Watchdog WARNING: there are still %d receivers waiting for MSGs", receivers));
+ }
+ break;
+
+ case WM_CLOSE:
+ PostQuitMessage(0);
+ break;
+ case WM_DESTROY:
+ KillTimer(hWndDlg, 1);
+ break;
+ case WM_COPYDATALOCAL:
+ return WndProc(hWndDlg, WM_COPYDATA, wParam, lParam);
+
+ default:
+ if (message == ControlAPIAttach) {
+ // Skype responds with Attach to the discover-message
+ if ((HWND)wParam == hForbiddenSkypeWnd) {
+ ResetEvent(SkypeReady);
+ break;
+ }
+ AttachStatus = lParam;
+ if (lParam == SKYPECONTROLAPI_ATTACH_SUCCESS) {
+ LOG(("AttachStatus success, got hWnd %08X", (HWND)wParam));
+
+ if (hSkypeWnd && (HWND)wParam != hSkypeWnd && IsWindow(hSkypeWnd))
+ hSkypeWndSecondary = (HWND)wParam;
+ else {
+ hSkypeWnd = (HWND)wParam; // Skype gave us the communication window handle
+ hSkypeWndSecondary = NULL;
+ }
+ }
+ if (AttachStatus != SKYPECONTROLAPI_ATTACH_API_AVAILABLE &&
+ AttachStatus != SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE)
{
- LOG(("Watchdog WARNING: there are still %d receivers waiting for MSGs", receivers));
+ LOG(("Attaching: SkypeReady fired, Attachstatus is %d", AttachStatus));
+ SetEvent(SkypeReady);
}
+ AttachStatus = lParam;
break;
-
- case WM_CLOSE:
- PostQuitMessage (0);
- break;
- case WM_DESTROY:
- KillTimer (hWndDlg, 1);
- break;
- case WM_COPYDATALOCAL:
- return WndProc (hWndDlg, WM_COPYDATA, wParam, lParam);
-
- default:
- if(message==ControlAPIAttach) {
- // Skype responds with Attach to the discover-message
- if ((HWND)wParam == hForbiddenSkypeWnd) {
- ResetEvent(SkypeReady);
- break;
- }
- AttachStatus=lParam;
- if (lParam==SKYPECONTROLAPI_ATTACH_SUCCESS) {
- LOG (("AttachStatus success, got hWnd %08X", (HWND)wParam));
-
- if (hSkypeWnd && (HWND)wParam!=hSkypeWnd && IsWindow(hSkypeWnd))
- hSkypeWndSecondary = (HWND)wParam;
- else {
- hSkypeWnd=(HWND)wParam; // Skype gave us the communication window handle
- hSkypeWndSecondary = NULL;
- }
- }
- if (AttachStatus!=SKYPECONTROLAPI_ATTACH_API_AVAILABLE &&
- AttachStatus!=SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE)
- {
- LOG(("Attaching: SkypeReady fired, Attachstatus is %d", AttachStatus));
- SetEvent(SkypeReady);
- }
- AttachStatus=lParam;
- break;
- }
- --iReentranceCnt;
- return DefWindowProc(hWndDlg, message, wParam, lParam);
- }
+ }
+ --iReentranceCnt;
+ return DefWindowProc(hWndDlg, message, wParam, lParam);
+ }
LOG(("WM_COPYDATA exit (%08X)", message));
if (szSkypeMsg) free(szSkypeMsg);
--iReentranceCnt;
return 1;
-}
+}
void TellError(DWORD err) {
LPVOID lpMsgBuf;
-
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL);
- MessageBox( NULL, (TCHAR*)lpMsgBuf, _T("GetLastError"), MB_OK|MB_ICONINFORMATION );
- LocalFree( lpMsgBuf );
- return;
+
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL);
+ MessageBox(NULL, (TCHAR*)lpMsgBuf, _T("GetLastError"), MB_OK | MB_ICONINFORMATION);
+ LocalFree(lpMsgBuf);
+ return;
}
@@ -2261,88 +2272,89 @@ INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam) UNREFERENCED_PARAMETER(lParam);
if (MirandaShuttingDown) return 0;
- LOG (("SkypeSetStatus enter"));
+ LOG(("SkypeSetStatus enter"));
UseCustomCommand = db_get_b(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
UnloadOnOffline = db_get_b(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0);
//if (!SkypeInitialized && !db_get_b(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0)) return 0;
// Workaround for Skype status-bug
- if ((int)wParam==ID_STATUS_OFFLINE) logoff_contacts(TRUE);
- if (SkypeStatus==(int)wParam) return 0;
+ if ((int)wParam == ID_STATUS_OFFLINE) logoff_contacts(TRUE);
+ if (SkypeStatus == (int)wParam) return 0;
oldStatus = SkypeStatus;
- if ((int)wParam==ID_STATUS_CONNECTING) return 0;
+ if ((int)wParam == ID_STATUS_CONNECTING) return 0;
#ifdef MAPDND
- if ((int)wParam==ID_STATUS_OCCUPIED || (int)wParam==ID_STATUS_ONTHEPHONE) wParam=ID_STATUS_DND;
- if ((int)wParam==ID_STATUS_OUTTOLUNCH) wParam=ID_STATUS_NA;
+ if ((int)wParam == ID_STATUS_OCCUPIED || (int)wParam == ID_STATUS_ONTHEPHONE) wParam = ID_STATUS_DND;
+ if ((int)wParam == ID_STATUS_OUTTOLUNCH) wParam = ID_STATUS_NA;
#endif
#ifdef MAPNA
if ((int)wParam==ID_STATUS_NA) wParam = ID_STATUS_AWAY;
#endif
- RequestedStatus=MirandaStatusToSkype((int)wParam);
-
- /*
- if (SkypeStatus != ID_STATUS_OFFLINE)
- {
- InterlockedExchange((long*)&SkypeStatus, (int)wParam);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, SkypeStatus);
- }
- */
-
- if ((int)wParam==ID_STATUS_OFFLINE && UnloadOnOffline)
- {
- if(UseCustomCommand)
- {
- DBVARIANT dbv;
- if(!db_get_s(NULL,SKYPE_PROTONAME,"CommandLine",&dbv))
- {
- CloseSkypeAPI(dbv.pszVal);
- db_free(&dbv);
- }
- }
- else
+ RequestedStatus = MirandaStatusToSkype((int)wParam);
+
+ /*
+ if (SkypeStatus != ID_STATUS_OFFLINE)
+ {
+ InterlockedExchange((long*)&SkypeStatus, (int)wParam);
+ ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, SkypeStatus);
+ }
+ */
+
+ if ((int)wParam == ID_STATUS_OFFLINE && UnloadOnOffline)
+ {
+ if (UseCustomCommand)
+ {
+ DBVARIANT dbv;
+ if (!db_get_s(NULL, SKYPE_PROTONAME, "CommandLine", &dbv))
{
- CloseSkypeAPI(skype_path);
+ CloseSkypeAPI(dbv.pszVal);
+ db_free(&dbv);
}
+ }
+ else
+ {
+ CloseSkypeAPI(skype_path);
+ }
- } else if (AttachStatus==-1)
- {
- pthread_create(LaunchSkypeAndSetStatusThread, (void *)wParam);
- return 0;
- }
+ }
+ else if (AttachStatus == -1)
+ {
+ pthread_create(LaunchSkypeAndSetStatusThread, (void *)wParam);
+ return 0;
+ }
- iRet = SetUserStatus();
- LOG (("SkypeSetStatus exit"));
- return iRet;
+ iRet = SetUserStatus();
+ LOG(("SkypeSetStatus exit"));
+ return iRet;
}
int __stdcall SendBroadcast(MCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
{
- ACKDATA ack = { sizeof( ACKDATA ) };
+ ACKDATA ack = { sizeof(ACKDATA) };
ack.szModule = SKYPE_PROTONAME;
ack.hContact = hContact;
ack.type = type;
ack.result = result;
ack.hProcess = hProcess;
ack.lParam = lParam;
- return CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack );
+ return CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack);
}
static void __cdecl SkypeGetAwayMessageThread(void *hContact)
{
DBVARIANT dbv;
- if (!db_get_ts((MCONTACT)hContact, "CList", "StatusMsg", &dbv )) {
- SendBroadcast((MCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, ( HANDLE )1, ( LPARAM )dbv.ptszVal );
- db_free( &dbv );
+ if (!db_get_ts((MCONTACT)hContact, "CList", "StatusMsg", &dbv)) {
+ SendBroadcast((MCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
+ db_free(&dbv);
}
- else SendBroadcast((MCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, ( HANDLE )1, ( LPARAM )0 );
+ else SendBroadcast((MCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)0);
}
-INT_PTR SkypeGetAwayMessage(WPARAM wParam,LPARAM lParam)
+INT_PTR SkypeGetAwayMessage(WPARAM wParam, LPARAM lParam)
{
- CCSDATA* ccs = ( CCSDATA* )lParam;
+ CCSDATA* ccs = (CCSDATA*)lParam;
UNREFERENCED_PARAMETER(wParam);
@@ -2356,12 +2368,12 @@ INT_PTR SkypeGetAwayMessage(WPARAM wParam,LPARAM lParam) static int GetFileHash(char* filename)
{
- HANDLE hFile = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hFile = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
int remainder = 0, byte, bit;
char data[1024];
DWORD dwRead;
- if(hFile == INVALID_HANDLE_VALUE) return 0;
+ if (hFile == INVALID_HANDLE_VALUE) return 0;
do
{
@@ -2370,11 +2382,11 @@ static int GetFileHash(char* filename) ReadFile(hFile, data, 1024, &dwRead, NULL);
/* loop through each byte of data */
- for (byte = 0; byte < (int) dwRead; ++byte) {
+ for (byte = 0; byte < (int)dwRead; ++byte) {
/* store the next byte into the remainder */
remainder ^= (data[byte] << (WIDTH - 8));
/* calculate for all 8 bits in the byte */
- for ( bit = 8; bit > 0; --bit) {
+ for (bit = 8; bit > 0; --bit) {
/* check if MSB of remainder is a one */
if (remainder & TOPBIT)
remainder = (remainder << 1) ^ POLYNOMIAL;
@@ -2382,7 +2394,7 @@ static int GetFileHash(char* filename) remainder = (remainder << 1);
}
}
- } while(dwRead == 1024);
+ } while (dwRead == 1024);
CloseHandle(hFile);
@@ -2391,10 +2403,10 @@ static int GetFileHash(char* filename) static int _GetFileSize(char* filename)
{
- HANDLE hFile = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hFile = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
int size;
- if(hFile == INVALID_HANDLE_VALUE)
+ if (hFile == INVALID_HANDLE_VALUE)
return 0;
size = GetFileSize(hFile, NULL);
CloseHandle(hFile);
@@ -2402,42 +2414,42 @@ static int _GetFileSize(char* filename) }
/* RetrieveUserAvatar
- *
+ *
* Purpose: Get a user avatar from skype itself
* Params : param=(void *)(HANDLE)hContact
*/
void RetrieveUserAvatar(void *param)
{
- MCONTACT hContact = (MCONTACT) param;
+ MCONTACT hContact = (MCONTACT)param;
HANDLE file;
- PROTO_AVATAR_INFORMATION AI={0};
- ACKDATA ack = {0};
+ PROTO_AVATAR_INFORMATION AI = { 0 };
+ ACKDATA ack = { 0 };
DBVARIANT dbv;
- char AvatarFile[MAX_PATH+1], AvatarTmpFile[MAX_PATH+10], *ptr, *pszTempFile;
+ char AvatarFile[MAX_PATH + 1], AvatarTmpFile[MAX_PATH + 10], *ptr, *pszTempFile;
if (hContact == NULL)
return;
// Mount default ack
- ack.cbSize = sizeof( ACKDATA );
+ ack.cbSize = sizeof(ACKDATA);
ack.szModule = SKYPE_PROTONAME;
ack.hContact = hContact;
ack.type = ACKTYPE_AVATAR;
ack.result = ACKRESULT_FAILED;
-
- AI.cbSize = sizeof( AI );
+
+ AI.cbSize = sizeof(AI);
AI.hContact = hContact;
// Get skype name
- if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0)
+ if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0)
{
if (dbv.pszVal)
{
// Get filename
FoldersGetCustomPath(hProtocolAvatarsFolder, AvatarFile, sizeof(AvatarFile), DefaultAvatarsFolder);
- if (!*AvatarFile) strcpy (AvatarFile, DefaultAvatarsFolder);
+ if (!*AvatarFile) strcpy(AvatarFile, DefaultAvatarsFolder);
mir_snprintf(AvatarTmpFile, sizeof(AvatarTmpFile), "AVATAR 1 %s\\%s_tmp.jpg", AvatarFile, dbv.pszVal);
- pszTempFile = AvatarTmpFile+9;
+ pszTempFile = AvatarTmpFile + 9;
mir_snprintf(AvatarFile, sizeof(AvatarFile), "%s\\%s.jpg", AvatarFile, dbv.pszVal);
// Just to be sure
@@ -2446,15 +2458,15 @@ void RetrieveUserAvatar(void *param) if (file != INVALID_HANDLE_VALUE)
{
CloseHandle(file);
- if (ptr=SkypeGet ("USER", dbv.pszVal, AvatarTmpFile))
+ if (ptr = SkypeGet("USER", dbv.pszVal, AvatarTmpFile))
{
- if (strncmp(ptr, "ERROR", 5) &&
- GetFileAttributesA(pszTempFile) != INVALID_FILE_ATTRIBUTES)
+ if (strncmp(ptr, "ERROR", 5) &&
+ GetFileAttributesA(pszTempFile) != INVALID_FILE_ATTRIBUTES)
{
ack.result = ACKRESULT_SUCCESS;
// Is no avatar image?
- if (!db_get_b(NULL, SKYPE_PROTONAME, "ShowDefaultSkypeAvatar", 0)
+ if (!db_get_b(NULL, SKYPE_PROTONAME, "ShowDefaultSkypeAvatar", 0)
&& GetFileHash(pszTempFile) == 0x8d34e05d && _GetFileSize(pszTempFile) == 3751)
{
// Has no avatar
@@ -2472,7 +2484,7 @@ void RetrieveUserAvatar(void *param) }
}
- free (ptr);
+ free(ptr);
}
DeleteFileA(pszTempFile);
}
@@ -2480,26 +2492,26 @@ void RetrieveUserAvatar(void *param) }
db_free(&dbv);
}
- CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack );
+ CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack);
}
/* SkypeGetAvatarInfo
- *
+ *
* Purpose: Set user avatar in profile
* Params : wParam=0
* lParam=(LPARAM)(const char*)filename
* Returns: 0 - Success
* -1 - Failure
*/
-INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam)
+INT_PTR SkypeGetAvatarInfo(WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv;
- PROTO_AVATAR_INFORMATION* AI = ( PROTO_AVATAR_INFORMATION* )lParam;
+ PROTO_AVATAR_INFORMATION* AI = (PROTO_AVATAR_INFORMATION*)lParam;
if (AI->hContact == NULL) // User
{
- if (!db_get_s(NULL,SKYPE_PROTONAME, "AvatarFile", &dbv))
+ if (!db_get_s(NULL, SKYPE_PROTONAME, "AvatarFile", &dbv))
{
lstrcpynA(AI->filename, dbv.pszVal, sizeof(AI->filename));
db_free(&dbv);
@@ -2511,7 +2523,7 @@ INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam) else // Contact
{
DBVARIANT dbv;
- char AvatarFile[MAX_PATH+1];
+ char AvatarFile[MAX_PATH + 1];
if (protocol < 7 && !bIsImoproxy)
return GAIR_NOAVATAR;
@@ -2519,11 +2531,11 @@ INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam) if (wParam & GAIF_FORCE)
{
// Request anyway
- pthread_create(RetrieveUserAvatar, (void *) AI->hContact);
+ pthread_create(RetrieveUserAvatar, (void *)AI->hContact);
return GAIR_WAITFOR;
}
- if (db_get_s(AI->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
+ if (db_get_s(AI->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
// No skype name ??
return GAIR_NOAVATAR;
@@ -2542,7 +2554,7 @@ INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam) // Check if the file exists
if (GetFileAttributesA(AvatarFile) == INVALID_FILE_ATTRIBUTES)
return GAIR_NOAVATAR;
-
+
// Return the avatar
AI->format = PA_FORMAT_JPEG;
strcpy(AI->filename, AvatarFile);
@@ -2552,7 +2564,7 @@ INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam) /* SkypeGetAvatarCaps
- *
+ *
* Purpose: Query avatar caps for a protocol
* Params : wParam=One of AF_*
* lParam=Depends on wParam
@@ -2560,37 +2572,37 @@ INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam) */
INT_PTR SkypeGetAvatarCaps(WPARAM wParam, LPARAM lParam)
{
- switch(wParam)
+ switch (wParam)
{
- case AF_MAXSIZE:
- {
- POINT *p = (POINT *) lParam;
- if (p == NULL)
- return -1;
+ case AF_MAXSIZE:
+ {
+ POINT *p = (POINT *)lParam;
+ if (p == NULL)
+ return -1;
- p->x = 96;
- p->y = 96;
- return 0;
- }
- case AF_PROPORTION:
- {
- return PIP_NONE;
- }
- case AF_FORMATSUPPORTED:
- {
- if (lParam == PA_FORMAT_PNG || lParam == PA_FORMAT_JPEG)
- return TRUE;
- else
- return FALSE;
- }
- case AF_ENABLED:
- {
+ p->x = 96;
+ p->y = 96;
+ return 0;
+ }
+ case AF_PROPORTION:
+ {
+ return PIP_NONE;
+ }
+ case AF_FORMATSUPPORTED:
+ {
+ if (lParam == PA_FORMAT_PNG || lParam == PA_FORMAT_JPEG)
return TRUE;
- }
- case AF_DONTNEEDDELAYS:
- {
+ else
return FALSE;
- }
+ }
+ case AF_ENABLED:
+ {
+ return TRUE;
+ }
+ case AF_DONTNEEDDELAYS:
+ {
+ return FALSE;
+ }
}
return -1;
}
@@ -2603,9 +2615,9 @@ INT_PTR SkypeGetStatus(WPARAM wParam, LPARAM lParam) { return SkypeStatus;
}
-INT_PTR SkypeGetInfo(WPARAM wParam,LPARAM lParam) {
- CCSDATA *ccs = (CCSDATA *) lParam;
-
+INT_PTR SkypeGetInfo(WPARAM wParam, LPARAM lParam) {
+ CCSDATA *ccs = (CCSDATA *)lParam;
+
UNREFERENCED_PARAMETER(wParam);
pthread_create(GetInfoThread, (void*)ccs->hContact);
@@ -2613,12 +2625,12 @@ INT_PTR SkypeGetInfo(WPARAM wParam,LPARAM lParam) { }
INT_PTR SkypeAddToList(WPARAM wParam, LPARAM lParam) {
- PROTOSEARCHRESULT *psr=(PROTOSEARCHRESULT*)lParam;
+ PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
LOG(("SkypeAddToList Adding API function called"));
- if (psr->cbSize!=sizeof(PROTOSEARCHRESULT) || !psr->nick) return 0;
+ if (psr->cbSize != sizeof(PROTOSEARCHRESULT) || !psr->nick) return 0;
LOG(("SkypeAddToList OK"));
- return (INT_PTR)add_contact(_T2A(psr->nick), wParam);
+ return (INT_PTR)add_contact(_T2A(psr->nick), wParam);
}
INT_PTR SkypeBasicSearch(WPARAM wParam, LPARAM lParam) {
@@ -2626,7 +2638,7 @@ INT_PTR SkypeBasicSearch(WPARAM wParam, LPARAM lParam) { LOG(("SkypeBasicSearch %s", (char *)lParam));
if (!SkypeInitialized) return 0;
- return (hSearchThread=pthread_create(( pThreadFunc )BasicSearchThread, _strdup((char *)lParam)));
+ return (hSearchThread = pthread_create((pThreadFunc)BasicSearchThread, _strdup((char *)lParam)));
}
void MessageSendWatchThread(void *a) {
@@ -2636,117 +2648,121 @@ void MessageSendWatchThread(void *a) { LOG(("MessageSendWatchThread started."));
- str=SkypeRcvMsg(arg->szId, SkypeTime(NULL)-1, arg->hContact, db_get_dw(NULL, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND));
- InterlockedDecrement (&sendwatchers);
+ str = SkypeRcvMsg(arg->szId, SkypeTime(NULL) - 1, arg->hContact, db_get_dw(NULL, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND));
+ InterlockedDecrement(&sendwatchers);
if (str)
{
if (!db_get_b(arg->hContact, SKYPE_PROTONAME, "ChatRoom", 0)) {
- if (err=GetSkypeErrorMsg(str)) {
- ProtoBroadcastAck(SKYPE_PROTONAME, arg->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 1, (LPARAM)Translate(err));
+ if (err = GetSkypeErrorMsg(str)) {
+ ProtoBroadcastAck(SKYPE_PROTONAME, arg->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)1, (LPARAM)Translate(err));
free(err);
free(str);
free(arg);
LOG(("MessageSendWatchThread terminated."));
return;
}
- ProtoBroadcastAck(SKYPE_PROTONAME, arg->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+ ProtoBroadcastAck(SKYPE_PROTONAME, arg->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
free(str);
LOG(("MessageSendWatchThread terminated gracefully."));
}
- free (arg);
+ free(arg);
}
INT_PTR SkypeSendMessage(WPARAM wParam, LPARAM lParam) {
- CCSDATA *ccs = (CCSDATA *) lParam;
+ CCSDATA *ccs = (CCSDATA *)lParam;
DBVARIANT dbv;
- BOOL sendok=TRUE;
- char *msg = (char *) ccs->lParam, *utfmsg=NULL, *mymsgcmd=cmdMessage, szId[16]={0};
+ BOOL sendok = TRUE;
+ char *msg = (char *)ccs->lParam, *utfmsg = NULL, *mymsgcmd = cmdMessage, szId[16] = { 0 };
static DWORD dwMsgNum = 0;
BYTE bIsChatroom = 0 != db_get_b(ccs->hContact, SKYPE_PROTONAME, "ChatRoom", 0);
-
+
UNREFERENCED_PARAMETER(wParam);
if (bIsChatroom)
{
if (db_get_s(ccs->hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv))
return 0;
- mymsgcmd="CHATMESSAGE";
+ mymsgcmd = "CHATMESSAGE";
}
else
{
if (db_get_s(ccs->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
return 0;
- mymsgcmd="MESSAGE";
+ mymsgcmd = "MESSAGE";
}
-
+
if (ccs->wParam & PREF_UTF) {
utfmsg = msg;
- } else if (ccs->wParam & PREF_UNICODE) {
- utfmsg = (char*)make_utf8_string((WCHAR*)(msg+strlen(msg)+1));
- } else {
- if (utf8_encode(msg, &utfmsg)==-1) utfmsg=NULL;
- }
- if (protocol>=4) {
- InterlockedIncrement ((LONG*)&dwMsgNum);
- sprintf (szId, "#M%d ", dwMsgNum++);
- }
- InterlockedIncrement (&sendwatchers);
- if (!utfmsg || SkypeSend("%s%s %s %s", szId, mymsgcmd, dbv.pszVal, utfmsg)) sendok=FALSE;
- if (utfmsg && utfmsg!=msg) free(utfmsg);
+ }
+ else if (ccs->wParam & PREF_UNICODE) {
+ utfmsg = (char*)make_utf8_string((WCHAR*)(msg + strlen(msg) + 1));
+ }
+ else {
+ if (utf8_encode(msg, &utfmsg) == -1) utfmsg = NULL;
+ }
+ if (protocol >= 4) {
+ InterlockedIncrement((LONG*)&dwMsgNum);
+ sprintf(szId, "#M%d ", dwMsgNum++);
+ }
+ InterlockedIncrement(&sendwatchers);
+ if (!utfmsg || SkypeSend("%s%s %s %s", szId, mymsgcmd, dbv.pszVal, utfmsg)) sendok = FALSE;
+ if (utfmsg && utfmsg != msg) free(utfmsg);
db_free(&dbv);
if (sendok) {
msgsendwt_arg *psendarg = (msgsendwt_arg*)calloc(1, sizeof(msgsendwt_arg));
-
+
if (psendarg) {
psendarg->hContact = ccs->hContact;
- strcpy (psendarg->szId, szId);
+ strcpy(psendarg->szId, szId);
pthread_create(MessageSendWatchThread, psendarg);
- } else InterlockedDecrement (&sendwatchers);
+ }
+ else InterlockedDecrement(&sendwatchers);
return 1;
- } else InterlockedDecrement (&sendwatchers);
- if (!bIsChatroom)
- ProtoBroadcastAck(SKYPE_PROTONAME, ccs->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 1, (LPARAM)Translate("Connection to Skype lost"));
+ }
+ else InterlockedDecrement(&sendwatchers);
+ if (!bIsChatroom)
+ ProtoBroadcastAck(SKYPE_PROTONAME, ccs->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)1, (LPARAM)Translate("Connection to Skype lost"));
return 0;
}
INT_PTR SkypeRecvMessage(WPARAM wParam, LPARAM lParam)
{
- DBEVENTINFO dbei={0};
- CCSDATA *ccs = (CCSDATA *) lParam;
- PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
+ DBEVENTINFO dbei = { 0 };
+ CCSDATA *ccs = (CCSDATA *)lParam;
+ PROTORECVEVENT *pre = (PROTORECVEVENT *)ccs->lParam;
UNREFERENCED_PARAMETER(wParam);
- db_unset(ccs->hContact, "CList", "Hidden");
- dbei.cbSize = sizeof(dbei);
- dbei.szModule = SKYPE_PROTONAME;
- dbei.timestamp = pre->timestamp;
- if (pre->flags & PREF_CREATEREAD) dbei.flags|=DBEF_READ;
- if (pre->flags & PREF_UTF) dbei.flags|=DBEF_UTF;
- dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = strlen(pre->szMessage) + 1;
+ db_unset(ccs->hContact, "CList", "Hidden");
+ dbei.cbSize = sizeof(dbei);
+ dbei.szModule = SKYPE_PROTONAME;
+ dbei.timestamp = pre->timestamp;
+ if (pre->flags & PREF_CREATEREAD) dbei.flags |= DBEF_READ;
+ if (pre->flags & PREF_UTF) dbei.flags |= DBEF_UTF;
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.cbBlob = strlen(pre->szMessage) + 1;
if (pre->flags & PREF_UNICODE)
- dbei.cbBlob += sizeof( wchar_t )*( (DWORD)wcslen(( wchar_t* )&pre->szMessage[dbei.cbBlob] )+1 );
- dbei.pBlob = (PBYTE) pre->szMessage;
- MsgList_Add (pre->lParam, db_event_add(ccs->hContact, &dbei));
- return 0;
+ dbei.cbBlob += sizeof(wchar_t)*((DWORD)wcslen((wchar_t*)&pre->szMessage[dbei.cbBlob]) + 1);
+ dbei.pBlob = (PBYTE)pre->szMessage;
+ MsgList_Add(pre->lParam, db_event_add(ccs->hContact, &dbei));
+ return 0;
}
INT_PTR SkypeUserIsTyping(WPARAM wParam, LPARAM lParam) {
- DBVARIANT dbv={0};
+ DBVARIANT dbv = { 0 };
MCONTACT hContact = (MCONTACT)wParam;
- if (protocol<5 && !bIsImoproxy) return 0;
+ if (protocol < 5 && !bIsImoproxy) return 0;
if (db_get_s(hContact, SKYPE_PROTONAME, "Typing_Stream", &dbv)) {
if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0) {
char szCmd[256];
- _snprintf (szCmd, sizeof(szCmd),
+ _snprintf(szCmd, sizeof(szCmd),
"ALTER APPLICATION libpurple_typing CONNECT %s", dbv.pszVal);
- SkypeSend (szCmd);
- db_free (&dbv);
- testfor (szCmd, 2000);
+ SkypeSend(szCmd);
+ db_free(&dbv);
+ testfor(szCmd, 2000);
// TODO: We should somehow cache the typing notify result and send it
// after we got a connection, but in the meantime this notification won't
// get sent on first run
@@ -2754,8 +2770,8 @@ INT_PTR SkypeUserIsTyping(WPARAM wParam, LPARAM lParam) { return 0;
}
- SkypeSend ("ALTER APPLICATION libpurple_typing DATAGRAM %s %s", dbv.pszVal,
- (lParam==PROTOTYPE_SELFTYPING_ON?"PURPLE_TYPING":"PURPLE_NOT_TYPING"));
+ SkypeSend("ALTER APPLICATION libpurple_typing DATAGRAM %s %s", dbv.pszVal,
+ (lParam == PROTOTYPE_SELFTYPING_ON ? "PURPLE_TYPING" : "PURPLE_NOT_TYPING"));
db_free(&dbv);
return 0;
}
@@ -2776,7 +2792,7 @@ INT_PTR SkypeSendAuthRequest(WPARAM wParam, LPARAM lParam) { }
INT_PTR SkypeRecvAuth(WPARAM wParam, LPARAM lParam) {
- DBEVENTINFO dbei = {0};
+ DBEVENTINFO dbei = { 0 };
CCSDATA* ccs = (CCSDATA*)lParam;
PROTORECVEVENT* pre = (PROTORECVEVENT*)ccs->lParam;
@@ -2784,31 +2800,33 @@ INT_PTR SkypeRecvAuth(WPARAM wParam, LPARAM lParam) { db_unset(ccs->hContact, "CList", "Hidden");
- dbei.cbSize = sizeof(dbei);
- dbei.szModule = SKYPE_PROTONAME;
+ dbei.cbSize = sizeof(dbei);
+ dbei.szModule = SKYPE_PROTONAME;
dbei.timestamp = pre->timestamp;
- dbei.flags = ((pre->flags & PREF_CREATEREAD)?DBEF_READ:0);
+ dbei.flags = ((pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0);
dbei.eventType = EVENTTYPE_AUTHREQUEST;
- dbei.cbBlob = pre->lParam;
- dbei.pBlob = (PBYTE)pre->szMessage;
+ dbei.cbBlob = pre->lParam;
+ dbei.pBlob = (PBYTE)pre->szMessage;
db_event_add(NULL, &dbei);
return 0;
}
char *__skypeauth(WPARAM wParam) {
- DBEVENTINFO dbei={0};
+ DBEVENTINFO dbei = { 0 };
if (!SkypeInitialized) return NULL;
dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob = db_event_getBlobSize((HANDLE)wParam)==-1 ||
- !(dbei.pBlob = (unsigned char*)malloc(dbei.cbBlob))))
- { return NULL; }
+ if ((dbei.cbBlob = db_event_getBlobSize((HANDLE)wParam) == -1 ||
+ !(dbei.pBlob = (unsigned char*)malloc(dbei.cbBlob))))
+ {
+ return NULL;
+ }
if (db_event_get((HANDLE)wParam, &dbei) ||
dbei.eventType != EVENTTYPE_AUTHREQUEST ||
- strcmp(dbei.szModule, SKYPE_PROTONAME))
+ strcmp(dbei.szModule, SKYPE_PROTONAME))
{
free(dbei.pBlob);
return NULL;
@@ -2821,9 +2839,9 @@ INT_PTR SkypeAuthAllow(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam);
- if (pBlob=__skypeauth(wParam))
- {
- int retval=SkypeSend("SET USER %s ISAUTHORIZED TRUE", pBlob+sizeof(DWORD)+sizeof(HANDLE));
+ if (pBlob = __skypeauth(wParam))
+ {
+ int retval = SkypeSend("SET USER %s ISAUTHORIZED TRUE", pBlob + sizeof(DWORD) + sizeof(HANDLE));
free(pBlob);
if (!retval) return 0;
}
@@ -2835,9 +2853,9 @@ INT_PTR SkypeAuthDeny(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam);
- if (pBlob=__skypeauth(wParam))
- {
- int retval=SkypeSend("SET USER %s ISAUTHORIZED FALSE", pBlob+sizeof(DWORD)+sizeof(HANDLE));
+ if (pBlob = __skypeauth(wParam))
+ {
+ int retval = SkypeSend("SET USER %s ISAUTHORIZED FALSE", pBlob + sizeof(DWORD) + sizeof(HANDLE));
free(pBlob);
if (!retval) return 0;
}
@@ -2850,9 +2868,9 @@ INT_PTR SkypeAddToListByEvent(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam);
- if (pBlob=__skypeauth(wParam))
- {
- MCONTACT hContact=add_contact(pBlob+sizeof(DWORD)+sizeof(HANDLE), LOWORD(wParam));
+ if (pBlob = __skypeauth(wParam))
+ {
+ MCONTACT hContact = add_contact(pBlob + sizeof(DWORD) + sizeof(HANDLE), LOWORD(wParam));
free(pBlob);
if (hContact) return (int)hContact;
}
@@ -2863,7 +2881,7 @@ INT_PTR SkypeRegisterProxy(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(wParam);
if (!lParam) {
- free (pszProxyCallout);
+ free(pszProxyCallout);
pszProxyCallout = NULL;
}
pszProxyCallout = _strdup((char*)lParam);
@@ -2880,10 +2898,10 @@ void CleanupNicknames(char *dummy) { UNREFERENCED_PARAMETER(dummy);
LOG(("CleanupNicknames Cleaning up..."));
- for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, hContact, 0 );
- if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
- db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==0)
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
+ if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
+ db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
{
if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue;
if (db_get_s(hContact, SKYPE_PROTONAME, "Nick", &dbv2)) {
@@ -2902,21 +2920,21 @@ void CleanupNicknames(char *dummy) { /////////////////////////////////////////////////////////////////////////////////////////
// EnterBitmapFileName - enters a bitmap filename
-int __stdcall EnterBitmapFileName( char* szDest )
+int __stdcall EnterBitmapFileName(char* szDest)
{
- char szFilter[ 512 ];
- OPENFILENAMEA ofn = {0};
+ char szFilter[512];
+ OPENFILENAMEA ofn = { 0 };
*szDest = 0;
- CallService( MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof szFilter, ( LPARAM )szFilter );
- ofn.lStructSize = sizeof( OPENFILENAME );
+ CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, sizeof szFilter, (LPARAM)szFilter);
+ ofn.lStructSize = sizeof(OPENFILENAME);
ofn.lpstrFilter = szFilter;
ofn.lpstrFile = szDest;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "bmp";
- if ( !GetOpenFileNameA( &ofn ))
+ if (!GetOpenFileNameA(&ofn))
return 1;
return ERROR_SUCCESS;
@@ -2926,7 +2944,7 @@ int MirandaExit(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
- MirandaShuttingDown=TRUE;
+ MirandaShuttingDown = TRUE;
return 0;
}
@@ -2934,20 +2952,20 @@ int OkToExit(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
-// logoff_contacts();
- MirandaShuttingDown=TRUE;
+ // logoff_contacts();
+ MirandaShuttingDown = TRUE;
// Trigger all semaphores and events just to be sure that there is no deadlock
ReleaseSemaphore(SkypeMsgReceived, receivers, NULL);
- SetEvent (SkypeReady);
- SetEvent (MessagePumpReady);
+ SetEvent(SkypeReady);
+ SetEvent(MessagePumpReady);
#ifdef SKYPEBUG_OFFLN
SetEvent(GotUserstatus);
#endif
- SetEvent (hBuddyAdded);
+ SetEvent(hBuddyAdded);
- SkypeFlush ();
- PostMessage (g_hWnd, WM_CLOSE, 0, 0);
+ SkypeFlush();
+ PostMessage(g_hWnd, WM_CLOSE, 0, 0);
return 0;
}
@@ -2958,34 +2976,34 @@ struct PLUGINDI { };
// Taken from pluginopts.c and modified
-int EnumOldPluginName(const char *szSetting,LPARAM lParam)
+int EnumOldPluginName(const char *szSetting, LPARAM lParam)
{
- struct PLUGINDI *pdi=(struct PLUGINDI*)lParam;
+ struct PLUGINDI *pdi = (struct PLUGINDI*)lParam;
if (pdi && lParam) {
- pdi->szSettings=(char**)realloc(pdi->szSettings,(pdi->dwCount+1)*sizeof(char*));
- pdi->szSettings[pdi->dwCount++]=_strdup(szSetting);
- }
+ pdi->szSettings = (char**)realloc(pdi->szSettings, (pdi->dwCount + 1)*sizeof(char*));
+ pdi->szSettings[pdi->dwCount++] = _strdup(szSetting);
+ }
return 0;
}
// Are there any Skype users on list?
// 1 --> Yes
// 0 --> No
-int AnySkypeusers(void)
+int AnySkypeusers(void)
{
MCONTACT hContact;
DBVARIANT dbv;
int tCompareResult;
// already on list?
- for (hContact=db_find_first();
- hContact != NULL;
- hContact=db_find_next(hContact))
+ for (hContact = db_find_first();
+ hContact != NULL;
+ hContact = db_find_next(hContact))
{
// GETCONTACTBASEPROTO doesn't work on not loaded protocol, therefore get
// protocol from DB
if (db_get_s(hContact, "Protocol", "p", &dbv)) continue;
- tCompareResult = !strcmp(dbv.pszVal, SKYPE_PROTONAME);
+ tCompareResult = !strcmp(dbv.pszVal, SKYPE_PROTONAME);
db_free(&dbv);
if (tCompareResult) return 1;
}
@@ -2994,103 +3012,103 @@ int AnySkypeusers(void) /*void UpgradeName(char *OldName)
-{
- DBCONTACTENUMSETTINGS cns;
- DBCONTACTWRITESETTING cws;
- DBVARIANT dbv;
- MCONTACT hContact=NULL;
- struct PLUGINDI pdi;
-
- LOG(("Updating old database settings if there are any..."));
- cns.pfnEnumProc=EnumOldPluginName;
- cns.lParam=(LPARAM)&pdi;
- cns.szModule=OldName;
- cns.ofsSettings=0;
-
- hContact = db_find_first();
-
- for ( ;; ) {
- memset(&pdi,0,sizeof(pdi));
- CallService(MS_DB_CONTACT_ENUMSETTINGS,hContact,(LPARAM)&cns);
- // Upgrade Protocol settings to new string
- if (pdi.szSettings) {
- int i;
-
- LOG(("We're currently upgrading..."));
- for (i=0;i<pdi.dwCount;i++) {
- if (!db_get_s(hContact, OldName, pdi.szSettings[i], &dbv)) {
- cws.szModule=SKYPE_PROTONAME;
- cws.szSetting=pdi.szSettings[i];
- cws.value=dbv;
- if (!CallService(MS_DB_CONTACT_WRITESETTING,hContact,(LPARAM)&cws))
- db_unset(hContact,OldName,pdi.szSettings[i]);
- db_free(&dbv);
- }
- free(pdi.szSettings[i]);
- }
- free(pdi.szSettings);
- }
- // Upgrade Protocol assignment, if we are not main contact
- if (hContact && !db_get_s(hContact, "Protocol", "p", &dbv)) {
- if (!strcmp(dbv.pszVal, OldName))
- db_set_s(hContact, "Protocol", "p", SKYPE_PROTONAME);
- db_free(&dbv);
- }
- if (!hContact) break;
- hContact = db_find_next(hContact);
- }
-
- db_set_b(NULL, SKYPE_PROTONAME, "UpgradeDone", (BYTE)1);
- return;
+{
+DBCONTACTENUMSETTINGS cns;
+DBCONTACTWRITESETTING cws;
+DBVARIANT dbv;
+MCONTACT hContact=NULL;
+struct PLUGINDI pdi;
+
+LOG(("Updating old database settings if there are any..."));
+cns.pfnEnumProc=EnumOldPluginName;
+cns.lParam=(LPARAM)&pdi;
+cns.szModule=OldName;
+cns.ofsSettings=0;
+
+hContact = db_find_first();
+
+for ( ;; ) {
+memset(&pdi,0,sizeof(pdi));
+CallService(MS_DB_CONTACT_ENUMSETTINGS,hContact,(LPARAM)&cns);
+// Upgrade Protocol settings to new string
+if (pdi.szSettings) {
+int i;
+
+LOG(("We're currently upgrading..."));
+for (i=0;i<pdi.dwCount;i++) {
+if (!db_get_s(hContact, OldName, pdi.szSettings[i], &dbv)) {
+cws.szModule=SKYPE_PROTONAME;
+cws.szSetting=pdi.szSettings[i];
+cws.value=dbv;
+if (!CallService(MS_DB_CONTACT_WRITESETTING,hContact,(LPARAM)&cws))
+db_unset(hContact,OldName,pdi.szSettings[i]);
+db_free(&dbv);
+}
+free(pdi.szSettings[i]);
+}
+free(pdi.szSettings);
+}
+// Upgrade Protocol assignment, if we are not main contact
+if (hContact && !db_get_s(hContact, "Protocol", "p", &dbv)) {
+if (!strcmp(dbv.pszVal, OldName))
+db_set_s(hContact, "Protocol", "p", SKYPE_PROTONAME);
+db_free(&dbv);
+}
+if (!hContact) break;
+hContact = db_find_next(hContact);
+}
+
+db_set_b(NULL, SKYPE_PROTONAME, "UpgradeDone", (BYTE)1);
+return;
}*/
-void __cdecl MsgPump (char *dummy)
+void __cdecl MsgPump(char *dummy)
{
- MSG msg;
-
- WNDCLASS WndClass;
-
- UNREFERENCED_PARAMETER(dummy);
-
- // Create window class
- WndClass.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
- WndClass.lpfnWndProc = (WNDPROC)WndProc;
- WndClass.cbClsExtra = 0;
- WndClass.cbWndExtra = 0;
- WndClass.hInstance = hInst;
- WndClass.hIcon = NULL;
- WndClass.hCursor = NULL;
- WndClass.hbrBackground = NULL;
- WndClass.lpszMenuName = NULL;
- WndClass.lpszClassName = _T("SkypeApiDispatchWindow");
- RegisterClass(&WndClass);
- // Do not check the retval of RegisterClass, because on non-unicode
- // win98 it will fail, as it is a stub that returns false() there
-
- // Create main window
- g_hWnd=CreateWindowEx( WS_EX_APPWINDOW|WS_EX_WINDOWEDGE,
- _T("SkypeApiDispatchWindow"), _T(""), WS_BORDER|WS_SYSMENU|WS_MINIMIZEBOX,
+ MSG msg;
+
+ WNDCLASS WndClass;
+
+ UNREFERENCED_PARAMETER(dummy);
+
+ // Create window class
+ WndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
+ WndClass.lpfnWndProc = (WNDPROC)WndProc;
+ WndClass.cbClsExtra = 0;
+ WndClass.cbWndExtra = 0;
+ WndClass.hInstance = hInst;
+ WndClass.hIcon = NULL;
+ WndClass.hCursor = NULL;
+ WndClass.hbrBackground = NULL;
+ WndClass.lpszMenuName = NULL;
+ WndClass.lpszClassName = _T("SkypeApiDispatchWindow");
+ RegisterClass(&WndClass);
+ // Do not check the retval of RegisterClass, because on non-unicode
+ // win98 it will fail, as it is a stub that returns false() there
+
+ // Create main window
+ g_hWnd = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,
+ _T("SkypeApiDispatchWindow"), _T(""), WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX,
CW_USEDEFAULT, CW_USEDEFAULT, 128, 128, NULL, 0, (HINSTANCE)WndClass.hInstance, 0);
- LOG (("Created Dispatch window with handle %08X", (long)g_hWnd));
- if (!g_hWnd) {
- OUTPUT(_T("Cannot create window."));
- TellError(GetLastError());
+ LOG(("Created Dispatch window with handle %08X", (long)g_hWnd));
+ if (!g_hWnd) {
+ OUTPUT(_T("Cannot create window."));
+ TellError(GetLastError());
+ SetEvent(MessagePumpReady);
+ return;
+ }
+ ShowWindow(g_hWnd, 0);
+ UpdateWindow(g_hWnd);
+ msgPumpThreadId = GetCurrentThreadId();
SetEvent(MessagePumpReady);
- return;
- }
- ShowWindow(g_hWnd, 0);
- UpdateWindow(g_hWnd);
- msgPumpThreadId = GetCurrentThreadId();
- SetEvent(MessagePumpReady);
-
- LOG (("Messagepump started."));
- while (GetMessage (&msg, NULL, 0, 0) > 0 && !Miranda_Terminated()) {
- TranslateMessage (&msg);
- DispatchMessage (&msg);
- }
- UnregisterClass (WndClass.lpszClassName, hInst);
- LOG (("Messagepump stopped."));
+
+ LOG(("Messagepump started."));
+ while (GetMessage(&msg, NULL, 0, 0) > 0 && !Miranda_Terminated()) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ UnregisterClass(WndClass.lpszClassName, hInst);
+ LOG(("Messagepump stopped."));
}
// DLL Stuff //
@@ -3102,9 +3120,9 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirVers return &pluginInfo;
}
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MUUID_SKYPE_CALL, MIID_LAST};
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MUUID_SKYPE_CALL, MIID_LAST };
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
UNREFERENCED_PARAMETER(fdwReason);
UNREFERENCED_PARAMETER(lpvReserved);
@@ -3149,13 +3167,13 @@ extern "C" int __declspec(dllexport) Load(void) LOG(("Load: Skype Plugin loading..."));
// We need to upgrade SKYPE_PROTOCOL internal name to Skype if not already done
-/* if (!db_get_b(NULL, SKYPE_PROTONAME, "UpgradeDone", 0))
- UpgradeName("SKYPE_PROTOCOL");*/
+ /* if (!db_get_b(NULL, SKYPE_PROTONAME, "UpgradeDone", 0))
+ UpgradeName("SKYPE_PROTOCOL");*/
- // Initialisation of Skype MsgQueue must be done because of Cleanup in end and
+ // Initialisation of Skype MsgQueue must be done because of Cleanup in end and
// Mutex is also initialized here.
LOG(("SkypeMsgInit initializing Skype MSG-queue"));
- if (SkypeMsgInit()==-1) {
+ if (SkypeMsgInit() == -1) {
OUTPUT(_T("Memory allocation error on startup."));
return 0;
}
@@ -3165,72 +3183,70 @@ extern "C" int __declspec(dllexport) Load(void) // --> Fixing Issue #0000006 from bugtracker.
if (!db_get_b(NULL, SKYPE_PROTONAME, "FirstRun", 0)) {
db_set_b(NULL, SKYPE_PROTONAME, "FirstRun", 1);
- if (AnySkypeusers()==0) // First run, it seems :)
- if (MessageBox(NULL, TranslateT("This seems to be the first time that you're running the Skype protocol plugin. Do you want to enable the protocol for this Miranda profile? If you chose NO, you can always enable it in the plugin options later."), _T("Welcome!"), MB_ICONQUESTION|MB_YESNO)==IDNO) {
- char path[MAX_PATH], *filename;
- GetModuleFileNameA(hInst, path, sizeof(path));
- if (filename = strrchr(path,'\\')+1)
- db_set_b(NULL,"PluginDisable",filename,1);
- return 0;
+ if (AnySkypeusers() == 0) // First run, it seems :)
+ if (MessageBox(NULL, TranslateT("This seems to be the first time that you're running the Skype protocol plugin. Do you want to enable the protocol for this Miranda profile? If you chose NO, you can always enable it in the plugin options later."), _T("Welcome!"), MB_ICONQUESTION | MB_YESNO) == IDNO) {
+ char path[MAX_PATH], *filename;
+ GetModuleFileNameA(hInst, path, sizeof(path));
+ if (filename = strrchr(path, '\\') + 1)
+ db_set_b(NULL, "PluginDisable", filename, 1);
+ return 0;
}
}
// Check if Skype is installed
- SkypeInstalled=TRUE;
+ SkypeInstalled = TRUE;
UseCustomCommand = (BYTE)db_get_b(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
UseSockets = (BOOL)db_get_b(NULL, SKYPE_PROTONAME, "UseSkype2Socket", 0);
- if (!UseSockets && !UseCustomCommand)
+ if (!UseSockets && !UseCustomCommand)
{
- if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Skype\\Phone"), 0, KEY_READ, &MyKey)!=ERROR_SUCCESS)
+ if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Skype\\Phone"), 0, KEY_READ, &MyKey) != ERROR_SUCCESS)
{
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Skype\\Phone"), 0, KEY_READ, &MyKey)!=ERROR_SUCCESS)
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Skype\\Phone"), 0, KEY_READ, &MyKey) != ERROR_SUCCESS)
{
- SkypeInstalled=FALSE;
+ SkypeInstalled = FALSE;
}
}
-
- Buffsize=sizeof(skype_path);
-
- if (SkypeInstalled==FALSE || RegQueryValueExA(MyKey, "SkypePath", NULL, NULL, (unsigned char *)skype_path, &Buffsize)!=ERROR_SUCCESS)
+
+ Buffsize = sizeof(skype_path);
+
+ if (SkypeInstalled == FALSE || RegQueryValueExA(MyKey, "SkypePath", NULL, NULL, (unsigned char *)skype_path, &Buffsize) != ERROR_SUCCESS)
{
- //OUTPUT("Skype was not found installed :( \nMaybe you are using portable Skype.");
- RegCloseKey(MyKey);
- skype_path[0]=0;
- //return 0;
+ //OUTPUT("Skype was not found installed :( \nMaybe you are using portable Skype.");
+ RegCloseKey(MyKey);
+ skype_path[0] = 0;
+ //return 0;
}
RegCloseKey(MyKey);
}
- WSAStartup(MAKEWORD(2,2), &wsaData);
+ WSAStartup(MAKEWORD(2, 2), &wsaData);
// Start Skype connection
- if (!(ControlAPIAttach=RegisterWindowMessage(_T("SkypeControlAPIAttach"))) || !(ControlAPIDiscover=RegisterWindowMessage(_T("SkypeControlAPIDiscover"))))
+ if (!(ControlAPIAttach = RegisterWindowMessage(_T("SkypeControlAPIAttach"))) || !(ControlAPIDiscover = RegisterWindowMessage(_T("SkypeControlAPIDiscover"))))
{
- OUTPUT(_T("Cannot register Window message."));
- return 0;
+ OUTPUT(_T("Cannot register Window message."));
+ return 0;
}
-
- SkypeMsgReceived=CreateSemaphore(NULL, 0, MAX_MSGS, NULL);
- if (!(SkypeReady=CreateEvent(NULL, TRUE, FALSE, NULL)) ||
- !(MessagePumpReady=CreateEvent(NULL, FALSE, FALSE, NULL)) ||
+
+ SkypeMsgReceived = CreateSemaphore(NULL, 0, MAX_MSGS, NULL);
+ if (!(SkypeReady = CreateEvent(NULL, TRUE, FALSE, NULL)) ||
+ !(MessagePumpReady = CreateEvent(NULL, FALSE, FALSE, NULL)) ||
#ifdef SKYPEBUG_OFFLN
- !(GotUserstatus=CreateEvent(NULL, TRUE, FALSE, NULL)) ||
+ !(GotUserstatus = CreateEvent(NULL, TRUE, FALSE, NULL)) ||
#endif
- !(hBuddyAdded=CreateEvent(NULL, FALSE, FALSE, NULL)) ||
- !(FetchMessageEvent=CreateEvent(NULL, FALSE, TRUE, NULL))) {
- OUTPUT(_T("Unable to create Mutex!"));
+ !(hBuddyAdded = CreateEvent(NULL, FALSE, FALSE, NULL)) ||
+ !(FetchMessageEvent = CreateEvent(NULL, FALSE, TRUE, NULL))) {
+ OUTPUT(_T("Unable to create Mutex!"));
return 0;
}
/* Register the module */
PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = SKYPE_PROTONAME;
- pd.type = PROTOTYPE_PROTOCOL;
+ pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
- VoiceServiceInit();
-
CreateServices();
HookEvents();
InitVSApi();
@@ -3239,51 +3255,50 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
// Startup Message-pump
- pthread_create (( pThreadFunc )MsgPump, NULL);
+ pthread_create((pThreadFunc)MsgPump, NULL);
WaitForSingleObject(MessagePumpReady, INFINITE);
return 0;
}
-extern "C" int __declspec( dllexport ) Unload(void)
+extern "C" int __declspec(dllexport) Unload(void)
{
BOOL UseCustomCommand = db_get_b(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
BOOL Shutdown = db_get_b(NULL, SKYPE_PROTONAME, "Shutdown", 0);
-
- LOG (("Unload started"));
-
- if ( Shutdown && ((skype_path && skype_path[0]) ||UseCustomCommand) ) {
- if(UseCustomCommand)
+ LOG(("Unload started"));
+
+ if (Shutdown && ((skype_path && skype_path[0]) || UseCustomCommand)) {
+
+ if (UseCustomCommand)
{
DBVARIANT dbv;
- if(!db_get_s(NULL,SKYPE_PROTONAME,"CommandLine",&dbv))
+ if (!db_get_s(NULL, SKYPE_PROTONAME, "CommandLine", &dbv))
{
char szAbsolutePath[MAX_PATH];
TranslateMirandaRelativePathToAbsolute(dbv.pszVal, szAbsolutePath, FALSE);
_spawnl(_P_NOWAIT, szAbsolutePath, szAbsolutePath, "/SHUTDOWN", NULL);
- LOG (("Unload Sent /shutdown to %s", szAbsolutePath));
+ LOG(("Unload Sent /shutdown to %s", szAbsolutePath));
db_free(&dbv);
}
}
else
{
_spawnl(_P_NOWAIT, skype_path, skype_path, "/SHUTDOWN", NULL);
- LOG (("Unload Sent /shutdown to %s", skype_path));
+ LOG(("Unload Sent /shutdown to %s", skype_path));
}
-
+
}
SkypeMsgCleanup();
//WSACleanup();
FreeVSApi();
UnhookEvents();
UnhookEvent(hChatEvent);
- UnhookEvent (hChatMenu);
- UnhookEvent (hEvInitChat);
+ UnhookEvent(hChatMenu);
+ UnhookEvent(hEvInitChat);
DestroyHookableEvent(hInitChat);
- VoiceServiceExit();
GCExit();
MsgList_Exit();
@@ -3299,8 +3314,8 @@ extern "C" int __declspec( dllexport ) Unload(void) DeleteCriticalSection(&RingAndEndcallMutex);
DeleteCriticalSection(&QueryThreadMutex);
- SkypeRegisterProxy (0, 0);
- LOG (("Unload: Shutdown complete"));
+ SkypeRegisterProxy(0, 0);
+ LOG(("Unload: Shutdown complete"));
#ifdef _DEBUG
end_debug();
#endif
diff --git a/protocols/SkypeClassic/src/voiceservice.cpp b/protocols/SkypeClassic/src/voiceservice.cpp deleted file mode 100644 index dd49772d2a..0000000000 --- a/protocols/SkypeClassic/src/voiceservice.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include "skype.h"
-#include "skypeapi.h"
-#include "skypesvc.h"
-#include "voiceservice.h"
-#include <m_voiceservice.h>
-
-#pragma warning (push)
-#pragma warning (disable: 4100) // unreferenced formal parameter
-#include <m_utils.h>
-#pragma warning (pop)
-
-HANDLE hVoiceNotify = NULL;
-BOOL has_voice_service = FALSE;
-
-extern char g_szProtoName[];
-
-
-BOOL HasVoiceService()
-{
- return has_voice_service;
-}
-
-void NofifyVoiceService(MCONTACT hContact, char *callId, int state)
-{
- VOICE_CALL vc = {0};
- vc.cbSize = sizeof(vc);
- vc.szModule = SKYPE_PROTONAME;
- vc.id = callId;
- vc.flags = VOICE_CALL_CONTACT;
- vc.state = state;
- vc.hContact = hContact;
- NotifyEventHooks(hVoiceNotify, (WPARAM) &vc, 0);
-}
-
-static INT_PTR VoiceGetInfo(WPARAM wParam, LPARAM lParam)
-{
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
-
- return VOICE_SUPPORTED | VOICE_CALL_CONTACT | VOICE_CAN_HOLD;
-}
-
-static MCONTACT FindContactByCallId(char *callId)
-{
- MCONTACT hContact;
- int iCmpRes;
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
- char *szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
-
- DBVARIANT dbv;
- if (szProto != NULL
- && !strcmp(szProto, SKYPE_PROTONAME)
- && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0
- && !db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv))
- {
- iCmpRes = strcmp(callId, dbv.pszVal);
- db_free(&dbv);
- if (iCmpRes == 0)
- return hContact;
- }
- }
-
- return NULL;
-}
-
-static INT_PTR VoiceCall(WPARAM wParam, LPARAM lParam)
-{
- DBVARIANT dbv;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (db_get_s((MCONTACT)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return -1;
-
- SkypeSend("CALL %s", dbv.pszVal);
- db_free (&dbv);
-
- return 0;
-}
-
-static INT_PTR VoiceAnswer(WPARAM wParam, LPARAM lParam)
-{
- char *callId = (char *) wParam;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (FindContactByCallId(callId) == NULL)
- return -1;
-
- SkypeSend("SET %s STATUS INPROGRESS", callId);
- testfor("ERROR", 200);
-
- return 0;
-}
-
-static INT_PTR VoiceDrop(WPARAM wParam, LPARAM lParam)
-{
- char *callId = (char *) wParam;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (FindContactByCallId(callId) == NULL)
- return -1;
-
- SkypeSend("SET %s STATUS FINISHED", callId);
-
- return 0;
-}
-
-static INT_PTR VoiceHold(WPARAM wParam, LPARAM lParam)
-{
- char *callId = (char *) wParam;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (FindContactByCallId(callId) == NULL)
- return -1;
-
- SkypeSend("SET %s STATUS ONHOLD", callId);
-
- return 0;
-}
-
-void VoiceServiceInit()
-{
- // leecher, 26.03.2011: Did this ever work in the old versions??
- char szEvent[MAXMODULELABELLENGTH];
-
- _snprintf (szEvent, sizeof(szEvent), "%s%s", SKYPE_PROTONAME, PE_VOICE_CALL_STATE);
- hVoiceNotify = CreateHookableEvent( szEvent );
- CreateProtoService( PS_VOICE_GETINFO, VoiceGetInfo );
- CreateProtoService( PS_VOICE_CALL, VoiceCall );
- CreateProtoService( PS_VOICE_ANSWERCALL, VoiceAnswer );
- CreateProtoService( PS_VOICE_DROPCALL, VoiceDrop );
- CreateProtoService( PS_VOICE_HOLDCALL, VoiceHold );
-}
-
-void VoiceServiceExit()
-{
- DestroyHookableEvent(hVoiceNotify);
-}
-
-void VoiceServiceModulesLoaded()
-{
- has_voice_service = ServiceExists(MS_VOICESERVICE_REGISTER);
-}
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/voiceservice.h b/protocols/SkypeClassic/src/voiceservice.h deleted file mode 100644 index df1a016100..0000000000 --- a/protocols/SkypeClassic/src/voiceservice.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _VOICESERVICE_H_
-#define _VOICESERVICE_H_
-
-#pragma warning (push)
-#pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union
-#include <m_voice.h>
-#pragma warning (pop)
-
-BOOL HasVoiceService();
-void VoiceServiceInit();
-void VoiceServiceExit();
-void VoiceServiceModulesLoaded();
-void NofifyVoiceService(MCONTACT hContact, char *callId, int state) ;
-
-
-
-#endif // _VOICESERVICE_H_
-
|