From ef903664d17b14d2d6d0ce24c94207b51ad15575 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sat, 8 Aug 2015 09:07:44 +0000 Subject: SkypeWeb: bbcodes in edited messages git-svn-id: http://svn.miranda-ng.org/main/trunk@14859 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/res/resource.rc | 17 +++++++++-------- protocols/SkypeWeb/src/resource.h | 4 +++- protocols/SkypeWeb/src/skype_events.cpp | 6 +++--- protocols/SkypeWeb/src/skype_options.cpp | 4 +++- protocols/SkypeWeb/src/skype_options.h | 1 + protocols/SkypeWeb/src/skype_utils.h | 23 +++++++---------------- 6 files changed, 26 insertions(+), 29 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/res/resource.rc b/protocols/SkypeWeb/res/resource.rc index ef0025edc3..f2d348538f 100644 --- a/protocols/SkypeWeb/res/resource.rc +++ b/protocols/SkypeWeb/res/resource.rc @@ -13,7 +13,7 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Neutral (Default) resources +// Нейтральный (по умолчанию) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD) LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT @@ -35,12 +35,12 @@ IDI_CALL ICON "Icons\\call.ico" IDI_NOTIFY ICON "Icons\\notify.ico" IDI_ACTION_ME ICON "Icons\\me.ico" IDI_ERRORICON ICON "Icons\\error.ico" -#endif // Neutral (Default) resources +#endif // Нейтральный (по умолчанию) resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -// Russian (Russia) resources +// Русский (Россия) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT @@ -71,12 +71,12 @@ END #endif // APSTUDIO_INVOKED -#endif // Russian (Russia) resources +#endif // Русский (Россия) resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -// English resources +// Английский resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL @@ -137,14 +137,15 @@ BEGIN RTEXT "Default group:",IDC_STATIC,13,51,62,12 EDITTEXT IDC_GROUP,79,49,219,12,ES_AUTOHSCROLL GROUPBOX "Others",IDC_STATIC,5,79,298,65 - CONTROL "Automatic messages synchronization",IDC_AUTOSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,89,285,10 + CONTROL "Automatic messages synchronization",IDC_AUTOSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,89,176,10 CONTROL "Use local time for received messages",IDC_LOCALTIME, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,100,285,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,100,176,10 CONTROL "Always notify as unread for all incoming message",IDC_MESASUREAD, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,112,285,10 EDITTEXT IDC_PLACE,79,124,109,14,ES_AUTOHSCROLL RTEXT "Place:",IDC_STATIC,13,127,62,9 CONTROL "Use hostname",IDC_USEHOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,126,102,10 + CONTROL "Use BB-codes",IDC_BBCODES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,89,102,10 END IDD_PASSWORD_EDITOR DIALOGEX 0, 0, 209, 75 @@ -213,7 +214,7 @@ BEGIN END #endif // APSTUDIO_INVOKED -#endif // English resources +#endif // Английский resources ///////////////////////////////////////////////////////////////////////////// diff --git a/protocols/SkypeWeb/src/resource.h b/protocols/SkypeWeb/src/resource.h index 40a04e3b8e..eb58a41d1e 100644 --- a/protocols/SkypeWeb/src/resource.h +++ b/protocols/SkypeWeb/src/resource.h @@ -28,6 +28,8 @@ #define IDC_MESASUREAD 1033 #define IDC_PLACE 1034 #define IDC_USEHOST 1035 +#define IDC_CHECK1 1036 +#define IDC_BBCODES 1036 // Next default values for new objects // @@ -35,7 +37,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 124 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1036 +#define _APS_NEXT_CONTROL_VALUE 1037 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index b993a8973e..b6442d1b93 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -23,7 +23,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) DBEVENTGETTEXT *pEvent = (DBEVENTGETTEXT *)lParam; CMStringA szText; - + bool bUseBB = db_get_b(NULL, pEvent->dbei->szModule, "UseBBCodes", 1); switch (pEvent->dbei->eventType) { case SKYPE_DB_EVENT_TYPE_EDITED_MESSAGE: @@ -33,7 +33,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) if (jMsg) { JSONNode &jOriginalMsg = jMsg["original_message"]; - szText.AppendFormat(Translate("Original message:\n\t%s\n"), mir_utf8decodeA(jOriginalMsg["text"].as_string().c_str())); + szText.AppendFormat(bUseBB ? Translate("[b]Original message:[/b]\n%s\n") : Translate("Original message:\n%s\n"), mir_utf8decodeA(jOriginalMsg["text"].as_string().c_str())); JSONNode &jEdits = jMsg["edits"]; for (auto it = jEdits.begin(); it != jEdits.end(); ++it) { @@ -43,7 +43,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) char szTime[MAX_PATH]; strftime(szTime, sizeof(szTime), "%X %x", localtime(&time)); - szText.AppendFormat(Translate("Edited at %s:\n\t%s\n"), szTime, mir_utf8decodeA(jEdit["text"].as_string().c_str())); + szText.AppendFormat(bUseBB ? Translate("[b]Edited at %s:[/b]\n%s\n") : Translate("Edited at %s:\n%s\n"), szTime, mir_utf8decodeA(jEdit["text"].as_string().c_str())); } } diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index c78dd53aed..d2339df840 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -26,7 +26,8 @@ CSkypeOptionsMain::CSkypeOptionsMain(CSkypeProto *proto, int idDialog) m_autosync(this, IDC_AUTOSYNC), m_localtime(this, IDC_LOCALTIME), m_allasunread(this, IDC_MESASUREAD), - m_usehostname(this, IDC_USEHOST) + m_usehostname(this, IDC_USEHOST), + m_usebb(this, IDC_BBCODES) { CreateLink(m_group, SKYPE_SETTINGS_GROUP, _T("Skype")); CreateLink(m_autosync, "AutoSync", DBVT_BYTE, 1); @@ -34,6 +35,7 @@ CSkypeOptionsMain::CSkypeOptionsMain(CSkypeProto *proto, int idDialog) CreateLink(m_allasunread, "MarkMesUnread", DBVT_BYTE, 1); CreateLink(m_place, "Place", _T("")); CreateLink(m_usehostname, "UseHostName", DBVT_BYTE, 0); + CreateLink(m_usebb, "UseBBCodes", DBVT_BYTE, 1); m_usehostname.OnChange = Callback(this, &CSkypeOptionsMain::OnUsehostnameCheck); } diff --git a/protocols/SkypeWeb/src/skype_options.h b/protocols/SkypeWeb/src/skype_options.h index 27174d62c4..90d60ae138 100644 --- a/protocols/SkypeWeb/src/skype_options.h +++ b/protocols/SkypeWeb/src/skype_options.h @@ -29,6 +29,7 @@ private: CCtrlCheck m_localtime; CCtrlCheck m_allasunread; CCtrlCheck m_usehostname; + CCtrlCheck m_usebb; protected: CSkypeOptionsMain(CSkypeProto *proto, int idDialog); diff --git a/protocols/SkypeWeb/src/skype_utils.h b/protocols/SkypeWeb/src/skype_utils.h index 6f79be2655..f4f7c14035 100644 --- a/protocols/SkypeWeb/src/skype_utils.h +++ b/protocols/SkypeWeb/src/skype_utils.h @@ -35,27 +35,18 @@ class DB_AUTH_BLOB pCurBlob += sizeof(DWORD); *((PDWORD)pCurBlob) = (DWORD)hContact; pCurBlob += sizeof(DWORD); - - if (szNick){ mir_strcpy((char*)pCurBlob, szNick); pCurBlob += mir_strlen(szNick); } - pCurBlob += 1; - - if (szFirstName){ mir_strcpy((char*)pCurBlob, szFirstName); pCurBlob += mir_strlen(szFirstName); } - pCurBlob += 1; - - if (szLastName){ mir_strcpy((char*)pCurBlob, szLastName); pCurBlob += mir_strlen(szLastName); } - pCurBlob += 1; - - if (szId){ mir_strcpy((char*)pCurBlob, szId); pCurBlob += mir_strlen(szId); } - pCurBlob += 1; - - if (szReason){ mir_strcpy((char*)pCurBlob, szReason); pCurBlob += mir_strlen(szReason); } - pCurBlob += 1; + if (szNick) { mir_strcpy((char*)pCurBlob, szNick ); pCurBlob += mir_strlen(szNick ); } pCurBlob += 1; + if (szFirstName){ mir_strcpy((char*)pCurBlob, szFirstName); pCurBlob += mir_strlen(szFirstName); } pCurBlob += 1; + if (szLastName) { mir_strcpy((char*)pCurBlob, szLastName ); pCurBlob += mir_strlen(szLastName ); } pCurBlob += 1; + if (szId) { mir_strcpy((char*)pCurBlob, szId ); pCurBlob += mir_strlen(szId ); } pCurBlob += 1; + if (szReason) { mir_strcpy((char*)pCurBlob, szReason ); pCurBlob += mir_strlen(szReason ); } pCurBlob += 1; return pBlob; } public: - __inline explicit DB_AUTH_BLOB(MCONTACT _hContact, LPCSTR nick, LPCSTR fname, LPCSTR lname, LPCSTR id, LPCSTR reason) + __inline explicit + DB_AUTH_BLOB(MCONTACT _hContact, LPCSTR nick, LPCSTR fname, LPCSTR lname, LPCSTR id, LPCSTR reason) : hContact(_hContact), szNick(mir_strdup(nick)), szFirstName(mir_strdup(fname)), szLastName(mir_strdup(lname)), szId(mir_strdup(id)), szReason(mir_strdup(reason)) {} __inline size_t size(){ return ((sizeof(DWORD) * 2) + (mir_strlen(szNick) + 1) + (mir_strlen(szFirstName) + 1) + (mir_strlen(szLastName) + 1) + (mir_strlen(szId) + 1) + (mir_strlen(szReason) + 1)); } -- cgit v1.2.3