summaryrefslogtreecommitdiff
path: root/protocols/Omegle
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-10-20 15:13:37 +0000
committerRobert Pösel <robyer@seznam.cz>2015-10-20 15:13:37 +0000
commit7d1babb61cffcf4c376463053397e3b11659f349 (patch)
treeb8249b332a665b5d95a413d92b3729cd138be2cf /protocols/Omegle
parent7d1d2dad298eb1fb008c3116dc7c62dda051645b (diff)
Omegle: Various improvements; version bump
* Show icon with typing info in statusbar * Don't send "hi message" when in mode for anwering questions * Clear typing info on more events (e.g. on spy message) * Fix icons labels in icolib * Fix help messages * Show which stranger is typing in spy mode git-svn-id: http://svn.miranda-ng.org/main/trunk@15582 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Omegle')
-rw-r--r--protocols/Omegle/res/omegle.rc2
-rw-r--r--protocols/Omegle/res/typing.icobin0 -> 1150 bytes
-rw-r--r--protocols/Omegle/res/typingoff.icobin0 -> 1150 bytes
-rw-r--r--protocols/Omegle/src/chat.cpp24
-rw-r--r--protocols/Omegle/src/communication.cpp20
-rw-r--r--protocols/Omegle/src/connection.cpp2
-rw-r--r--protocols/Omegle/src/resource.h2
-rw-r--r--protocols/Omegle/src/theme.cpp11
-rw-r--r--protocols/Omegle/src/version.h4
9 files changed, 38 insertions, 27 deletions
diff --git a/protocols/Omegle/res/omegle.rc b/protocols/Omegle/res/omegle.rc
index b48b175db7..6e8ee2de50 100644
--- a/protocols/Omegle/res/omegle.rc
+++ b/protocols/Omegle/res/omegle.rc
@@ -52,6 +52,8 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_OMEGLE ICON "omegle.ico"
+IDI_TYPING_ON ICON "typing.ico"
+IDI_TYPING_OFF ICON "typingoff.ico"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/protocols/Omegle/res/typing.ico b/protocols/Omegle/res/typing.ico
new file mode 100644
index 0000000000..f5f6c458a6
--- /dev/null
+++ b/protocols/Omegle/res/typing.ico
Binary files differ
diff --git a/protocols/Omegle/res/typingoff.ico b/protocols/Omegle/res/typingoff.ico
new file mode 100644
index 0000000000..d79ce47b07
--- /dev/null
+++ b/protocols/Omegle/res/typingoff.ico
Binary files differ
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp
index 1bd515667e..a8179f5cc5 100644
--- a/protocols/Omegle/src/chat.cpp
+++ b/protocols/Omegle/src/chat.cpp
@@ -153,22 +153,22 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam)
else if (!mir_strcmpi(command.c_str(), "help"))
{
UpdateChat(NULL, 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);
+\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(NULL, 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);
+\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
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp
index 9146e309a4..ba8d28d9d8 100644
--- a/protocols/Omegle/src/communication.cpp
+++ b/protocols/Omegle/src/communication.cpp
@@ -557,9 +557,10 @@ bool Omegle_client::events()
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
- // st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_on")); // TODO: typing icon
+ st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_on"));
- mir_sntprintf(st.tszText, TranslateT("%s is typing."), TranslateT("Stranger"));
+ ptrT who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_tstrdup(_T("Stranger")));
+ mir_sntprintf(st.tszText, TranslateT("%s is typing."), TranslateTS(who));
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st);
}
@@ -569,13 +570,16 @@ bool Omegle_client::events()
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
- // st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_off")); // TODO: typing icon
+ st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_off"));
- mir_sntprintf(st.tszText, TranslateT("%s stopped typing."), TranslateT("Stranger"));
+ ptrT who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_tstrdup(_T("Stranger")));
+ mir_sntprintf(st.tszText, TranslateT("%s stopped typing."), TranslateTS(who));
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st);
}
else if (name == "gotMessage") {
+ CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), NULL);
+
// Play sound as we received message
SkinPlaySound("StrangerMessage");
@@ -583,10 +587,10 @@ bool Omegle_client::events()
ptrT msg(json_as_string(json_at(item, 1)));
parent->UpdateChat(TranslateT("Stranger"), msg);
}
-
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), 0);
}
else if (name == "spyMessage") {
+ CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), NULL);
+
// Play sound as we received message
SkinPlaySound("StrangerMessage");
@@ -609,6 +613,8 @@ bool Omegle_client::events()
parent->StopChat(false);
}
else if (name == "spyDisconnected") {
+ CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), NULL);
+
ptrT stranger(json_as_string(json_at(item, 1)));
TCHAR strT[255];
@@ -642,7 +648,7 @@ bool Omegle_client::events()
}
}
- if (newStranger && state_ != STATE_SPY) {
+ if (newStranger && !spy_mode_) {
// We got new stranger in this event, lets say him "Hi message" if enabled
if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_HI_ENABLED, 0)) {
DBVARIANT dbv;
diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp
index 870c8ea905..fb7ab9a6e1 100644
--- a/protocols/Omegle/src/connection.cpp
+++ b/protocols/Omegle/src/connection.cpp
@@ -95,6 +95,8 @@ void OmegleProto::StopChat(bool disconnect)
}
SetTopic(); // reset topic content
+
+ CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)GetChatHandle(), NULL);
}
else
{ // disconnecting or inactive
diff --git a/protocols/Omegle/src/resource.h b/protocols/Omegle/src/resource.h
index 8d59696e1c..6d48095934 100644
--- a/protocols/Omegle/src/resource.h
+++ b/protocols/Omegle/src/resource.h
@@ -3,6 +3,8 @@
// Used by ..\res\omegle.rc
//
#define IDI_OMEGLE 101
+#define IDI_TYPING_ON 105
+#define IDI_TYPING_OFF 106
#define IDD_OmegleACCOUNT 111
#define IDD_OPTIONS 122
#define IDC_SERVER 1204
diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp
index aa794eb8f1..98253cbfcd 100644
--- a/protocols/Omegle/src/theme.cpp
+++ b/protocols/Omegle/src/theme.cpp
@@ -26,11 +26,11 @@ extern OBJLIST<OmegleProto> g_Instances;
static IconItem icons[] =
{
- { "omegle", LPGEN("Omegle Icon"), IDI_OMEGLE },
+ { LPGEN("Omegle Icon"), "omegle", IDI_OMEGLE },
+ { LPGEN("Stranger is typing"), "typing_on", IDI_TYPING_ON },
+ { LPGEN("Stranger stopped typing"), "typing_off", IDI_TYPING_OFF },
};
-static HANDLE hIconLibItem[_countof(icons)];
-
void InitIcons(void)
{
Icon_Register(g_hInstance, "Protocols/Omegle", icons, _countof(icons), "Omegle");
@@ -39,9 +39,8 @@ void InitIcons(void)
HANDLE GetIconHandle(const char* name)
{
for (size_t i = 0; i < _countof(icons); i++)
- {
if (mir_strcmp(icons[i].szName, name) == 0)
- return hIconLibItem[i];
- }
+ return icons[i].hIcolib;
+
return 0;
}
diff --git a/protocols/Omegle/src/version.h b/protocols/Omegle/src/version.h
index 24b7c2d86c..e41473ce57 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 2
-#define __BUILD_NUM 3
+#define __RELEASE_NUM 3
+#define __BUILD_NUM 0
#include <stdver.h>