diff options
Diffstat (limited to 'protocols/Telegram/src/t_proto.h')
-rw-r--r-- | protocols/Telegram/src/t_proto.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/protocols/Telegram/src/t_proto.h b/protocols/Telegram/src/t_proto.h new file mode 100644 index 0000000000..4b486cafbe --- /dev/null +++ b/protocols/Telegram/src/t_proto.h @@ -0,0 +1,103 @@ +/*
+Copyright (c) 2015 Miranda NG project (http://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _T_PROTO_H_
+#define _T_PROTO_H_
+
+
+struct CTelegramProto : public PROTO < CTelegramProto >
+{
+
+public:
+
+ //////////////////////////////////////////////////////////////////////////////////////
+ //Ctors
+
+ CTelegramProto(const char *protoName, const wchar_t *userName);
+ ~CTelegramProto();
+
+ //////////////////////////////////////////////////////////////////////////////////////
+ // Virtual functions
+
+ virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
+ virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent);
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage);
+ virtual int __cdecl Authorize(MEVENT hDbEvent);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason);
+ virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*);
+ virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
+ virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
+ virtual HANDLE __cdecl SearchBasic(const TCHAR* id);
+ virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
+ virtual int __cdecl SetStatus(int iNewStatus);
+ virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
+ virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam);
+
+ // accounts
+ static CTelegramProto* InitAccount(const char *protoName, const TCHAR *userName);
+ static int UninitAccount(CTelegramProto *proto);
+
+ // icons
+ static void InitIcons();
+ static void UninitIcons();
+
+ // menus
+ static void InitMenus();
+ static void UninitMenus();
+
+ //popups
+ void InitPopups();
+ void UninitPopups();
+
+ // languages
+ static void InitLanguages();
+
+ // events
+ static int OnModulesLoaded(WPARAM, LPARAM);
+ int __cdecl OnDbEventRead(WPARAM, LPARAM);
+ int __cdecl OnPreShutdown(WPARAM, LPARAM);
+ //search
+ void __cdecl SearchBasicThread(void* id);
+
+ ////////////////////////////////////////////
+ static INT_PTR EventGetIcon(WPARAM wParam, LPARAM lParam);
+ static INT_PTR GetEventText(WPARAM, LPARAM lParam);
+
+private:
+
+ tgl_state tgl;
+ static mir_cs accountsLock;
+
+ //---Accounts
+ static LIST<CTelegramProto> CTelegramProto::Accounts;
+ static int CompareAccounts(const CTelegramProto *p1, const CTelegramProto *p2);
+ static CTelegramProto* GetContactAccount(MCONTACT hContact);
+
+ __forceinline bool IsOnline() const
+ { return (m_iStatus > ID_STATUS_OFFLINE);
+ }
+
+ template<INT_PTR(__cdecl CTelegramProto::*Service)(WPARAM, LPARAM)>
+ static INT_PTR __cdecl GlobalService(WPARAM wParam, LPARAM lParam)
+ {
+ CTelegramProto *proto = GetContactAccount((MCONTACT)wParam);
+ return proto ? (proto->*Service)(wParam, lParam) : 0;
+ }
+
+};
+
+#endif //_Telegram_PROTO_H_
\ No newline at end of file |