diff options
author | George Hazan <ghazan@miranda.im> | 2018-08-12 18:36:31 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-08-12 18:36:38 +0300 |
commit | bd44f4f713e9768251691de07b0ed50f86573965 (patch) | |
tree | cd8b60681e630dc3cc9854a44597dbd288c92de4 | |
parent | 4141c732c40bbd021512aab2f06a6abb0a5a76c1 (diff) |
Omegle: code cleaning
-rw-r--r-- | protocols/Omegle/src/chat.cpp | 244 | ||||
-rw-r--r-- | protocols/Omegle/src/connection.cpp | 44 | ||||
-rw-r--r-- | protocols/Omegle/src/db.h | 33 | ||||
-rw-r--r-- | protocols/Omegle/src/dialogs.cpp | 79 | ||||
-rw-r--r-- | protocols/Omegle/src/messages.cpp | 3 | ||||
-rw-r--r-- | protocols/Omegle/src/proto.cpp | 15 | ||||
-rw-r--r-- | protocols/Omegle/src/theme.h | 4 | ||||
-rw-r--r-- | protocols/Omegle/src/version.h | 2 |
8 files changed, 171 insertions, 253 deletions
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index a65ac5b839..ad42a0601f 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -21,11 +21,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
+const wchar_t msgChatModes[] =
+LPGENW("There are three different modes of chatting:\
+\n1) Standard mode\t - You chat with random stranger privately\
+\n2) Question mode\t - You ask two strangers a question and see how they discuss it (you can't join their conversation, only watch)\
+\n3) Spy mode\t - You and stranger got a question to discuss from third stranger (he can't join your conversation, only watch)\
+\n\nSend '/commands' for available commands.");
+
+const wchar_t msgChatCommands[] =
+LPGENW("You can use different commands:\
+\n/help\t - show info about chat modes\
+\n/new\t - start standard mode\
+\n/ask <question> - start question mode with your question\
+\n/ask\t - start question mode with your last asked question\
+\n/spy\t - start spy mode\
+\n/quit\t - disconnect from stranger or stop connecting\
+\n/asl\t - send your predefined ASL message\
+\n\nNote: You can reconnect to different stranger without disconnecting from current one.");
+
void OmegleProto::UpdateChat(const wchar_t *name, const wchar_t *message, bool addtolog)
{
+ if (message == nullptr)
+ return;
+
// replace % to %% to not interfere with chat color codes
- std::wstring smessage = message;
- utils::text::treplace_all(&smessage, L"%", L"%%");
+ CMStringW smessage(message);
+ smessage.Replace(L"%", L"%%");
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
gce.time = ::time(0);
@@ -53,137 +74,106 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) if (mir_strcmp(hook->pszModule, m_szModuleName))
return 0;
- switch (hook->iType)
- {
+ switch (hook->iType) {
case GC_USER_MESSAGE:
- {
- std::string text = mir_u2a_cp(hook->ptszText, CP_UTF8);
+ {
+ std::string text = mir_u2a_cp(hook->ptszText, CP_UTF8);
- // replace %% back to %, because chat automatically does this to sent messages
- utils::text::replace_all(&text, "%%", "%");
+ // replace %% back to %, because chat automatically does this to sent messages
+ utils::text::replace_all(&text, "%%", "%");
- if (text.empty())
- break;
+ if (text.empty())
+ break;
- if (text.substr(0, 1) == "/")
- { // Process commands
+ if (text.substr(0, 1) == "/") { // Process commands
- std::string command = "";
- std::string params = "";
+ std::string command = "";
+ std::string params = "";
- std::string::size_type pos = 0;
- if ((pos = text.find(" ")) != std::string::npos) {
- command = text.substr(1, pos - 1);
- params = text.substr(pos + 1);
- }
- else {
- command = text.substr(1);
- }
+ std::string::size_type pos = 0;
+ if ((pos = text.find(" ")) != std::string::npos) {
+ command = text.substr(1, pos - 1);
+ params = text.substr(pos + 1);
+ }
+ else command = text.substr(1);
- if (!mir_strcmpi(command.c_str(), "new"))
- {
- facy.spy_mode_ = false;
- facy.question_.clear();
+ if (!mir_strcmpi(command.c_str(), "new")) {
+ facy.spy_mode_ = false;
+ facy.question_.clear();
- ForkThread(&OmegleProto::NewChatWorker, nullptr);
- break;
- }
- else if (!mir_strcmpi(command.c_str(), "quit"))
- {
- ForkThread(&OmegleProto::StopChatWorker, nullptr);
- break;
- }
- else if (!mir_strcmpi(command.c_str(), "spy"))
- {
- facy.spy_mode_ = true;
- facy.question_.clear();
+ ForkThread(&OmegleProto::NewChatWorker, nullptr);
+ break;
+ }
+ else if (!mir_strcmpi(command.c_str(), "quit")) {
+ ForkThread(&OmegleProto::StopChatWorker, nullptr);
+ break;
+ }
+ else if (!mir_strcmpi(command.c_str(), "spy")) {
+ facy.spy_mode_ = true;
+ facy.question_.clear();
- ForkThread(&OmegleProto::NewChatWorker, nullptr);
- break;
- }
- else if (!mir_strcmpi(command.c_str(), "ask"))
- {
- if (params.empty()) {
- // Load last question
- DBVARIANT dbv;
- if (!getU8String(OMEGLE_KEY_LAST_QUESTION, &dbv)) {
- params = dbv.pszVal;
- db_free(&dbv);
+ ForkThread(&OmegleProto::NewChatWorker, nullptr);
+ break;
+ }
+ else if (!mir_strcmpi(command.c_str(), "ask")) {
+ if (params.empty()) {
+ // Load last question
+ DBVARIANT dbv;
+ if (!getU8String(OMEGLE_KEY_LAST_QUESTION, &dbv)) {
+ params = dbv.pszVal;
+ db_free(&dbv);
+ }
+
+ if (params.empty()) {
+ UpdateChat(nullptr, TranslateT("Last question is empty."), false);
+ break;
+ }
+ }
+ else {
+ // Save actual question as last question
+ if (params.length() >= OMEGLE_QUESTION_MIN_LENGTH)
+ setU8String(OMEGLE_KEY_LAST_QUESTION, params.c_str());
}
- if (params.empty()) {
- UpdateChat(nullptr, TranslateT("Last question is empty."), false);
+ if (params.length() < OMEGLE_QUESTION_MIN_LENGTH) {
+ UpdateChat(nullptr, TranslateT("Your question is too short."), false);
break;
}
- }
- else {
- // Save actual question as last question
- if (params.length() >= OMEGLE_QUESTION_MIN_LENGTH)
- {
- setU8String(OMEGLE_KEY_LAST_QUESTION, params.c_str());
- }
- }
- if (params.length() < OMEGLE_QUESTION_MIN_LENGTH)
- {
- UpdateChat(nullptr, TranslateT("Your question is too short."), false);
+ facy.spy_mode_ = true;
+ facy.question_ = params;
+ ForkThread(&OmegleProto::NewChatWorker, nullptr);
break;
}
+ else if (!mir_strcmpi(command.c_str(), "asl")) {
+ DBVARIANT dbv;
+ if (!getU8String(OMEGLE_KEY_ASL, &dbv)) {
+ text = dbv.pszVal;
+ db_free(&dbv);
- facy.spy_mode_ = true;
- facy.question_ = params;
- ForkThread(&OmegleProto::NewChatWorker, nullptr);
- break;
- }
- else if (!mir_strcmpi(command.c_str(), "asl"))
- {
- DBVARIANT dbv;
- if (!getU8String(OMEGLE_KEY_ASL, &dbv)) {
- text = dbv.pszVal;
- db_free(&dbv);
-
- SendChatMessage(text);
+ SendChatMessage(text);
+ }
+ else {
+ UpdateChat(nullptr, TranslateT("Your '/asl' setting is empty."), false);
+ break;
+ }
+ }
+ else if (!mir_strcmpi(command.c_str(), "help")) {
+ UpdateChat(nullptr, TranslateW(msgChatModes), false);
+ }
+ else if (!mir_strcmpi(command.c_str(), "commands")) {
+ UpdateChat(nullptr, TranslateW(msgChatCommands), false);
+ break;
}
else {
- UpdateChat(nullptr, TranslateT("Your '/asl' setting is empty."), false);
+ UpdateChat(nullptr, TranslateT("Unknown command. Send '/commands' for list."), false);
break;
}
}
- else if (!mir_strcmpi(command.c_str(), "help"))
- {
- UpdateChat(nullptr, TranslateT("There are three different modes of chatting:\
-\n1) Standard mode\t - You chat with random stranger privately\
-\n2) Question mode\t - You ask two strangers a question and see how they discuss it (you can't join their conversation, only watch)\
-\n3) Spy mode\t - You and stranger got a question to discuss from third stranger (he can't join your conversation, only watch)\
-\n\nSend '/commands' for available commands."), false);
- }
- else if (!mir_strcmpi(command.c_str(), "commands"))
- {
- UpdateChat(nullptr, TranslateT("You can use different commands:\
-\n/help\t - show info about chat modes\
-\n/new\t - start standard mode\
-\n/ask <question> - start question mode with your question\
-\n/ask\t - start question mode with your last asked question\
-\n/spy\t - start spy mode\
-\n/quit\t - disconnect from stranger or stop connecting\
-\n/asl\t - send your predefined ASL message\
-\n\nNote: You can reconnect to different stranger without disconnecting from current one."), false);
- break;
- }
- else
- {
- UpdateChat(nullptr, TranslateT("Unknown command. Send '/commands' for list."), false);
- break;
- }
-
+ else // Outgoing message
+ SendChatMessage(text);
}
- else {
- // Outgoing message
- SendChatMessage(text);
- }
-
break;
- }
case GC_USER_LEAVE:
case GC_SESSION_TERMINATE:
@@ -210,20 +200,9 @@ void OmegleProto::SendChatMessage(std::string text) case STATE_SPY:
UpdateChat(nullptr, TranslateT("You can't send messages in question mode."), false);
break;
-
- //case STATE_WAITING:
- //case STATE_DISCONNECTING:
- default:
- break;
}
}
-/*void OmegleProto::SendChatEvent(int type)
-{
-GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
-Chat_Event(WINDOW_CLEARLOG,&gce);
-}*/
-
void OmegleProto::AddChatContact(const wchar_t *name)
{
GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
@@ -303,8 +282,7 @@ INT_PTR OmegleProto::OnLeaveChat(WPARAM, LPARAM) void OmegleProto::SetChatStatus(int status)
{
- if (status == ID_STATUS_ONLINE)
- {
+ if (status == ID_STATUS_ONLINE) {
// Load actual name from database
facy.nick_ = db_get_wsa(NULL, m_szModuleName, OMEGLE_KEY_NAME);
if (facy.nick_ == NULL) {
@@ -318,10 +296,7 @@ void OmegleProto::SetChatStatus(int status) Chat_Control(m_szModuleName, m_tszUserName, SESSION_INITDONE);
Chat_Control(m_szModuleName, m_tszUserName, SESSION_ONLINE);
}
- else
- {
- Chat_Control(m_szModuleName, m_tszUserName, SESSION_OFFLINE);
- }
+ else Chat_Control(m_szModuleName, m_tszUserName, SESSION_OFFLINE);
}
void OmegleProto::ClearChat()
@@ -333,24 +308,11 @@ void OmegleProto::ClearChat() // TODO: Could this be done better?
MCONTACT OmegleProto::GetChatHandle()
{
- /*if (facy.chatHandle_ != NULL)
- return facy.chatHandle_;
-
- for (auto &hContact : AccContacts()) {
- if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0) > 0) {
- ptrA id = db_get_sa(hContact, m_szModuleName, "ChatRoomId");
- if (id != NULL && !mir_strcmp(id, m_szModuleName))
- return hContact;
- }
- }
-
- return NULL;*/
-
- GC_INFO gci = { 0 };
+ GC_INFO gci = {};
gci.Flags = GCF_HCONTACT;
gci.pszModule = m_szModuleName;
gci.pszID = m_tszUserName;
Chat_GetInfo(&gci);
return gci.hContact;
-}
\ No newline at end of file +}
diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp index b8e71ab95d..acee01471e 100644 --- a/protocols/Omegle/src/connection.cpp +++ b/protocols/Omegle/src/connection.cpp @@ -40,8 +40,6 @@ void OmegleProto::SignOn(void*) if (getByte(OMEGLE_KEY_AUTO_CONNECT, 0))
NewChat();
-
- //ToggleStatusMenuItems(true);
}
void OmegleProto::SignOff(void*)
@@ -59,9 +57,6 @@ void OmegleProto::SignOff(void*) ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
- //SetAllContactStatuses( ID_STATUS_OFFLINE );
- //ToggleStatusMenuItems(false);
-
if (facy.hEventsConnection)
Netlib_CloseHandle(facy.hEventsConnection);
facy.hEventsConnection = nullptr;
@@ -69,14 +64,13 @@ void OmegleProto::SignOff(void*) void OmegleProto::StopChat(bool disconnect)
{
- if (facy.state_ == STATE_WAITING) {
+ if (facy.state_ == STATE_WAITING)
UpdateChat(nullptr, TranslateT("Connecting canceled."), false);
- }
+
else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY) {
bool spy = facy.state_ == STATE_SPY;
- if (disconnect)
- {
+ if (disconnect) {
facy.state_ = STATE_DISCONNECTING;
UpdateChat(nullptr, TranslateT("Disconnecting..."), true);
@@ -90,18 +84,13 @@ void OmegleProto::StopChat(bool disconnect) DeleteChatContact(TranslateT("Stranger 1"));
DeleteChatContact(TranslateT("Stranger 2"));
}
- else {
- DeleteChatContact(TranslateT("Stranger"));
- }
+ else DeleteChatContact(TranslateT("Stranger"));
SetTopic(); // reset topic content
Srmm_SetStatusText(GetChatHandle(), nullptr);
}
- else
- { // disconnecting or inactive
- return;
- }
+ else return; // disconnecting or inactive
facy.state_ = STATE_INACTIVE;
facy.chat_id_.clear();
@@ -109,13 +98,12 @@ void OmegleProto::StopChat(bool disconnect) void OmegleProto::NewChat()
{
- if (facy.state_ == STATE_WAITING)
- {
+ if (facy.state_ == STATE_WAITING) {
UpdateChat(nullptr, TranslateT("We are already waiting for new stranger..."), false);
return;
}
- else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY)
- {
+
+ if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY) {
UpdateChat(nullptr, TranslateT("Disconnecting..."), true);
if (facy.stop())
@@ -139,33 +127,28 @@ void OmegleProto::NewChat() facy.state_ = STATE_WAITING;
- if (facy.start())
- {
+ if (facy.start()) {
UpdateChat(nullptr, TranslateT("Waiting for Stranger..."), true);
debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str());
}
}
- else if (facy.state_ == STATE_DISCONNECTING)
- {
+ else if (facy.state_ == STATE_DISCONNECTING) {
//UpdateChat(NULL, TranslateT("We are disconnecting now, wait..."), false);
return;
}
- else
- {
+ else {
ClearChat();
UpdateChat(nullptr, TranslateT("Connecting..."), true);
facy.state_ = STATE_WAITING;
- if (facy.start())
- {
+ if (facy.start()) {
UpdateChat(nullptr, TranslateT("Waiting for Stranger..."), true);
debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str());
ForkThread(&OmegleProto::EventsLoop, this);
}
}
-
}
void OmegleProto::EventsLoop(void *)
@@ -175,8 +158,7 @@ void OmegleProto::EventsLoop(void *) time_t tim = ::time(0);
debugLogA(">>>>> Entering Omegle::EventsLoop[%d]", tim);
- while (facy.events())
- {
+ while (facy.events()) {
if (facy.state_ == STATE_INACTIVE || facy.state_ == STATE_DISCONNECTING || !isOnline())
break;
debugLogA("***** OmegleProto::EventsLoop[%d] refreshing...", tim);
diff --git a/protocols/Omegle/src/db.h b/protocols/Omegle/src/db.h index f36734933d..f33d21e03e 100644 --- a/protocols/Omegle/src/db.h +++ b/protocols/Omegle/src/db.h @@ -25,20 +25,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // DB macros
#define getU8String( setting, dest ) db_get_utf( NULL, m_szModuleName, setting, dest )
#define setU8String( setting, value ) db_set_utf( NULL, m_szModuleName, setting, value )
+
// DB settings
-#define OMEGLE_KEY_TIMEOUTS_LIMIT "TimeoutsLimit" // [HIDDEN]
-
-#define OMEGLE_KEY_ASL "MessageAsl"
-#define OMEGLE_KEY_HI "MessageHi"
-#define OMEGLE_KEY_HI_ENABLED "MessageHiEnabled"
-#define OMEGLE_KEY_NAME "Nick"
-#define OMEGLE_KEY_DONT_STOP "DontStop"
-#define OMEGLE_KEY_NO_CLEAR "NoClear"
-#define OMEGLE_KEY_MEET_COMMON "MeetCommon"
-#define OMEGLE_KEY_INTERESTS "Interests"
-#define OMEGLE_KEY_REUSE_QUESTION "ReuseQuestion"
-#define OMEGLE_KEY_SERVER "Server"
-#define OMEGLE_KEY_LANGUAGE "Language"
-#define OMEGLE_KEY_SERVER_INFO "GetServerInfo"
-#define OMEGLE_KEY_LAST_QUESTION "LastQuestion"
-#define OMEGLE_KEY_AUTO_CONNECT "AutoConnect"
+#define OMEGLE_KEY_TIMEOUTS_LIMIT "TimeoutsLimit" // [HIDDEN]
+
+#define OMEGLE_KEY_ASL "MessageAsl"
+#define OMEGLE_KEY_HI "MessageHi"
+#define OMEGLE_KEY_HI_ENABLED "MessageHiEnabled"
+#define OMEGLE_KEY_NAME "Nick"
+#define OMEGLE_KEY_DONT_STOP "DontStop"
+#define OMEGLE_KEY_NO_CLEAR "NoClear"
+#define OMEGLE_KEY_MEET_COMMON "MeetCommon"
+#define OMEGLE_KEY_INTERESTS "Interests"
+#define OMEGLE_KEY_REUSE_QUESTION "ReuseQuestion"
+#define OMEGLE_KEY_SERVER "Server"
+#define OMEGLE_KEY_LANGUAGE "Language"
+#define OMEGLE_KEY_SERVER_INFO "GetServerInfo"
+#define OMEGLE_KEY_LAST_QUESTION "LastQuestion"
+#define OMEGLE_KEY_AUTO_CONNECT "AutoConnect"
diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp index f1c93b3414..e972efa885 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -48,22 +48,17 @@ static void StoreDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* sz wchar_t tstr[250 + 1];
GetDlgItemText(hwnd, idCtrl, tstr, _countof(tstr));
- if (tstr[0] != '\0') {
+ if (tstr[0] != '\0')
db_set_ws(NULL, ppro->m_szModuleName, szSetting, tstr);
- }
- else {
+ else
db_unset(NULL, ppro->m_szModuleName, szSetting);
- }
}
-
INT_PTR CALLBACK OmegleAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
OmegleProto *proto;
- switch (message)
- {
-
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
@@ -86,35 +81,33 @@ INT_PTR CALLBACK OmegleAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARA LoadDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
LoadDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
LoadDBCheckState(proto, hwnd, IDC_MEET_COMMON, OMEGLE_KEY_MEET_COMMON);
-
return TRUE;
case WM_COMMAND:
- switch (LOWORD(wparam))
- {
+ switch (LOWORD(wparam)) {
case IDC_LANGUAGE:
case IDC_SERVER:
- if (HIWORD(wparam) == CBN_SELCHANGE) {
+ if (HIWORD(wparam) == CBN_SELCHANGE)
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
+ break;
+
case IDC_NAME:
case IDC_INTERESTS:
- if (HIWORD(wparam) != EN_CHANGE || (HWND)lparam != GetFocus()) {
+ if (HIWORD(wparam) != EN_CHANGE || (HWND)lparam != GetFocus())
return TRUE;
- }
- else {
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
+
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
+
case IDC_MEET_COMMON:
- if (HIWORD(wparam) == BN_CLICKED) {
+ if (HIWORD(wparam) == BN_CLICKED)
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
+ break;
}
break;
case WM_NOTIFY:
- if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
- {
+ if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY) {
proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
@@ -123,11 +116,9 @@ INT_PTR CALLBACK OmegleAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARA StoreDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
StoreDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
StoreDBCheckState(proto, hwnd, IDC_MEET_COMMON, OMEGLE_KEY_MEET_COMMON);
-
return TRUE;
}
break;
-
}
return FALSE;
}
@@ -136,11 +127,8 @@ INT_PTR CALLBACK OmegleOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARA {
OmegleProto *proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
- switch (message)
- {
-
+ switch (message) {
case WM_INITDIALOG:
- {
TranslateDialogDefault(hwnd);
proto = reinterpret_cast<OmegleProto*>(lparam);
@@ -174,28 +162,25 @@ INT_PTR CALLBACK OmegleOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARA LoadDBCheckState(proto, hwnd, IDC_REUSE_QUESTIONS, OMEGLE_KEY_REUSE_QUESTION);
LoadDBCheckState(proto, hwnd, IDC_SERVER_INFO, OMEGLE_KEY_SERVER_INFO);
LoadDBCheckState(proto, hwnd, IDC_AUTO_CONNECT, OMEGLE_KEY_AUTO_CONNECT);
+ return TRUE;
- } return TRUE;
-
- case WM_COMMAND: {
-
- switch (LOWORD(wparam))
- {
+ case WM_COMMAND:
+ switch (LOWORD(wparam)) {
case IDC_SERVER:
case IDC_LANGUAGE:
- if (HIWORD(wparam) == CBN_SELCHANGE) {
+ if (HIWORD(wparam) == CBN_SELCHANGE)
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
+ break;
+
case IDC_NAME:
case IDC_INTERESTS:
case IDC_HI_MESSAGE:
case IDC_ASL_MESSAGE:
- if (HIWORD(wparam) != EN_CHANGE || (HWND)lparam != GetFocus()) {
+ if (HIWORD(wparam) != EN_CHANGE || (HWND)lparam != GetFocus())
return TRUE;
- }
- else {
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
+
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
case IDC_MEET_COMMON:
case IDC_HI_ENABLED:
case IDC_NOCLEAR:
@@ -203,16 +188,14 @@ INT_PTR CALLBACK OmegleOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARA case IDC_REUSE_QUESTIONS:
case IDC_SERVER_INFO:
case IDC_AUTO_CONNECT:
- if (HIWORD(wparam) == BN_CLICKED) {
+ if (HIWORD(wparam) == BN_CLICKED)
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- } break;
+ break;
}
-
- } break;
+ break;
case WM_NOTIFY:
- if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
- {
+ if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY) {
proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
@@ -230,11 +213,9 @@ INT_PTR CALLBACK OmegleOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARA StoreDBCheckState(proto, hwnd, IDC_REUSE_QUESTIONS, OMEGLE_KEY_REUSE_QUESTION);
StoreDBCheckState(proto, hwnd, IDC_SERVER_INFO, OMEGLE_KEY_SERVER_INFO);
StoreDBCheckState(proto, hwnd, IDC_AUTO_CONNECT, OMEGLE_KEY_AUTO_CONNECT);
-
return TRUE;
}
break;
-
}
return FALSE;
diff --git a/protocols/Omegle/src/messages.cpp b/protocols/Omegle/src/messages.cpp index 7abc55e6fb..6ac66deb75 100644 --- a/protocols/Omegle/src/messages.cpp +++ b/protocols/Omegle/src/messages.cpp @@ -32,8 +32,7 @@ void OmegleProto::SendMsgWorker(void *p) data = utils::text::trim(data); - if (facy.state_ == STATE_ACTIVE && data.length() && facy.send_message(data)) - { + if (facy.state_ == STATE_ACTIVE && data.length() && facy.send_message(data)) { wchar_t *msg = mir_a2u_cp(data.c_str(), CP_UTF8); UpdateChat(facy.nick_, msg); mir_free(msg); diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index 5ae53dab59..46f6013dc9 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
OmegleProto::OmegleProto(const char* proto_name, const wchar_t* username) :
-PROTO<OmegleProto>(proto_name, username)
+ PROTO<OmegleProto>(proto_name, username)
{
this->facy.parent = this;
@@ -113,20 +113,17 @@ int OmegleProto::SetStatus(int new_status) m_iDesiredStatus = new_status;
- if (new_status == m_iStatus) {
+ if (new_status == m_iStatus)
return 0;
- }
- if (m_iStatus == ID_STATUS_CONNECTING && new_status != ID_STATUS_OFFLINE) {
+ if (m_iStatus == ID_STATUS_CONNECTING && new_status != ID_STATUS_OFFLINE)
return 0;
- }
- if (new_status == ID_STATUS_OFFLINE) {
+ if (new_status == ID_STATUS_OFFLINE)
ForkThread(&OmegleProto::SignOff, this);
- }
- else {
+ else
ForkThread(&OmegleProto::SignOn, this);
- }
+
return 0;
}
diff --git a/protocols/Omegle/src/theme.h b/protocols/Omegle/src/theme.h index 9768433e87..06af1b3786 100644 --- a/protocols/Omegle/src/theme.h +++ b/protocols/Omegle/src/theme.h @@ -24,7 +24,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void InitIcons(void);
HANDLE GetIconHandle(const char *name);
-
-//void InitContactMenus(void);
-//void UninitContactMenus(void);
-//void ShowContactMenus(bool show, bool deleted = false);
\ No newline at end of file diff --git a/protocols/Omegle/src/version.h b/protocols/Omegle/src/version.h index e01b620f0c..6e6832f2c9 100644 --- a/protocols/Omegle/src/version.h +++ b/protocols/Omegle/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 3
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>
|