Commit ac649c9a authored by Bruno Coudoin's avatar Bruno Coudoin

Fixes for demo activation code to work again.

parent 659ab65d
......@@ -239,7 +239,7 @@ gc_board_check_file(GcomprisBoard *gcomprisBoard)
key_is_valid = gc_activation_check(properties->key);
i = 0;
if(key_is_valid == 1)
if(key_is_valid >= 1)
{
while(static_boards[i++] != NULL) {
......
......@@ -78,6 +78,7 @@ static void single_instance_release();
/*
* For the Activation dialog
*/
#define STATIC_MODULE 1
#ifdef STATIC_MODULE
int gc_activation_check(const char *code);
static void activation_enter_callback(GtkWidget *widget,
......@@ -870,13 +871,18 @@ display_activation_dialog()
int board_count = 0;
int gc_board_number_in_demo = 0;
GList *list;
guint key_is_valid = 0;
gint key_is_valid = 0;
key_is_valid = gc_activation_check(properties->key);
if(key_is_valid == 1)
return FALSE;
else if(key_is_valid == 2)
{
g_free ( gc_prop_get()->key );
gc_prop_get()->key = strdup("");
gc_prop_save(properties);
}
/* Count non menu boards */
for (list = gc_menu_get_boards(); list != NULL; list = list->next)
{
......@@ -929,8 +935,9 @@ display_activation_dialog()
* Return -1 if the code is not valid
* 0 if the code is valid but out of date
* 1 if the code is valid and under 2 years
* 2 if the code is valid and under 2 years
*/
int gc_activation_check(const char *code)
gint gc_activation_check(const char *code)
{
#ifdef DISABLE_ACTIVATION_CODE
return 1;
......@@ -944,6 +951,13 @@ int gc_activation_check(const char *code)
if(strlen(code) != 6)
return -1;
// A special code to test the full version without
// saving the activation
if (strncmp(code, "123321", 6) == 0)
{
return 2;
}
for(i=3; i>=0; i--)
{
value |= code[i] & 0x07;
......@@ -987,17 +1001,11 @@ activation_enter_callback( GtkWidget *entry,
GtkWidget *notused )
{
const char *code = gtk_entry_get_text(GTK_ENTRY(entry));
// A special code to test the full version without
// saving the activation
if (strncmp(code, "123321", 6) == 0)
{
gtk_entry_set_text(GTK_ENTRY(entry), "GOOD");
return;
}
switch(gc_activation_check(code))
{
case 1:
case 2:
gc_prop_get()->key = strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
gc_prop_save(properties);
gtk_entry_set_text(GTK_ENTRY(entry), "GOOD");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment