summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/chat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/FacebookRM/src/chat.cpp')
-rw-r--r--protocols/FacebookRM/src/chat.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp
index e0414ae9c7..ea635c4a53 100644
--- a/protocols/FacebookRM/src/chat.cpp
+++ b/protocols/FacebookRM/src/chat.cpp
@@ -40,7 +40,8 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char *
gce.time = timestamp ? timestamp : ::time(NULL);
gce.dwFlags = GC_TCHAR;
gcd.iType = GC_EVENT_MESSAGE;
- gce.bIsMe = !strcmp(id,facy.self_.user_id.c_str());
+ if (id != NULL)
+ gce.bIsMe = !strcmp(id,facy.self_.user_id.c_str());
gce.dwFlags |= GCEF_ADDTOLOG;
gce.ptszNick = tnick;
@@ -55,6 +56,23 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char *
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)mir_a2u("Unseen"));
}
+void FacebookProto::RenameChat(const char *chat_id, const char *name)
+{
+ ptrT tchat_id( mir_a2t(chat_id));
+ ptrT tname( mir_a2t_cp(name, CP_UTF8));
+
+ GCDEST gcd = { m_szModuleName };
+ gcd.ptszID = tchat_id;
+
+ GCEVENT gce = {sizeof(gce)};
+ gce.pDest = &gcd;
+ gce.ptszText = tname;
+ gce.dwFlags = GC_TCHAR;
+ gcd.iType = GC_EVENT_CHANGESESSIONAME;
+
+ CallService(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+}
+
int FacebookProto::OnGCEvent(WPARAM wParam,LPARAM lParam)
{
GCHOOK *hook = reinterpret_cast<GCHOOK*>(lParam);
@@ -281,8 +299,17 @@ void FacebookProto::AddChat(const char *id, const char *name)
}
*/
-INT_PTR FacebookProto::OnJoinChat(WPARAM,LPARAM suppress)
+INT_PTR FacebookProto::OnJoinChat(WPARAM wParam,LPARAM suppress)
{
+ HANDLE hContact = (HANDLE)wParam;
+
+ // TODO: load info from server + old history,...
+
+ ptrA id( getStringA(hContact, "ChatRoomID"));
+ ptrA name( getStringA(hContact, "Nick"));
+
+ AddChat(id, name);
+
/* GCSESSION gcw = {sizeof(gcw)};
// Create the group chat session