From f2dcf0c403d9083ec794376ba690d79727a6d318 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Wed, 15 Apr 2015 21:29:20 +0000 Subject: Tox: audio support pt.3 git-svn-id: http://svn.miranda-ng.org/main/trunk@12850 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/Tox_12.vcxproj | 4 ++ protocols/Tox/Tox_12.vcxproj.filters | 12 ++++ protocols/Tox/res/Icons/audio_call.ico | Bin 1150 -> 5430 bytes protocols/Tox/res/Icons/audio_end.ico | Bin 0 -> 5430 bytes protocols/Tox/res/Icons/audio_ring.ico | Bin 0 -> 5430 bytes protocols/Tox/res/Icons/audio_start.ico | Bin 0 -> 5430 bytes protocols/Tox/res/resource.rc | 21 +++++++ protocols/Tox/src/api_av.cpp | 100 +++++++++++++++---------------- protocols/Tox/src/common.h | 6 +- protocols/Tox/src/resource.h | 8 ++- protocols/Tox/src/tox_chatrooms.h | 2 + protocols/Tox/src/tox_events.cpp | 31 +++++++++- protocols/Tox/src/tox_icons.cpp | 3 + protocols/Tox/src/tox_multimedia.cpp | 101 +++++++++++++++++++++++++++++--- protocols/Tox/src/tox_multimedia.h | 24 ++++++++ protocols/Tox/src/tox_proto.cpp | 9 ++- protocols/Tox/src/tox_proto.h | 10 ++-- 17 files changed, 261 insertions(+), 70 deletions(-) create mode 100644 protocols/Tox/res/Icons/audio_end.ico create mode 100644 protocols/Tox/res/Icons/audio_ring.ico create mode 100644 protocols/Tox/res/Icons/audio_start.ico create mode 100644 protocols/Tox/src/tox_multimedia.h diff --git a/protocols/Tox/Tox_12.vcxproj b/protocols/Tox/Tox_12.vcxproj index 377bdf8a47..c9699a69cd 100644 --- a/protocols/Tox/Tox_12.vcxproj +++ b/protocols/Tox/Tox_12.vcxproj @@ -212,6 +212,7 @@ copy docs\tox.ini "$(SolutionDir)$(Configuration)64\Plugins" /y + @@ -256,6 +257,9 @@ copy docs\tox.ini "$(SolutionDir)$(Configuration)64\Plugins" /y + + + diff --git a/protocols/Tox/Tox_12.vcxproj.filters b/protocols/Tox/Tox_12.vcxproj.filters index 88c4bd4376..2960f9c774 100644 --- a/protocols/Tox/Tox_12.vcxproj.filters +++ b/protocols/Tox/Tox_12.vcxproj.filters @@ -66,6 +66,9 @@ Header Files\api + + Header Files + @@ -171,5 +174,14 @@ Resource Files\Icons + + Resource Files\Icons + + + Resource Files\Icons + + + Resource Files\Icons + \ No newline at end of file diff --git a/protocols/Tox/res/Icons/audio_call.ico b/protocols/Tox/res/Icons/audio_call.ico index 3e9cbe2d94..555d0cb874 100644 Binary files a/protocols/Tox/res/Icons/audio_call.ico and b/protocols/Tox/res/Icons/audio_call.ico differ diff --git a/protocols/Tox/res/Icons/audio_end.ico b/protocols/Tox/res/Icons/audio_end.ico new file mode 100644 index 0000000000..9698282053 Binary files /dev/null and b/protocols/Tox/res/Icons/audio_end.ico differ diff --git a/protocols/Tox/res/Icons/audio_ring.ico b/protocols/Tox/res/Icons/audio_ring.ico new file mode 100644 index 0000000000..77c4aa9640 Binary files /dev/null and b/protocols/Tox/res/Icons/audio_ring.ico differ diff --git a/protocols/Tox/res/Icons/audio_start.ico b/protocols/Tox/res/Icons/audio_start.ico new file mode 100644 index 0000000000..4863643b52 Binary files /dev/null and b/protocols/Tox/res/Icons/audio_start.ico differ diff --git a/protocols/Tox/res/resource.rc b/protocols/Tox/res/resource.rc index 13cd90fe18..715d433055 100644 --- a/protocols/Tox/res/resource.rc +++ b/protocols/Tox/res/resource.rc @@ -64,6 +64,9 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL // remains consistent on all systems. IDI_TOX ICON "icons\\tox.ico" IDI_AUDIO_CALL ICON "icons\\audio_call.ico" +IDI_AUDIO_END ICON "icons\\audio_end.ico" +IDI_AUDIO_RING ICON "icons\\audio_ring.ico" +IDI_AUDIO_START ICON "icons\\audio_start.ico" ///////////////////////////////////////////////////////////////////////////// // @@ -196,6 +199,16 @@ BEGIN CONTROL "",IDC_CCLIST,"CListControl",WS_TABSTOP | 0x16f,7,7,176,145,WS_EX_CLIENTEDGE END +IDD_AUDIO DIALOGEX 0, 0, 119, 28 +STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOPMOST +CAPTION "Audio call" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,7,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,62,7,50,14 +END + ///////////////////////////////////////////////////////////////////////////// // @@ -281,6 +294,14 @@ BEGIN HORZGUIDE, 152 HORZGUIDE, 158 END + + IDD_AUDIO, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 112 + TOPMARGIN, 7 + BOTTOMMARGIN, 21 + END END #endif // APSTUDIO_INVOKED diff --git a/protocols/Tox/src/api_av.cpp b/protocols/Tox/src/api_av.cpp index 4f517187ac..afcf544bbf 100644 --- a/protocols/Tox/src/api_av.cpp +++ b/protocols/Tox/src/api_av.cpp @@ -12,99 +12,99 @@ void toxav_kill(ToxAv *av) CreateFunction(__FUNCTION__)(av); } -uint32_t toxav_do_interval(ToxAv *av) -{ - return CreateFunction(__FUNCTION__)(av); -} - -void toxav_do(ToxAv *av) -{ - CreateFunction(__FUNCTION__)(av); -} - -void toxav_register_callstate_callback(ToxAv *av, ToxAVCallback cb, ToxAvCallbackID id, void *userdata) -{ - CreateFunction(__FUNCTION__)(av, cb, id, userdata); -} - +uint32_t toxav_do_interval(ToxAv *av) +{ + return CreateFunction(__FUNCTION__)(av); +} + +void toxav_do(ToxAv *av) +{ + CreateFunction(__FUNCTION__)(av); +} + +void toxav_register_callstate_callback(ToxAv *av, ToxAVCallback cb, ToxAvCallbackID id, void *userdata) +{ + CreateFunction(__FUNCTION__)(av, cb, id, userdata); +} + int toxav_call(ToxAv *av, int32_t *call_index, int friend_id, const ToxAvCSettings *csettings, int ringing_seconds) { return CreateFunction(__FUNCTION__)(av, call_index, friend_id, csettings, ringing_seconds); -} - +} + int toxav_hangup(ToxAv *av, int32_t call_index) { return CreateFunction(__FUNCTION__)(av, call_index); -} - +} + int toxav_answer(ToxAv *av, int32_t call_index, const ToxAvCSettings *csettings) { return CreateFunction(__FUNCTION__)(av, call_index, csettings); -} - +} + int toxav_reject(ToxAv *av, int32_t call_index, const char *reason) { return CreateFunction(__FUNCTION__)(av, call_index, reason); -} - +} + int toxav_cancel(ToxAv *av, int32_t call_index, int peer_id, const char *reason) { return CreateFunction(__FUNCTION__)(av, call_index, peer_id, reason); -} - +} + int toxav_change_settings(ToxAv *av, int32_t call_index, const ToxAvCSettings *csettings) { return CreateFunction(__FUNCTION__)(av, call_index, csettings); -} - +} + int toxav_stop_call(ToxAv *av, int32_t call_index) { return CreateFunction(__FUNCTION__)(av, call_index); -} - +} + int toxav_prepare_transmission(ToxAv *av, int32_t call_index, int support_video) { return CreateFunction(__FUNCTION__)(av, call_index, support_video); -} - +} + int toxav_kill_transmission(ToxAv *av, int32_t call_index) { return CreateFunction(__FUNCTION__)(av, call_index); -} - +} + int toxav_get_peer_csettings(ToxAv *av, int32_t call_index, int peer, ToxAvCSettings *dest) { return CreateFunction(__FUNCTION__)(av, call_index, peer, dest); -} - +} + int toxav_get_peer_id(ToxAv *av, int32_t call_index, int peer) { return CreateFunction(__FUNCTION__)(av, call_index, peer); -} - +} + ToxAvCallState toxav_get_call_state(ToxAv *av, int32_t call_index) { return CreateFunction(__FUNCTION__)(av, call_index); -} - +} + int toxav_capability_supported(ToxAv *av, int32_t call_index, ToxAvCapabilities capability) { return CreateFunction(__FUNCTION__)(av, call_index, capability); -} - +} + Tox *toxav_get_tox(ToxAv *av) { return CreateFunction(__FUNCTION__)(av); -} - +} + int toxav_get_active_count(ToxAv *av) { return CreateFunction(__FUNCTION__)(av); -} - -/* AUDIO FUNCTIONS */ - -void toxav_register_audio_callback(ToxAv *av, ToxAvAudioCallback cb, void *userdata) -{ - CreateFunction(__FUNCTION__)(av, cb, userdata); +} + +/* AUDIO FUNCTIONS */ + +void toxav_register_audio_callback(ToxAv *av, ToxAvAudioCallback cb, void *userdata) +{ + CreateFunction(__FUNCTION__)(av, cb, userdata); } \ No newline at end of file diff --git a/protocols/Tox/src/common.h b/protocols/Tox/src/common.h index 0c5fa59879..75c1e48f58 100644 --- a/protocols/Tox/src/common.h +++ b/protocols/Tox/src/common.h @@ -52,6 +52,7 @@ struct CToxProto; #include "tox_dialogs.h" #include "tox_options.h" #include "tox_transfer.h" +#include "tox_multimedia.h" #include "tox_chatrooms.h" #include "tox_proto.h" @@ -84,7 +85,10 @@ extern HINSTANCE g_hInstance; enum TOX_DB_EVENT { DB_EVENT_ACTION = 10001, - DB_EVENT_AUDIO_CALL = 20001 + DB_EVENT_AUDIO_CALL = 20001, + DB_EVENT_AUDIO_RING = 20002, + DB_EVENT_AUDIO_START = 20003, + DB_EVENT_AUDIO_END = 20004 }; #define PSR_AUDIO "/RecvAudio" diff --git a/protocols/Tox/src/resource.h b/protocols/Tox/src/resource.h index 8b06bab10e..5ffc062970 100644 --- a/protocols/Tox/src/resource.h +++ b/protocols/Tox/src/resource.h @@ -11,9 +11,13 @@ #define IDD_OPTIONS_NODES 107 #define IDD_ADDNODE 108 #define IDD_NODE_EDITOR 109 -#define IDI_ICON1 109 #define IDI_AUDIO_CALL 109 #define IDD_OPTIONS_AV 110 +#define IDD_AUDIO 111 +#define IDI_AUDIO_END 112 +#define IDI_AUDIO_RING 113 +#define IDI_ICON3 114 +#define IDI_AUDIO_START 114 #define IDD_CHATROOM_INVITE 172 #define IDC_CCLIST 173 #define IDC_EDITSCR 174 @@ -48,7 +52,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 110 +#define _APS_NEXT_RESOURCE_VALUE 115 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1025 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/protocols/Tox/src/tox_chatrooms.h b/protocols/Tox/src/tox_chatrooms.h index 0f51a7391e..419b26bacd 100644 --- a/protocols/Tox/src/tox_chatrooms.h +++ b/protocols/Tox/src/tox_chatrooms.h @@ -1,6 +1,8 @@ #ifndef _TOX_CHATROOMS_H_ #define _TOX_CHATROOMS_H_ +#define WM_AUDIO_END (WM_PROTO_LAST + 100) + struct ChatRoomInviteParam { CToxProto *proto; diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp index 255358d687..f1e21e955a 100644 --- a/protocols/Tox/src/tox_events.cpp +++ b/protocols/Tox/src/tox_events.cpp @@ -25,6 +25,21 @@ void CToxProto::InitCustomDbEvents() dbEventType.descr = Translate("Audio call"); dbEventType.eventIcon = GetIconHandle("audio_call"); CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType); + + dbEventType.eventType = DB_EVENT_AUDIO_RING; + dbEventType.descr = Translate("Audio ring"); + dbEventType.eventIcon = GetIconHandle("audio_ring"); + CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType); + + dbEventType.eventType = DB_EVENT_AUDIO_START; + dbEventType.descr = Translate("Audio start"); + dbEventType.eventIcon = GetIconHandle("audio_start"); + CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType); + + dbEventType.eventType = DB_EVENT_AUDIO_END; + dbEventType.descr = Translate("Audio end"); + dbEventType.eventIcon = GetIconHandle("audio_end"); + CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType); } int CToxProto::OnDbEventAdded(WPARAM hContact, LPARAM hEvent) @@ -56,10 +71,22 @@ int CToxProto::OnDbEventAdded(WPARAM hContact, LPARAM hEvent) switch (dbei.eventType) { case DB_EVENT_AUDIO_CALL: - mir_snprintf(szService, SIZEOF(szService), "%s/AudioCall", GetContactProto(hContact)); + mir_snprintf(szService, SIZEOF(szService), "%s/Audio/Call", GetContactProto(hContact)); + break; + + case DB_EVENT_AUDIO_RING: + mir_snprintf(szService, SIZEOF(szService), "%s/Audio/Ring", GetContactProto(hContact)); + break; + + case DB_EVENT_AUDIO_START: + mir_snprintf(szService, SIZEOF(szService), "%s/Audio/Start", GetContactProto(hContact)); + break; + + case DB_EVENT_AUDIO_END: + mir_snprintf(szService, SIZEOF(szService), "%s/Audio/End", GetContactProto(hContact)); break; - default: + default: return 0; } cle.pszService = szService; diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp index 9a62c5069b..5600283ae0 100644 --- a/protocols/Tox/src/tox_icons.cpp +++ b/protocols/Tox/src/tox_icons.cpp @@ -4,6 +4,9 @@ IconInfo CToxProto::Icons[] = { { LPGENT("Protocol icon"), "main", IDI_TOX }, { LPGENT("Audio call"), "audio_call", IDI_AUDIO_CALL }, + { LPGENT("Audio ring"), "audio_ring", IDI_AUDIO_RING }, + { LPGENT("Audio start"), "audio_start", IDI_AUDIO_START }, + { LPGENT("Audio end"), "audio_end", IDI_AUDIO_END }, }; void CToxProto::InitIcons() diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp index ba795bb0d7..3d6931eedc 100644 --- a/protocols/Tox/src/tox_multimedia.cpp +++ b/protocols/Tox/src/tox_multimedia.cpp @@ -1,5 +1,62 @@ #include "common.h" +/* AUDIO RECEIVING */ + +CToxAudioCall::CToxAudioCall(CToxProto *proto, int callId) : + CToxDlgBase(proto, IDD_AUDIO, false), callId(callId), + ok(this, IDOK), cancel(this, IDCANCEL) +{ + m_autoClose = CLOSE_ON_CANCEL; + ok.OnClick = Callback(this, &CToxAudioCall::OnOk); + cancel.OnClick = Callback(this, &CToxAudioCall::OnCancel); +} + +void CToxAudioCall::OnInitDialog() +{ + char iconName[100]; + mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "audio_call"); + SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIcon(iconName, 16)); + SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIcon(iconName, 32)); + + Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "AudioCallWindow"); +} + +void CToxAudioCall::OnOk(CCtrlBase*) +{ + ok.Enable(FALSE); + ToxAvCSettings cSettings;// = av_DefaultSettings; + //cSettings.call_type = av_TypeAudio; + toxav_get_peer_csettings(m_proto->toxAv, callId, 0, &cSettings); + + toxav_answer(m_proto->toxAv, callId, &cSettings); +} + +void CToxAudioCall::OnCancel(CCtrlBase*) +{ + if (ok.Enabled()) + toxav_reject(m_proto->toxAv, callId, NULL); + else + { + int friendNumber = toxav_get_peer_id(m_proto->toxAv, callId, 0); + toxav_cancel(m_proto->toxAv, callId, friendNumber, NULL); + } +} + +void CToxAudioCall::OnClose() +{ + WindowList_Remove(m_proto->hAudioDialogs, m_hwnd); + Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "AudioCallWindow"); +} + +INT_PTR CToxAudioCall::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) +{ + if (msg == WM_AUDIO_END) + Close(); + + return CToxDlgBase::DlgProc(msg, wParam, lParam); +} + +// incoming call flow void CToxProto::OnAvInvite(void*, int32_t callId, void *arg) { CToxProto *proto = (CToxProto*)arg; @@ -37,31 +94,59 @@ void CToxProto::OnAvInvite(void*, int32_t callId, void *arg) PROTORECVEVENT recv = { 0 }; recv.timestamp = time(NULL); - recv.flags = PREF_UTF; - recv.szMessage = mir_utf8encodeT(TranslateT("Incoming call")); + recv.lParam = callId; + //recv.flags = PREF_UTF; + //recv.szMessage = mir_utf8encodeT(TranslateT("Incoming audio call")); ProtoChainRecv(hContact, PSR_AUDIO, hContact, (LPARAM)&recv); } +// save event to db INT_PTR CToxProto::OnRecvAudioCall(WPARAM hContact, LPARAM lParam) { PROTORECVEVENT *pre = (PROTORECVEVENT*)lParam; + calls[hContact] = pre->lParam; + DBEVENTINFO dbei = { sizeof(dbei) }; dbei.szModule = m_szModuleName; dbei.timestamp = pre->timestamp; - dbei.flags = DBEF_UTF; - dbei.eventType = DB_EVENT_AUDIO_CALL; - dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1; - dbei.pBlob = (PBYTE)pre->szMessage; + //dbei.flags = DBEF_UTF; + dbei.eventType = DB_EVENT_AUDIO_RING; + + //dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1; + //dbei.pBlob = (PBYTE)pre->szMessage; return (INT_PTR)db_event_add(hContact, &dbei); } +// +INT_PTR CToxProto::OnAudioRing(WPARAM hContact, LPARAM lParam) +{ + CToxAudioCall *audioCall = new CToxAudioCall(this, calls[hContact]); + audioCall->Show(); + WindowList_Add(hAudioDialogs, audioCall->GetHwnd(), hContact); + return 0; +} + void CToxProto::OnAvRinging(void*, int32_t callId, void *arg) { } void CToxProto::OnAvStart(void*, int32_t callId, void *arg) { } -void CToxProto::OnAvEnd(void*, int32_t callId, void *arg) { } + +void CToxProto::OnAvEnd(void*, int32_t callId, void *arg) +{ + CToxProto *proto = (CToxProto*)arg; + + WindowList_Broadcast(proto->hAudioDialogs, WM_AUDIO_END, 0, 0); +} + void CToxProto::OnAvReject(void*, int32_t callId, void *arg) { } -void CToxProto::OnAvCancel(void*, int32_t callId, void *arg) { } + +void CToxProto::OnAvCancel(void*, int32_t callId, void *arg) +{ + CToxProto *proto = (CToxProto*)arg; + + WindowList_Broadcast(proto->hAudioDialogs, WM_AUDIO_END, 0, 0); +} + void CToxProto::OnAvCsChange(void*, int32_t callId, void *arg) { } void CToxProto::OnAvRequestTimeout(void*, int32_t callId, void *arg) { } void CToxProto::OnAvPeerTimeout(void*, int32_t callId, void *arg) { } diff --git a/protocols/Tox/src/tox_multimedia.h b/protocols/Tox/src/tox_multimedia.h new file mode 100644 index 0000000000..3dd5ad475b --- /dev/null +++ b/protocols/Tox/src/tox_multimedia.h @@ -0,0 +1,24 @@ +#ifndef _TOX_MULTIMEDIA_H_ +#define _TOX_MULTIMEDIA_H_ + +class CToxAudioCall : public CToxDlgBase +{ +private: + int callId; + + CCtrlButton ok; + CCtrlButton cancel; + +protected: + void OnInitDialog(); + void OnOk(CCtrlBase*); + void OnCancel(CCtrlBase*); + void OnClose(); + + INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam); + +public: + CToxAudioCall(CToxProto *proto, int callId); +}; + +#endif //_TOX_MULTIMEDIA_H_ \ No newline at end of file diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 55285f9b31..0b3947cd74 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -14,6 +14,7 @@ CToxProto::CToxProto(const char* protoName, const TCHAR* userName) : // services CreateProtoService(PSR_AUDIO, &CToxProto::OnRecvAudioCall); + CreateProtoService("/Audio/Ring", &CToxProto::OnAudioRing); // avatars CreateProtoService(PS_GETAVATARCAPS, &CToxProto::GetAvatarCaps); @@ -23,10 +24,14 @@ CToxProto::CToxProto(const char* protoName, const TCHAR* userName) : // nick CreateProtoService(PS_SETMYNICKNAME, &CToxProto::SetMyNickname); + + hAudioDialogs = WindowList_Create(); } CToxProto::~CToxProto() { + WindowList_Destroy(hAudioDialogs); + mir_free(accountName); UninitNetlib(); } @@ -213,12 +218,10 @@ int CToxProto::SetAwayMsg(int, const PROTOCHAR *msg) { if (IsOnline()) { - ptrA statusMessage(msg == NULL ? mir_strdup("") : mir_utf8encodeT(msg)); + ptrA statusMessage(mir_utf8encodeT(msg)); TOX_ERR_SET_INFO error; if (tox_self_set_status_message(tox, (uint8_t*)(char*)statusMessage, min(TOX_MAX_STATUS_MESSAGE_LENGTH, mir_strlen(statusMessage)), &error)) - { debugLogA("CToxProto::SetAwayMsg: failed to set status status message %s (%d)", msg, error); - } } return 0; diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 8d75753713..6fc1dc9c9c 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -6,9 +6,9 @@ struct CToxProto : public PROTO friend CToxPasswordEditor; friend CToxOptionsMain; friend CToxOptionsNodeList; + friend CToxAudioCall; public: - ////////////////////////////////////////////////////////////////////////////////////// //Ctors @@ -241,8 +241,12 @@ private: void OnGotFriendAvatarInfo(FileTransferParam *transfer, const uint8_t *hash); // multimedia - std::map calls; + HANDLE hAudioDialogs; + std::map calls; + static void OnFriendAudio(void *agent, int32_t callId, const int16_t *PCM, uint16_t size, void *arg); + INT_PTR __cdecl OnRecvAudioCall(WPARAM wParam, LPARAM lParam); + INT_PTR __cdecl OnAudioRing(WPARAM hContact, LPARAM lParam); static void OnAvInvite(void*, int32_t callId, void *arg); static void OnAvRinging(void*, int32_t callId, void *arg); @@ -254,8 +258,6 @@ private: static void OnAvRequestTimeout(void*, int32_t callId, void *arg); static void OnAvPeerTimeout(void*, int32_t callId, void *arg); - INT_PTR __cdecl OnRecvAudioCall(WPARAM wParam, LPARAM lParam); - // utils TOX_USER_STATUS MirandaToToxStatus(int status); int ToxToMirandaStatus(TOX_USER_STATUS userstatus); -- cgit v1.2.3