From 3becde66074e1c9693e9cb06d83badb2d859bdfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sat, 18 Jan 2014 07:19:16 +0000 Subject: Omegle: Fix /asl command git-svn-id: http://svn.miranda-ng.org/main/trunk@7706 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Omegle/src/chat.cpp | 46 +++++++++++++++++++++++++------------------ protocols/Omegle/src/proto.h | 1 + 2 files changed, 28 insertions(+), 19 deletions(-) (limited to 'protocols') diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index 2ab09ef2f0..31fb4ae58b 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -133,6 +133,8 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam) if ( !getU8String( OMEGLE_KEY_ASL,&dbv )) { text = dbv.pszVal; db_free(&dbv); + + SendChatMessage(text); } else { UpdateChat(NULL, TranslateT("Your '/asl' setting is empty."), false); break; @@ -165,26 +167,9 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam) break; } - } else switch (facy.state_) { + } else { // Outgoing message - - case STATE_ACTIVE: - debugLogA("**Chat - Outgoing message: %s", text.c_str()); - ForkThread(&OmegleProto::SendMsgWorker, new std::string(text)); - break; - - case STATE_INACTIVE: - UpdateChat(NULL, TranslateT("You aren't connected to any stranger. Send '/help' or '/commands' for help."), false); - break; - - case STATE_SPY: - UpdateChat(NULL, TranslateT("You can't send messages in question mode."), false); - break; - - //case STATE_WAITING: - //case STATE_DISCONNECTING: - default: - break; + SendChatMessage(text); } break; @@ -205,6 +190,29 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam) return 0; } +void OmegleProto::SendChatMessage(std::string text) +{ + switch (facy.state_) { + case STATE_ACTIVE: + debugLogA("**Chat - Outgoing message: %s", text.c_str()); + ForkThread(&OmegleProto::SendMsgWorker, new std::string(text)); + break; + + case STATE_INACTIVE: + UpdateChat(NULL, TranslateT("You aren't connected to any stranger. Send '/help' or '/commands' for help."), false); + break; + + case STATE_SPY: + UpdateChat(NULL, TranslateT("You can't send messages in question mode."), false); + break; + + //case STATE_WAITING: + //case STATE_DISCONNECTING: + default: + break; + } +} + /*void OmegleProto::SendChatEvent(int type) { GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL }; diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index a27e8f24b9..dc774a56b3 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -126,6 +126,7 @@ public: // Chat handling void AddChat(const TCHAR *id,const TCHAR *name); void UpdateChat(const TCHAR *name, const TCHAR *message, bool addtochat = true); + void SendChatMessage(std::string message); void AddChatContact(const TCHAR *nick); void DeleteChatContact(const TCHAR *name); void SetChatStatus(int); -- cgit v1.2.3