Use our own application configuration

This commit is contained in:
mjentsch 2014-10-02 13:29:54 +02:00
parent 3fa72a9d42
commit d4eff42a42
3 changed files with 12 additions and 36 deletions

14
net.h
View file

@ -27,13 +27,13 @@ struct dc;
#include "telegram.h"
#include "queries.h"
#define TG_SERVER "173.240.5.1"
#define TG_SERVER_TEST "173.240.5.253"
#define TG_APP_HASH "36722c72256a24c1225de00eb6a1ca74"
#define TG_APP_ID 2899
#define TG_BUILD "209"
#define TG_VERSION "0.01-beta"
#define TG_SERVER "149.154.167.50"
#define TG_SERVER_TEST "149.154.167.40"
#define TG_PORT 443
#define TG_APP_HASH "99428c722d0ed59b9cd844e4577cb4bb"
#define TG_APP_ID 16154
#define TG_BUILD "0"
#define TG_VERSION "0.2.0"
#define ACK_TIMEOUT 1
#define MAX_DC_ID 10

View file

@ -174,17 +174,6 @@ static void tgprpl_tooltip_text(PurpleBuddy * buddy, PurpleNotifyUserInfo * info
}
/**
* Handle a failed verification by removing the invalid sms code and notifying the user
*/
static void login_verification_fail(PurpleAccount *acct)
{
// remove invalid sms code, so we won't try to register again
purple_account_set_string(acct, "verification_key", "");
purple_notify_message(_telegram_protocol, PURPLE_NOTIFY_MSG_INFO, "Verification Failed",
"Please make sure you entered the correct verification code.", NULL, NULL, NULL);
}
/* OUTPUT */
/**
@ -254,8 +243,8 @@ static void tgprpl_has_input(void *handle)
static void init_dc_settings(PurpleAccount *acc, struct dc *DC)
{
DC->port = purple_account_get_int(acc, "port", TELEGRAM_DEFAULT_PORT);
DC->ip = g_strdup(purple_account_get_string(acc, "server", TELEGRAM_TEST_SERVER));
DC->port = purple_account_get_int(acc, "port", TG_PORT);
DC->ip = g_strdup(purple_account_get_string(acc, "server", TG_SERVER));
DC->id = 0;
}
@ -293,9 +282,9 @@ void telegram_on_proxy_close(void *handle)
void telegram_on_phone_registration (struct telegram *instance)
{
// TODO: Query first and last name from user and start phone registration
telegram_conn *conn = instance->extra;
// TODO: Request first and last name
purple_debug_info(PLUGIN_ID, "Phone is not registered, registering...\n");
const char *first_name = purple_account_get_string(conn->pa, "first_name", NULL);
const char *last_name = purple_account_get_string(conn->pa, "last_name", NULL);
@ -1248,12 +1237,6 @@ static void tgprpl_init(PurplePlugin *plugin)
option = purple_account_option_list_new("Verification type", "verification_type", verification_values);
prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
option = purple_account_option_string_new("Verification key", "verification_key", NULL);
prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
option = purple_account_option_string_new("Verification hash", "verification_hash", NULL);
prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
option = purple_account_option_string_new("First Name", "first_name", NULL);
prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
@ -1264,10 +1247,10 @@ static void tgprpl_init(PurplePlugin *plugin)
// TODO: Path to public key (When you can change the server hostname,
// you should also be able to change the public key)
option = purple_account_option_string_new("Server", "server", TELEGRAM_TEST_SERVER);
option = purple_account_option_string_new("Server", "server", TG_SERVER);
prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
option = purple_account_option_int_new("Port", "port", TELEGRAM_DEFAULT_PORT);
option = purple_account_option_int_new("Port", "port", TG_PORT);
prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
_telegram_protocol = plugin;

View file

@ -18,13 +18,6 @@
#define __TG_PURPLE_H__
#define PLUGIN_ID "prpl-telegram"
#define TELEGRAM_APP_API_ID 16944
#define TELEGRAM_APP_API_HASH "457b5a190c750ed0a772bc48bbdf75dc"
#define TELEGRAM_TEST_SERVER "173.240.5.253"
#define TELEGRAM_PRODUCTION_SERVER "173.240.5.1"
#define TELEGRAM_DEFAULT_PORT 443
#define TELEGRAM_PUBLIC_KEY "-----BEGIN RSA PUBLIC KEY-----MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daSan9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTwEfzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3nSlv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB-----END RSA PUBLIC KEY-----"
#define TELEGRAM_AUTH_MODE_PHONE "phone"
#define TELEGRAM_AUTH_MODE_SMS "sms"