From 94c711953d71b21e4cc4c950dec921b253ae0d54 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 5 Mar 2018 21:16:04 +0300 Subject: Jabber: code cleaning & simplification --- protocols/JabberG/src/jabber_proto.h | 127 +++++++++++++++++++++++++---------- 1 file changed, 91 insertions(+), 36 deletions(-) (limited to 'protocols/JabberG/src/jabber_proto.h') diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index bca7b73ab8..d6144695d7 100755 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -137,20 +137,77 @@ struct CJabberProto : public PROTO, public IJabberInterface //====| Data |======================================================================== ThreadData* m_ThreadInfo; - CJabberOptions m_options; + + CMOption m_bAllowVersionRequests; + CMOption m_bAcceptHttpAuth; + CMOption m_bAddRoster2Bookmarks; + CMOption m_bAutoAcceptAuthorization; + CMOption m_bAutoAcceptMUC; + CMOption m_bAutoAdd; + CMOption m_bAutoJoinBookmarks; + CMOption m_bAutoJoinConferences; + CMOption m_bAutoJoinHidden; + CMOption m_bAvatarType; + CMOption m_bBsDirect; + CMOption m_bBsDirectManual; + CMOption m_bBsOnlyIBB; + CMOption m_bBsProxyManual; + CMOption m_bDisable3920auth; + CMOption m_bDisableFrame; + CMOption m_bEnableAvatars; + CMOption m_bEnableRemoteControl; + CMOption m_bEnableUserActivity; + CMOption m_bEnableUserMood; + CMOption m_bEnableUserTune; + CMOption m_bEnableZlib; + CMOption m_bExtendedSearch; + CMOption m_bFixIncorrectTimestamps; + CMOption m_bGcLogAffiliations; + CMOption m_bGcLogBans; + CMOption m_bGcLogConfig; + CMOption m_bGcLogRoles; + CMOption m_bGcLogStatuses; + CMOption m_bGcLogChatHistory; + CMOption m_bHostNameAsResource; + CMOption m_bIgnoreMUCInvites; + CMOption m_bKeepAlive; + CMOption m_bLogChatstates; + CMOption m_bLogPresence; + CMOption m_bLogPresenceErrors; + CMOption m_bManualConnect; + CMOption m_bMsgAck; + CMOption m_bRosterSync; + CMOption m_bSavePassword; + CMOption m_bUseDomainLogin; + CMOption m_bShowForeignResourceInMirVer; + CMOption m_bShowOSVersion; + CMOption m_bShowTransport; + CMOption m_bUseSSL; + CMOption m_bUseTLS; + CMOption m_bAcceptNotes; + CMOption m_bAutosaveNotes; + CMOption m_bEnableMsgArchive; + CMOption m_bRcMarkMessagesAsRead; + CMOption m_bProcessXMPPLinks; + CMOption m_bIgnoreRosterGroups; + CMOption m_bEnableCarbons; + CMOption m_bUseOMEMO; + + CMOption m_iConnectionKeepAliveInterval; + CMOption m_iConnectionKeepAliveTimeout; PVOID m_sslCtx; HANDLE m_hThreadHandle; wchar_t *m_szJabberJID; - int m_nJabberSearchID; - time_t m_tmJabberLoggedInTime; - time_t m_tmJabberIdleStartTime; - UINT m_nJabberCodePage; + int m_nJabberSearchID; + time_t m_tmJabberLoggedInTime; + time_t m_tmJabberIdleStartTime; + UINT m_nJabberCodePage; wchar_t *m_tszSelectedLang; - mir_cs m_csModeMsgMutex; + mir_cs m_csModeMsgMutex; JABBER_MODEMSGS m_modeMsgs; bool m_bJabberOnline; // XMPP connection initialized and we can send XMPP packets @@ -279,7 +336,7 @@ struct CJabberProto : public PROTO, public IJabberInterface //---- jabber_bookmarks.c ------------------------------------------------------------ - INT_PTR __cdecl OnMenuHandleBookmarks(WPARAM wParam, LPARAM lParam); + INT_PTR __cdecl OnMenuHandleBookmarks(WPARAM wParam, LPARAM lParam); int AddEditBookmark(JABBER_LIST_ITEM *item); @@ -290,9 +347,9 @@ struct CJabberProto : public PROTO, public IJabberInterface bool OnIncomingNote(const wchar_t *szFrom, HXML hXml); - INT_PTR __cdecl OnMenuSendNote(WPARAM, LPARAM); - INT_PTR __cdecl OnMenuHandleNotes(WPARAM, LPARAM); - INT_PTR __cdecl OnIncomingNoteEvent(WPARAM, LPARAM); + INT_PTR __cdecl OnMenuSendNote(WPARAM, LPARAM); + INT_PTR __cdecl OnMenuHandleNotes(WPARAM, LPARAM); + INT_PTR __cdecl OnIncomingNoteEvent(WPARAM, LPARAM); //---- jabber_byte.c ----------------------------------------------------------------- @@ -319,8 +376,8 @@ struct CJabberProto : public PROTO, public IJabberInterface //---- jabber_captcha.cpp ------------------------------------------------------------ - void sendCaptchaResult(wchar_t* buf, ThreadData *info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid); - void sendCaptchaError(ThreadData *info, LPCTSTR from, LPCTSTR to, LPCTSTR challenge); + void sendCaptchaResult(wchar_t* buf, ThreadData *info, const wchar_t *from, const wchar_t *challenge, const wchar_t *fromjid, const wchar_t *sid); + void sendCaptchaError(ThreadData *info, const wchar_t *from, const wchar_t *to, const wchar_t *challenge); //---- jabber_chat.cpp --------------------------------------------------------------- @@ -340,7 +397,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime); void OmemoPutMessageToOutgoingQueue(MCONTACT hContact, int, const char* pszSrc); - void OmemoPutMessageToIncommingQueue(HXML node, LPCTSTR jid, time_t msgTime); + void OmemoPutMessageToIncommingQueue(HXML node, const wchar_t *jid, time_t msgTime); void OmemoHandleMessageQueue(); void OmemoHandleDeviceList(HXML node); void OmemoInitDevice(); @@ -368,10 +425,10 @@ struct CJabberProto : public PROTO, public IJabberInterface //---- jabber_disco.cpp -------------------------------------------------------------- void LaunchServiceDiscovery(wchar_t *jid); - INT_PTR __cdecl OnMenuHandleServiceDiscovery(WPARAM wParam, LPARAM lParam); - INT_PTR __cdecl OnMenuHandleServiceDiscoveryMyTransports(WPARAM wParam, LPARAM lParam); - INT_PTR __cdecl OnMenuHandleServiceDiscoveryTransports(WPARAM wParam, LPARAM lParam); - INT_PTR __cdecl OnMenuHandleServiceDiscoveryConferences(WPARAM wParam, LPARAM lParam); + INT_PTR __cdecl OnMenuHandleServiceDiscovery(WPARAM wParam, LPARAM lParam); + INT_PTR __cdecl OnMenuHandleServiceDiscoveryMyTransports(WPARAM wParam, LPARAM lParam); + INT_PTR __cdecl OnMenuHandleServiceDiscoveryTransports(WPARAM wParam, LPARAM lParam); + INT_PTR __cdecl OnMenuHandleServiceDiscoveryConferences(WPARAM wParam, LPARAM lParam); void OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo *pInfo); @@ -423,11 +480,10 @@ struct CJabberProto : public PROTO, public IJabberInterface INT_PTR __cdecl OnJoinChat(WPARAM wParam, LPARAM lParam); INT_PTR __cdecl OnLeaveChat(WPARAM wParam, LPARAM lParam); - void GroupchatJoinRoom(LPCTSTR server, LPCTSTR room, LPCTSTR nick, LPCTSTR password, bool autojoin = false); + void GroupchatJoinRoom(const wchar_t *server, const wchar_t *room, const wchar_t *nick, const wchar_t *password, bool autojoin = false); void GroupchatProcessPresence(HXML node); void GroupchatProcessMessage(HXML node); - void GroupchatProcessInvite(LPCTSTR roomJid, LPCTSTR from, LPCTSTR reason, LPCTSTR password); - void GroupchatJoinDlg(wchar_t* roomJid); + void GroupchatProcessInvite(const wchar_t *roomJid, const wchar_t *from, const wchar_t *reason, const wchar_t *password); void OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo); //---- jabber_icolib.cpp ------------------------------------------------------------- @@ -550,7 +606,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasPhoto); - void SetBookmarkRequest (XmlNodeIq& iqId); + void SetBookmarkRequest(XmlNodeIq &iqId); //---- jabber_menu.cpp --------------------------------------------------------------- @@ -744,10 +800,9 @@ struct CJabberProto : public PROTO, public IJabberInterface MCONTACT HContactFromJID(const wchar_t *jid, bool bStripResource = true); MCONTACT ChatRoomHContactFromJID(const wchar_t *jid); - void SendVisibleInvisiblePresence(BOOL invisible); + void SendVisibleInvisiblePresence(bool invisible); void SendPresenceTo(int status, const wchar_t* to, HXML extra, const wchar_t *msg = nullptr); void SendPresence(int m_iStatus, bool bSendToAll); - void StringAppend(char* *str, int *sizeAlloced, const char* fmt, ...); void RebuildInfoFrame(void); void InitInfoFrame(void); @@ -758,8 +813,8 @@ struct CJabberProto : public PROTO, public IJabberInterface void ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *param, int recentCount=JABBER_DEFAULT_RECENT_COUNT); void ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const wchar_t *string, int recentCount=JABBER_DEFAULT_RECENT_COUNT); - BOOL EnterString(CMStringW &result, LPCTSTR caption, int type, char *windowName=nullptr, int recentCount=JABBER_DEFAULT_RECENT_COUNT, int timeout=0); - bool IsMyOwnJID(LPCTSTR szJID); + BOOL EnterString(CMStringW &result, const wchar_t *caption, int type, char *windowName=nullptr, int recentCount=JABBER_DEFAULT_RECENT_COUNT, int timeout=0); + bool IsMyOwnJID(const wchar_t *szJID); void __cdecl LoadHttpAvatars(void* param); @@ -813,7 +868,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void XStatusInit(void); - void SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR szLength, LPCTSTR szSource, LPCTSTR szTitle, LPCTSTR szTrack); + void SetContactTune(MCONTACT hContact, const wchar_t *szArtist, const wchar_t *szLength, const wchar_t *szSource, const wchar_t *szTitle, const wchar_t *szTrack); void InfoFrame_OnUserMood(CJabberInfoFrame_Event *evt); void InfoFrame_OnUserActivity(CJabberInfoFrame_Event *evt); @@ -841,31 +896,31 @@ public: int STDMETHODCALLTYPE GetVersion() const; // Returns version of IJabberInterface. DWORD STDMETHODCALLTYPE GetJabberVersion() const; // Returns Jabber plugin version. - MCONTACT STDMETHODCALLTYPE ContactFromJID(LPCTSTR jid); // Returns contact handle for given JID. + MCONTACT STDMETHODCALLTYPE ContactFromJID(const wchar_t *jid); // Returns contact handle for given JID. LPTSTR STDMETHODCALLTYPE ContactToJID(MCONTACT hContact); // Returns JID of hContact. You must free the result using mir_free(). - LPTSTR STDMETHODCALLTYPE GetBestResourceName(LPCTSTR jid); // Returns best resource name for given JID. You must free the result using mir_free(). - LPTSTR STDMETHODCALLTYPE GetResourceList(LPCTSTR jid); // Returns all resource names for a given JID in format "resource1\0resource2\0resource3\0\0" (all resources are separated by \0 character and the whole string is terminated with two \0 characters). You must free the string using mir_free(). + LPTSTR STDMETHODCALLTYPE GetBestResourceName(const wchar_t *jid); // Returns best resource name for given JID. You must free the result using mir_free(). + LPTSTR STDMETHODCALLTYPE GetResourceList(const wchar_t *jid); // Returns all resource names for a given JID in format "resource1\0resource2\0resource3\0\0" (all resources are separated by \0 character and the whole string is terminated with two \0 characters). You must free the string using mir_free(). char* STDMETHODCALLTYPE GetModuleName() const; // Returns Jabber module name. int STDMETHODCALLTYPE SerialNext(); // Returns id that can be used for next message sent through SendXmlNode(). int STDMETHODCALLTYPE SendXmlNode(HXML node); // Sends XML node. HJHANDLER STDMETHODCALLTYPE AddPresenceHandler(JABBER_HANDLER_FUNC Func, void *pUserData, int iPriority); - HJHANDLER STDMETHODCALLTYPE AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData, int iPriority); - HJHANDLER STDMETHODCALLTYPE AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData, int iPriority); + HJHANDLER STDMETHODCALLTYPE AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgTypes, const wchar_t *szXmlns, const wchar_t *szTag, void *pUserData, int iPriority); + HJHANDLER STDMETHODCALLTYPE AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, const wchar_t *szXmlns, const wchar_t *szTag, void *pUserData, int iPriority); HJHANDLER STDMETHODCALLTYPE AddTemporaryIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, int iIqId, void *pUserData, DWORD dwTimeout, int iPriority); HJHANDLER STDMETHODCALLTYPE AddSendHandler(JABBER_HANDLER_FUNC Func, void *pUserData, int iPriority); int STDMETHODCALLTYPE RemoveHandler(HJHANDLER hHandler); - int STDMETHODCALLTYPE RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription); - int STDMETHODCALLTYPE AddFeatures(LPCTSTR szFeatures); // Adds features to the list of features returned by the client. - int STDMETHODCALLTYPE RemoveFeatures(LPCTSTR szFeatures); // Removes features from the list of features returned by the client. - LPTSTR STDMETHODCALLTYPE GetResourceFeatures(LPCTSTR jid); // Returns all features supported by JID in format "feature1\0feature2\0...\0featureN\0\0". You must free returned string using mir_free(). + int STDMETHODCALLTYPE RegisterFeature(const wchar_t *szFeature, const wchar_t *szDescription); + int STDMETHODCALLTYPE AddFeatures(const wchar_t *szFeatures); // Adds features to the list of features returned by the client. + int STDMETHODCALLTYPE RemoveFeatures(const wchar_t *szFeatures); // Removes features from the list of features returned by the client. + LPTSTR STDMETHODCALLTYPE GetResourceFeatures(const wchar_t *jid); // Returns all features supported by JID in format "feature1\0feature2\0...\0featureN\0\0". You must free returned string using mir_free(). HNETLIBUSER STDMETHODCALLTYPE GetHandle(); // Returns connection handle private: - JabberFeatCapPairDynamic *FindFeature(LPCTSTR szFeature); + JabberFeatCapPairDynamic *FindFeature(const wchar_t *szFeature); }; extern LIST g_Instances; -- cgit v1.2.3