summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/chat.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-11-19 11:22:31 +0000
committerRobert Pösel <robyer@seznam.cz>2014-11-19 11:22:31 +0000
commitabcda6e46fdfcb07f0c11115805131d6900e89ca (patch)
tree857f22c78ddea780a5a5eeb89e20004f0368fd12 /protocols/FacebookRM/src/chat.cpp
parentcf43b9022ce2afb922ad19773ffc369b461e9a34 (diff)
Facebook: Option to log notifications into special chatroom; version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@11020 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/chat.cpp')
-rw-r--r--protocols/FacebookRM/src/chat.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp
index 178ab890d4..684abe0671 100644
--- a/protocols/FacebookRM/src/chat.cpp
+++ b/protocols/FacebookRM/src/chat.cpp
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <m_history.h>
#include <m_userinfo.h>
-void FacebookProto::UpdateChat(const TCHAR *tchat_id, const char *id, const char *name, const char *message, DWORD timestamp)
+void FacebookProto::UpdateChat(const TCHAR *tchat_id, const char *id, const char *name, const char *message, DWORD timestamp, bool is_old)
{
// replace % to %% to not interfere with chat color codes
std::string smessage = message;
@@ -41,6 +41,10 @@ void FacebookProto::UpdateChat(const TCHAR *tchat_id, const char *id, const char
if (id != NULL)
gce.bIsMe = !strcmp(id,facy.self_.user_id.c_str());
gce.dwFlags |= GCEF_ADDTOLOG;
+ if (is_old) {
+ gce.dwFlags |= GCEF_NOTNOTIFY;
+ gce.dwFlags &= ~GCEF_ADDTOLOG;
+ }
gce.ptszNick = tnick;
gce.ptszUID = tid;
CallServiceSync(MS_GC_EVENT,0,reinterpret_cast<LPARAM>(&gce));
@@ -67,7 +71,11 @@ int FacebookProto::OnGCEvent(WPARAM wParam,LPARAM lParam)
{
GCHOOK *hook = reinterpret_cast<GCHOOK*>(lParam);
- if (strcmp(hook->pDest->pszModule,m_szModuleName))
+ if (strcmp(hook->pDest->pszModule, m_szModuleName))
+ return 0;
+
+ // Ignore for special chatrooms
+ if (!_tcscmp(hook->pDest->ptszID, _T(FACEBOOK_NOTIFICATIONS_CHATROOM)))
return 0;
switch(hook->pDest->iType)
@@ -291,9 +299,13 @@ INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM suppress)
return 0;
}
-INT_PTR FacebookProto::OnLeaveChat(WPARAM,LPARAM)
+INT_PTR FacebookProto::OnLeaveChat(WPARAM wParam,LPARAM)
{
GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
+ if (wParam != NULL) {
+ gcd.ptszID = ptrT( getTStringA(wParam, "ChatRoomID"));
+ }
+
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
@@ -372,3 +384,11 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam)
return 0;
}
+
+bool FacebookProto::isSpecialChatRoom(MCONTACT hContact) {
+ if (!isChatRoom(hContact))
+ return false;
+
+ ptrT idT(getTStringA(hContact, "ChatRoomID"));
+ return idT && !_tcscmp(idT, _T(FACEBOOK_NOTIFICATIONS_CHATROOM));
+} \ No newline at end of file