From bdbdf8d3391d2da3df0d4eeabac41fa73aa821fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Tue, 20 Oct 2015 10:13:30 +0000 Subject: Omegle: Format sources git-svn-id: http://svn.miranda-ng.org/main/trunk@15579 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Omegle/src/connection.cpp | 49 ++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 23 deletions(-) (limited to 'protocols/Omegle/src/connection.cpp') diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp index 12d8c3337c..870c8ea905 100644 --- a/protocols/Omegle/src/connection.cpp +++ b/protocols/Omegle/src/connection.cpp @@ -25,18 +25,18 @@ along with this program. If not, see . void OmegleProto::SignOn(void*) { SYSTEMTIME t; - GetLocalTime( &t ); + GetLocalTime(&t); debugLogA("[%d.%d.%d] Using Omegle Protocol %s", t.wDay, t.wMonth, t.wYear, __VERSION_STRING_DOTS); - + ScopedLock s(signon_lock_); int old_status = m_iStatus; m_iStatus = m_iDesiredStatus; ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); - setDword( "LogonTS", (DWORD)time(NULL)); + setDword("LogonTS", (DWORD)time(NULL)); ClearChat(); - OnJoinChat(0,false); + OnJoinChat(0, false); if (getByte(OMEGLE_KEY_AUTO_CONNECT, 0)) NewChat(); @@ -57,7 +57,7 @@ void OmegleProto::SignOff(void*) delSetting("LogonTS"); - ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_iStatus); + ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); //SetAllContactStatuses( ID_STATUS_OFFLINE ); //ToggleStatusMenuItems(false); @@ -70,8 +70,9 @@ void OmegleProto::SignOff(void*) void OmegleProto::StopChat(bool disconnect) { if (facy.state_ == STATE_WAITING) { - UpdateChat(NULL, TranslateT("Connecting canceled."), false); - } else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY) { + UpdateChat(NULL, TranslateT("Connecting canceled."), false); + } + else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY) { bool spy = facy.state_ == STATE_SPY; if (disconnect) @@ -82,13 +83,14 @@ void OmegleProto::StopChat(bool disconnect) if (facy.stop()) debugLogA("***** Disconnected from stranger %s", facy.chat_id_.c_str()); else - debugLogA("***** Error in disconnecting from stranger %s", facy.chat_id_.c_str()); - } + debugLogA("***** Error in disconnecting from stranger %s", facy.chat_id_.c_str()); + } if (spy) { DeleteChatContact(TranslateT("Stranger 1")); DeleteChatContact(TranslateT("Stranger 2")); - } else { + } + else { DeleteChatContact(TranslateT("Stranger")); } @@ -111,7 +113,7 @@ void OmegleProto::NewChat() return; } else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY) - { + { UpdateChat(NULL, TranslateT("Disconnecting..."), true); if (facy.stop()) @@ -121,21 +123,22 @@ void OmegleProto::NewChat() if (facy.state_ == STATE_SPY) { DeleteChatContact(TranslateT("Stranger 1")); - DeleteChatContact(TranslateT("Stranger 2")); - } else { + DeleteChatContact(TranslateT("Stranger 2")); + } + else { DeleteChatContact(TranslateT("Stranger")); } SetTopic(); // reset topic content ClearChat(); - + UpdateChat(NULL, TranslateT("Connecting..."), true); facy.state_ = STATE_WAITING; if (facy.start()) - { + { UpdateChat(NULL, TranslateT("Waiting for Stranger..."), true); debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str()); } @@ -153,14 +156,14 @@ void OmegleProto::NewChat() facy.state_ = STATE_WAITING; if (facy.start()) - { + { UpdateChat(NULL, TranslateT("Waiting for Stranger..."), true); debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str()); - ForkThread( &OmegleProto::EventsLoop, this ); + ForkThread(&OmegleProto::EventsLoop, this); } } - + } void OmegleProto::EventsLoop(void *) @@ -168,15 +171,15 @@ void OmegleProto::EventsLoop(void *) ScopedLock s(events_loop_lock_); time_t tim = ::time(NULL); - debugLogA( ">>>>> Entering Omegle::EventsLoop[%d]", tim ); + debugLogA(">>>>> Entering Omegle::EventsLoop[%d]", tim); - while ( facy.events()) + while (facy.events()) { - if ( facy.state_ == STATE_INACTIVE || facy.state_ == STATE_DISCONNECTING || !isOnline()) + if (facy.state_ == STATE_INACTIVE || facy.state_ == STATE_DISCONNECTING || !isOnline()) break; - debugLogA( "***** OmegleProto::EventsLoop[%d] refreshing...", tim ); + debugLogA("***** OmegleProto::EventsLoop[%d] refreshing...", tim); } ResetEvent(events_loop_lock_); - debugLogA( "<<<<< Exiting OmegleProto::EventsLoop[%d]", tim ); + debugLogA("<<<<< Exiting OmegleProto::EventsLoop[%d]", tim); } -- cgit v1.2.3