From 8d72d5a048972f29c135f4c7fe8c0e8948bd0e07 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Mon, 20 Apr 2015 11:34:23 +0000 Subject: SkypeWeb: Chat fixes. git-svn-id: http://svn.miranda-ng.org/main/trunk@12962 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/res/resource.rc | 4 +- protocols/SkypeWeb/src/skype_chatrooms.cpp | 34 +++++++----- protocols/SkypeWeb/src/skype_proto.h | 3 +- protocols/SkypeWeb/src/skype_utils.cpp | 88 +++++++++++++++--------------- 4 files changed, 68 insertions(+), 61 deletions(-) (limited to 'protocols') diff --git a/protocols/SkypeWeb/res/resource.rc b/protocols/SkypeWeb/res/resource.rc index 09f9bbd59c..bbebeb1a15 100644 --- a/protocols/SkypeWeb/res/resource.rc +++ b/protocols/SkypeWeb/res/resource.rc @@ -83,8 +83,8 @@ BEGIN END IDD_GC_INVITE DIALOGEX 0, 0, 220, 78 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_TOOLWINDOW +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOPMOST | WS_EX_TOOLWINDOW CAPTION "Invite user to chat" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 92872be218..6d17790e8d 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -330,13 +330,7 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) if (isKick) { - GCDEST gcd = { m_szModuleName, ptrT(mir_a2t(chatname)), GC_EVENT_KICK }; - GCEVENT gce = { sizeof(GCEVENT), &gcd }; - gce.ptszUID = ptrT(mir_a2t(target)); - gce.ptszNick = ptrT(mir_a2t(target)); - gce.ptszStatus = ptrT(mir_a2t(initiator)); - gce.time = timestamp; - CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); + RemoveChatContact(_A2T(chatname), target, target, true, initiator); } else { @@ -425,21 +419,32 @@ void CSkypeProto::AddChatContact(const TCHAR *tchat_id, const char *id, const ch CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast(&gce)); } -void CSkypeProto::RemoveChatContact(const TCHAR *tchat_id, const char *id, const char *name) +void CSkypeProto::RemoveChatContact(const TCHAR *tchat_id, const char *id, const char *name, bool isKick, const char *initiator) { if(IsMe(id)) return; ptrT tnick(mir_a2t_cp(name, CP_UTF8)); ptrT tid(mir_a2t(id)); + ptrT tinitiator(mir_a2t(initiator)); - GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_PART }; + GCDEST gcd = { m_szModuleName, tchat_id, isKick ? GC_EVENT_KICK : GC_EVENT_PART }; GCEVENT gce = { sizeof(gce), &gcd }; - gce.dwFlags = GCEF_ADDTOLOG; - gce.ptszNick = tnick; - gce.ptszUID = tid; - gce.time = time(NULL); - gce.bIsMe = false; + if (isKick) + { + gce.ptszUID = tid; + gce.ptszNick = tnick; + gce.ptszStatus = tinitiator; + gce.time = time(NULL); + } + else + { + gce.dwFlags = GCEF_ADDTOLOG; + gce.ptszNick = tnick; + gce.ptszUID = tid; + gce.time = time(NULL); + gce.bIsMe = IsMe(id); + } CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast(&gce)); } @@ -453,6 +458,7 @@ INT_PTR CSkypeProto::InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM CSkypeProto *ppro = (CSkypeProto*)lParam; HWND hwndCombo = GetDlgItem(hwndDlg, IDC_CONTACT); for (MCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) { + if (ppro->isChatRoom(hContact)) continue; TCHAR *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0); int idx = SendMessage(hwndCombo, CB_ADDSTRING, 0, LPARAM(ptszNick)); SendMessage(hwndCombo, CB_SETITEMDATA, idx, hContact); diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index d18af6b829..a921089d45 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -236,9 +236,10 @@ private: char *GetChatUsers(const TCHAR *chat_id); bool IsChatContact(const TCHAR *chat_id, const char *id); + void AddChatContact(const TCHAR *tchat_id, const char *id, const char *name, const TCHAR *role); + void RemoveChatContact(const TCHAR *tchat_id, const char *id, const char *name, bool isKick = false, const char *initiator = ""); - void RemoveChatContact(const TCHAR *tchat_id, const char *id, const char *name); void RenameChat(const char *chat_id, const char *name); static INT_PTR __stdcall InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 289793a457..ca2fb11989 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -102,51 +102,51 @@ struct HtmlEntity const HtmlEntity htmlEntities[] = { - { "AElig;", "Æ" }, - { "Aacute;", "Á" }, - { "Acirc;", "Â" }, - { "Agrave;", "À" }, - { "Alpha;", "Α" }, - { "Aring;", "Å" }, - { "Atilde;", "Ã" }, - { "Auml;", "Ä" }, - { "Beta;", "Β" }, - { "Ccedil;", "Ç" }, - { "Chi;", "Χ" }, + { "AElig;", "\u00C6" }, + { "Aacute;", "\u00C1" }, + { "Acirc;", "\u00C2" }, + { "Agrave;", "\u00C0" }, + { "Alpha;", "\u0391" }, + { "Aring;", "\u00C5" }, + { "Atilde;", "\u00C3" }, + { "Auml;", "\u00C4" }, + { "Beta;", "\u0392" }, + { "Ccedil;", "\u00C7" }, + { "Chi;", "\u03A7" }, { "Dagger;", "‡" }, - { "Delta;", "Δ" }, - { "ETH;", "Ð" }, - { "Eacute;", "É" }, - { "Ecirc;", "Ê" }, - { "Egrave;", "È" }, - { "Epsilon;", "Ε" }, - { "Eta;", "Η" }, - { "Euml;", "Ë" }, - { "Gamma;", "Γ" }, - { "Iacute;", "Í" }, - { "Icirc;", "Î" }, - { "Igrave;", "Ì" }, - { "Iota;", "Ι" }, - { "Iuml;", "Ï" }, - { "Kappa;", "Κ" }, - { "Lambda;", "Λ" }, - { "Mu;", "Μ" }, - { "Ntilde;", "Ñ" }, - { "Nu;", "Ν" }, - { "OElig;", "Œ" }, - { "Oacute;", "Ó" }, - { "Ocirc;", "Ô" }, - { "Ograve;", "Ò" }, - { "Omega;", "Ω" }, - { "Omicron;", "Ο" }, - { "Oslash;", "Ø" }, - { "Otilde;", "Õ" }, - { "Ouml;", "Ö" }, - { "Phi;", "Φ" }, - { "Pi;", "Π" }, - { "Prime;", "″" }, - { "Psi;", "Ψ" }, - { "Rho;", "Ρ" }, + { "Delta;", "\u0394" }, + { "ETH;", "\u00D0" }, + { "Eacute;", "\u00C9" }, + { "Ecirc;", "\u00CA" }, + { "Egrave;", "\u00C8" }, + { "Epsilon;", "\u0395" }, + { "Eta;", "\u0397" }, + { "Euml;", "\u00CB" }, + { "Gamma;", "\u0393" }, + { "Iacute;", "\u00CD" }, + { "Icirc;", "\u00CE" }, + { "Igrave;", "\u00CC" }, + { "Iota;", "\u0399" }, + { "Iuml;", "\u00CF" }, + { "Kappa;", "\u039A" }, + { "Lambda;", "\u039B" }, + { "Mu;", "\u039C" }, + { "Ntilde;", "\u00D1" }, + { "Nu;", "\u039D" }, + { "OElig;", "\u0152" }, + { "Oacute;", "\u00D3" }, + { "Ocirc;", "\u00D4" }, + { "Ograve;", "\u00D2" }, + { "Omega;", "\u03A9" }, + { "Omicron;", "\u039F" }, + { "Oslash;", "\u00D8" }, + { "Otilde;", "\u00D5" }, + { "Ouml;", "\u00D6" }, + { "Phi;", "\u03A6" }, + { "Pi;", "\u03A0" }, + { "Prime;", "\u2033" }, + { "Psi;", "\u03A8" }, + { "Rho;", "\u03A1" }, { "Scaron;", "Š" }, { "Sigma;", "Σ" }, { "THORN;", "Þ" }, -- cgit v1.2.3