2014-11-16 20:41:03 +01:00
|
|
|
/*
|
|
|
|
This file is part of telegram-purple
|
2014-11-11 20:21:14 +03:00
|
|
|
|
2014-11-16 20:41:03 +01: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
|
|
|
|
|
2015-12-05 20:40:08 +01:00
|
|
|
Copyright Matthias Jentsch, Vitaly Valtman, Christopher Althaus, Ben Wiederhake 2014-2015
|
2014-11-16 20:41:03 +01:00
|
|
|
*/
|
2014-11-11 20:21:14 +03:00
|
|
|
#ifndef __TG_PURPLE_H__
|
|
|
|
#define __TG_PURPLE_H__
|
|
|
|
|
2015-10-04 16:58:25 +02:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Define macros for gettext translation, ENABLE_NLS should be set if configure has detected
|
|
|
|
// libintl.h. If this is not the case a dummy macro is defined to bypass the translation functions
|
|
|
|
#ifdef ENABLE_NLS
|
|
|
|
# include <glib/gi18n-lib.h>
|
2015-10-19 20:10:47 +02:00
|
|
|
# define P_(Singular,Plural,N) ((char *) g_dngettext (GETTEXT_PACKAGE, Singular, Plural, N))
|
2015-10-06 21:45:26 +02:00
|
|
|
#else
|
2015-10-04 16:58:25 +02:00
|
|
|
# define _(String) String
|
2015-10-19 20:10:47 +02:00
|
|
|
# define P_(Singular,Plural,N) Plural
|
2015-12-06 20:38:06 +01:00
|
|
|
# define N_(String) String
|
|
|
|
# define gettext(String) String
|
2015-10-04 16:58:25 +02:00
|
|
|
#endif
|
2014-11-11 20:21:14 +03:00
|
|
|
|
2015-10-04 16:58:25 +02:00
|
|
|
#include <tgl.h>
|
2015-11-23 03:06:30 +01:00
|
|
|
#include <tgl-binlog.h>
|
|
|
|
#include <tgl-queries.h>
|
|
|
|
#include <tgl-structures.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
2015-10-07 01:30:28 +02:00
|
|
|
#include <purple.h>
|
2015-10-04 16:58:25 +02:00
|
|
|
|
2015-11-23 03:06:30 +01:00
|
|
|
#include "telegram-base.h"
|
2015-10-11 14:17:24 +02:00
|
|
|
#include "tgp-blist.h"
|
|
|
|
#include "tgp-structs.h"
|
2015-11-23 03:06:30 +01:00
|
|
|
#include "tgp-2prpl.h"
|
|
|
|
#include "tgp-net.h"
|
|
|
|
#include "tgp-timers.h"
|
|
|
|
#include "tgp-utils.h"
|
|
|
|
#include "tgp-chat.h"
|
|
|
|
#include "tgp-ft.h"
|
|
|
|
#include "tgp-msg.h"
|
|
|
|
#include "tgp-request.h"
|
2016-01-03 23:55:45 +01:00
|
|
|
#include "tgp-info.h"
|
2015-11-23 03:06:30 +01:00
|
|
|
#include "msglog.h"
|
2015-10-11 14:17:24 +02:00
|
|
|
|
2015-10-04 16:58:25 +02:00
|
|
|
#define PLUGIN_ID "prpl-telegram"
|
2015-12-06 22:20:01 +01:00
|
|
|
#define PLUGIN_AUTHOR "Matthias Jentsch <mtthsjntsch@gmail.com>\n\t\t\tVitaly Valtman\n\t\t\tBen Wiederhake\n\t\t\tChristopher Althaus <althaus.christopher@gmail.com>"
|
|
|
|
|
2014-11-17 18:24:09 +03:00
|
|
|
#define TGP_APP_HASH "99428c722d0ed59b9cd844e4577cb4bb"
|
|
|
|
#define TGP_APP_ID 16154
|
2014-11-11 20:21:14 +03:00
|
|
|
|
2015-03-10 16:11:06 +01:00
|
|
|
#define TGP_MAX_MSG_SIZE 4096
|
2015-03-14 18:00:37 +01:00
|
|
|
#define TGP_DEFAULT_MAX_MSG_SPLIT_COUNT 4
|
|
|
|
|
2017-03-13 21:56:49 +01:00
|
|
|
#define TGP_DEFAULT_MEDIA_SIZE 32768
|
2016-04-02 21:58:08 +02:00
|
|
|
#define TGP_KEY_MEDIA_SIZE "media-size-threshold"
|
|
|
|
|
2015-05-30 15:52:17 +02:00
|
|
|
#define TGP_KEY_PASSWORD_TWO_FACTOR "password-two-factor"
|
|
|
|
|
2015-03-14 18:00:37 +01:00
|
|
|
#define TGP_DEFAULT_ACCEPT_SECRET_CHATS "ask"
|
|
|
|
#define TGP_KEY_ACCEPT_SECRET_CHATS "accept-secret-chats"
|
|
|
|
|
2015-03-13 16:57:08 +01:00
|
|
|
#define TGP_DEFAULT_INACTIVE_DAYS_OFFLINE 7
|
2015-03-14 18:00:37 +01:00
|
|
|
#define TGP_KEY_INACTIVE_DAYS_OFFLINE "inactive-days-offline"
|
|
|
|
|
2015-03-13 00:13:27 +01:00
|
|
|
#define TGP_DEFAULT_HISTORY_RETRIEVAL_THRESHOLD 14
|
2015-03-14 18:00:37 +01:00
|
|
|
#define TGP_KEY_HISTORY_RETRIEVAL_THRESHOLD "history-retrieve-days"
|
2015-03-13 00:13:27 +01:00
|
|
|
|
2016-01-24 21:36:41 +01:00
|
|
|
#define TGP_DEFAULT_JOIN_GROUP_CHATS TRUE
|
2015-09-12 22:21:27 +02:00
|
|
|
#define TGP_KEY_JOIN_GROUP_CHATS "auto-join-group-chats"
|
|
|
|
|
2015-05-30 15:52:17 +02:00
|
|
|
#define TGP_DEFAULT_DISPLAY_READ_NOTIFICATIONS FALSE
|
|
|
|
#define TGP_KEY_DISPLAY_READ_NOTIFICATIONS "display-read-notifications"
|
|
|
|
|
|
|
|
#define TGP_DEFAULT_SEND_READ_NOTIFICATIONS TRUE
|
|
|
|
#define TGP_KEY_SEND_READ_NOTIFICATIONS "send-read-notifications"
|
2015-05-29 18:25:55 +02:00
|
|
|
|
2016-02-06 19:50:20 +01:00
|
|
|
#define TGP_DEFAULT_CHANNEL_MEMBERS 500
|
|
|
|
#define TGP_KEY_CHANNEL_MEMBERS "channel-member-count"
|
|
|
|
|
2016-01-20 23:00:31 +01:00
|
|
|
#define TGP_KEY_RESET_AUTH "reset-authorization"
|
|
|
|
|
2016-03-23 12:46:04 +01:00
|
|
|
#define TGP_CHANNEL_HISTORY_LIMIT 500
|
|
|
|
|
2014-11-13 00:45:51 +01:00
|
|
|
extern const char *pk_path;
|
2015-10-10 17:13:07 +02:00
|
|
|
extern const char *user_pk_filename;
|
2014-11-16 16:33:27 +01:00
|
|
|
extern const char *config_dir;
|
2014-11-16 21:55:36 +01:00
|
|
|
extern PurplePlugin *_telegram_protocol;
|
2016-02-14 00:34:30 +01:00
|
|
|
void import_chat_link (struct tgl_state *TLS, const char *link);
|
|
|
|
void export_chat_link_by_name (struct tgl_state *TLS, const char *name);
|
2015-10-31 20:11:31 +01:00
|
|
|
void leave_and_delete_chat (struct tgl_state *TLS, tgl_peer_t *P);
|
2016-02-14 00:34:30 +01:00
|
|
|
void leave_and_delete_chat_by_name (struct tgl_state *TLS, const char *name);
|
2015-12-07 23:15:17 +01:00
|
|
|
void channel_load_photo (struct tgl_state *TLS, void *extra, int success, struct tgl_channel *C);
|
2014-11-13 00:45:51 +01:00
|
|
|
|
2014-11-11 20:21:14 +03:00
|
|
|
#endif
|