2014-05-11 22:18:21 +02:00
/**
* 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 ; either version 2 of the License , or
* ( at your option ) any later version .
*
* 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 , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02111 - 1301 USA
*/
2014-08-06 19:45:46 +02:00
# ifndef __TG_PURPLE_H__
# define __TG_PURPLE_H__
2014-05-11 22:18:21 +02:00
2014-10-05 12:19:15 +02:00
# define PLUGIN_ID "prpl-telegram"
2014-05-23 11:36:54 +02:00
# define TELEGRAM_AUTH_MODE_PHONE "phone"
# define TELEGRAM_AUTH_MODE_SMS "sms"
2014-10-14 22:29:22 +02:00
# define TG_AUTHOR "Christopher Althaus <althaus.christopher@gmail.com>, Markus Endres <endresma45241@th-nuernberg.de>, Matthias Jentsch <mtthsjntsch@gmail.com>. Based on telegram-cli by Vitaly Valtman."
# define TG_DESCRIPTION "Adds support for Telegram."
# define TG_VERSION "0.3.3"
# define TG_BUILD "8"
2014-05-23 11:36:54 +02:00
2014-08-06 19:45:46 +02:00
# include <glib.h>
# include "notify.h"
# include "plugin.h"
# include "version.h"
# include "account.h"
# include "connection.h"
2014-09-17 22:51:46 +02:00
# include "mtproto-client.h"
2014-08-06 19:45:46 +02:00
2014-05-11 22:18:21 +02:00
typedef struct {
2014-07-26 11:55:45 +02:00
struct telegram * tg ;
PurpleAccount * pa ;
2014-05-11 22:18:21 +02:00
PurpleConnection * gc ;
2014-09-17 22:51:46 +02:00
/**
* Whether the state of the protocol has changed since the last save
*/
int updated ;
/**
* The used purple timeout handler
*/
guint timer ;
2014-09-19 18:22:11 +02:00
/**
* Queue of all new messages that need to be added to a chat
*/
GQueue * new_messages ;
/**
* Queue of all joined chats
*/
GHashTable * joining_chats ;
2014-09-17 22:51:46 +02:00
} telegram_conn ;
typedef struct {
/**
* The mtproto_connection associated with this handle
*/
struct mtproto_connection * mtp ;
2014-07-29 15:28:04 +02:00
/**
* Write handler returned by purple_input_add
*/
guint wh ;
/**
* Read handler returned by purple_input_add
*/
guint rh ;
2014-09-01 22:17:42 +02:00
2014-09-01 21:57:35 +02:00
/**
2014-09-17 22:51:46 +02:00
* The file descriptor of the used socket
2014-09-01 21:57:35 +02:00
*/
2014-09-17 22:51:46 +02:00
int fd ;
2014-09-01 21:57:35 +02:00
2014-09-17 22:51:46 +02:00
} mtproto_handle ;
2014-08-06 19:45:46 +02:00
# endif