diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-08 19:39:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-08 19:39:48 +0000 |
commit | 05cd7934d4bdb097e112efdda356946868f3f5d6 (patch) | |
tree | 0fa678b494af8b994abf7319298a1af06fc9218a /protocols/Omegle/src | |
parent | 50a2ba5bf6827b8f010288021c1797c11bd1531e (diff) |
- end of ANSI support in chats;
- manual crit section control removed from chat engine;
- bunch of memory-related clutches either removed or replaced with smart pointers
git-svn-id: http://svn.miranda-ng.org/main/trunk@7549 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Omegle/src')
-rw-r--r-- | protocols/Omegle/src/chat.cpp | 120 | ||||
-rw-r--r-- | protocols/Omegle/src/proto.cpp | 2 |
2 files changed, 36 insertions, 86 deletions
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index 39ad7925e5..88f6874c71 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -23,30 +23,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void OmegleProto::UpdateChat(const TCHAR *name, const TCHAR *message, bool addtolog)
{
- GCDEST gcd = { m_szModuleName };
- gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
-
- GCEVENT gce = {sizeof(gce)};
- gce.pDest = &gcd;
+ GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_MESSAGE };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.time = ::time(NULL);
gce.ptszText = message;
- gce.time = ::time(NULL);
- gce.dwFlags = GC_TCHAR;
- gcd.iType = GC_EVENT_MESSAGE;
if (name == NULL) {
gcd.iType = GC_EVENT_INFORMATION;
name = TranslateT("Server");
gce.bIsMe = false;
- } else {
- gce.bIsMe = !_tcscmp(name, this->facy.nick_);
}
+ else gce.bIsMe = !_tcscmp(name, this->facy.nick_);
if (addtolog)
gce.dwFlags |= GCEF_ADDTOLOG;
gce.ptszNick = name;
gce.ptszUID = gce.ptszNick;
-
CallServiceSync(MS_GC_EVENT,0,reinterpret_cast<LPARAM>(&gce));
}
@@ -214,29 +207,19 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam) /*void OmegleProto::SendChatEvent(int type)
{
- GCDEST gcd = { m_szModuleName };
- gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
- gcd.iType = GC_EVENT_CONTROL;
-
- GCEVENT gce = {sizeof(gce)};
- gce.dwFlags = GC_TCHAR;
- gce.pDest = &gcd;
-
+ GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_CONTROL };
+ GCEVENT gce = { sizeof(gce), &gcd };
CallServiceSync(MS_GC_EVENT,WINDOW_CLEARLOG,reinterpret_cast<LPARAM>(&gce));
}*/
void OmegleProto::AddChatContact(const TCHAR *name)
{
- GCDEST gcd = { m_szModuleName };
- gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
- gcd.iType = GC_EVENT_JOIN;
-
- GCEVENT gce = {sizeof(gce)};
- gce.pDest = &gcd;
- gce.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- gce.ptszNick = name;
- gce.ptszUID = gce.ptszNick;
- gce.time = static_cast<DWORD>(time(0));
+ GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_JOIN };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.time = DWORD(time(0));
+ gce.dwFlags = GCEF_ADDTOLOG;
+ gce.ptszNick = name;
+ gce.ptszUID = gce.ptszNick;
if (name == NULL)
gce.bIsMe = false;
@@ -253,16 +236,12 @@ void OmegleProto::AddChatContact(const TCHAR *name) void OmegleProto::DeleteChatContact(const TCHAR *name)
{
- GCDEST gcd = { m_szModuleName };
- gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
- gcd.iType = GC_EVENT_PART;
-
- GCEVENT gce = {sizeof(gce)};
- gce.pDest = &gcd;
- gce.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- gce.ptszNick = name;
- gce.ptszUID = gce.ptszNick;
- gce.time = static_cast<DWORD>(time(0));
+ GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_PART };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
+ gce.ptszNick = name;
+ gce.ptszUID = gce.ptszNick;
+ gce.time = DWORD(time(0));
if (name == NULL)
gce.bIsMe = false;
else
@@ -273,29 +252,21 @@ void OmegleProto::DeleteChatContact(const TCHAR *name) INT_PTR OmegleProto::OnJoinChat(WPARAM,LPARAM suppress)
{
- GCSESSION gcw = {sizeof(gcw)};
-
// Create the group chat session
- gcw.dwFlags = GC_TCHAR;
- gcw.iType = GCW_CHATROOM;
+ GCSESSION gcw = {sizeof(gcw)};
+ gcw.iType = GCW_CHATROOM;
+ gcw.ptszID = m_tszUserName;
+ gcw.ptszName = m_tszUserName;
gcw.pszModule = m_szModuleName;
- gcw.ptszName = m_tszUserName;
- gcw.ptszID = m_tszUserName;
CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
if(m_iStatus == ID_STATUS_OFFLINE)
return 0;
// Create a group
- GCDEST gcd = { m_szModuleName };
- gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
-
- GCEVENT gce = {sizeof(gce)};
- gce.pDest = &gcd;
- gce.dwFlags = GC_TCHAR;
-
- gcd.iType = GC_EVENT_ADDGROUP;
-
+ GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_ADDGROUP };
+ GCEVENT gce = { sizeof(gce), &gcd };
+
gce.ptszStatus = _T("Admin");
CallServiceSync( MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
@@ -313,15 +284,10 @@ INT_PTR OmegleProto::OnJoinChat(WPARAM,LPARAM suppress) void OmegleProto::SetTopic(const TCHAR *topic)
{
- GCDEST gcd = { m_szModuleName };
- gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
- gcd.iType = GC_EVENT_TOPIC;
-
- GCEVENT gce = {sizeof(gce)};
- gce.pDest = &gcd;
- gce.dwFlags = GC_TCHAR;
+ GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_TOPIC };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
-
+
if (topic == NULL)
gce.ptszText = TranslateT("Omegle is a great way of meeting new friends!");
else
@@ -332,14 +298,9 @@ void OmegleProto::SetTopic(const TCHAR *topic) INT_PTR OmegleProto::OnLeaveChat(WPARAM,LPARAM)
{
- GCDEST gcd = { m_szModuleName };
- gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
- gcd.iType = GC_EVENT_CONTROL;
-
- GCEVENT gce = {sizeof(gce)};
- gce.dwFlags = GC_TCHAR;
+ GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_CONTROL };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
- gce.pDest = &gcd;
CallServiceSync(MS_GC_EVENT,SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
CallServiceSync(MS_GC_EVENT,SESSION_TERMINATE,reinterpret_cast<LPARAM>(&gce));
@@ -349,14 +310,9 @@ INT_PTR OmegleProto::OnLeaveChat(WPARAM,LPARAM) void OmegleProto::SetChatStatus(int status)
{
- GCDEST gcd = { m_szModuleName };
- gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
- gcd.iType = GC_EVENT_CONTROL;
-
- GCEVENT gce = {sizeof(gce)};
- gce.dwFlags = GC_TCHAR;
+ GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_CONTROL };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
- gce.pDest = &gcd;
if(status == ID_STATUS_ONLINE)
{
@@ -391,15 +347,9 @@ void OmegleProto::ClearChat() if (getByte(OMEGLE_KEY_NO_CLEAR, 0))
return;
- GCDEST gcd = { m_szModuleName };
- gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
- gcd.iType = GC_EVENT_CONTROL;
-
- GCEVENT gce = {sizeof(gce)};
- gce.dwFlags = GC_TCHAR;
- gce.pDest = &gcd;
-
- CallServiceSync(MS_GC_EVENT,WINDOW_CLEARLOG,reinterpret_cast<LPARAM>(&gce));
+ GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_CONTROL };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ CallServiceSync(MS_GC_EVENT, WINDOW_CLEARLOG, reinterpret_cast<LPARAM>(&gce));
}
// TODO: Could this be done better?
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index f0ebd14717..245fa749ea 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -176,7 +176,7 @@ int OmegleProto::OnModulesLoaded(WPARAM wParam,LPARAM lParam) GCREGISTER gcr = {sizeof(gcr)};
gcr.dwFlags = GC_TYPNOTIF; //GC_ACKMSG;
gcr.pszModule = m_szModuleName;
- gcr.pszModuleDispName = m_szModuleName;
+ gcr.ptszDispName = m_tszUserName;
gcr.iMaxText = OMEGLE_MESSAGE_LIMIT;
gcr.nColors = 0;
gcr.pColors = NULL;
|