telegram-purple/loop.h

80 lines
2 KiB
C
Raw Permalink Normal View History

2013-10-23 18:26:17 +04:00
/*
This file is part of telegram-client.
Telegram-client 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.
Telegram-client 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 telegram-client. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013
*/
2014-07-26 11:55:45 +02:00
2014-09-01 22:17:42 +02:00
#include "telegram.h"
2013-10-03 16:38:25 +04:00
#ifndef __LOOP_H__
#define __LOOP_H__
2014-08-06 19:45:46 +02:00
// forward declarations
struct dc;
2014-09-01 22:17:42 +02:00
struct telegram;
2014-08-06 19:45:46 +02:00
2014-07-26 11:55:45 +02:00
2014-09-01 22:17:42 +02:00
/**
* The authorization state, storing all known data centers of the telegram
* network and associated shared keys for transport encryption
*/
2014-07-26 11:55:45 +02:00
struct authorization_state {
int dc_working_num;
int auth_state;
2014-07-29 15:28:04 +02:00
struct dc* DC_list[11];
2014-07-26 11:55:45 +02:00
int our_id;
};
2014-09-01 22:17:42 +02:00
/**
* Stores the current update state of a client
*/
struct protocol_state {
/**
* Number of events occured in a text box
*/
int pts;
/**
* Position within a siccession of unconfirmed updates, used for encrypted
* messages
*/
int qts;
/**
* Number of sent updates
*/
int seq;
/**
* Last update
*/
int last_date;
};
void write_secret_chat_file (struct telegram *instance, const char *filename);
2014-07-29 15:28:04 +02:00
void write_auth_file (struct authorization_state *state, const char *filename);
2014-07-26 11:55:45 +02:00
struct authorization_state read_auth_file (const char *filename);
2014-07-29 15:28:04 +02:00
void write_state_file (struct protocol_state *state, const char *filename);
2014-07-26 11:55:45 +02:00
struct protocol_state read_state_file (const char *filename);
void write_secret_chat_file (struct telegram *instance, const char *filename);
void read_secret_chat_file (struct telegram *instance, const char *filename);
2014-08-06 19:45:46 +02:00
#endif