Add a few comments

This commit is contained in:
mjentsch 2014-09-01 22:17:42 +02:00
parent 0aa8a9de15
commit 305253b3f6
2 changed files with 43 additions and 16 deletions

51
loop.h
View file

@ -17,27 +17,20 @@
Copyright Vitaly Valtman 2013
*/
#include "telegram.h"
#ifndef __LOOP_H__
#define __LOOP_H__
// forward declarations
struct dc;
struct telegram;
#ifndef __TELEGRAM_H__
struct authorization_state;
struct protocol_state;
#endif
int loop();
void write_secret_chat_file (const char *filename);
struct protocol_state {
int pts;
int qts;
int seq;
int last_date;
};
/**
* The authorization state, storing all known data centers of the telegram
* network and associated shared keys for transport encryption
*/
struct authorization_state {
int dc_working_num;
int auth_state;
@ -45,6 +38,36 @@ struct authorization_state {
int our_id;
};
/**
* 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;
};
int loop();
void write_secret_chat_file (struct telegram *instance, const char *filename);
void write_auth_file (struct authorization_state *state, const char *filename);
struct authorization_state read_auth_file (const char *filename);

View file

@ -40,8 +40,6 @@ typedef struct {
PurpleAccount *pa;
PurpleConnection *gc;
int updated;
/**
* Write handler returned by purple_input_add
*/
@ -51,6 +49,12 @@ typedef struct {
* Read handler returned by purple_input_add
*/
guint rh;
/**
* Whether the state of the protocol has changed since the last save
*/
int updated;
/**
* The used purple timeout handler
*/