-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from paolostivanin/develop
Merge develop into master for release v1.2.0
- Loading branch information
Showing
42 changed files
with
1,531 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <gtk/gtk.h> | ||
#include <string.h> | ||
#include <zbar.h> | ||
#include "imports.h" | ||
#include "common.h" | ||
#include "parse-uri.h" | ||
|
||
static gchar *check_params (GSList *otps); | ||
|
||
|
||
gchar * | ||
add_data_to_db (const gchar *otp_uri, ImportData *import_data) | ||
{ | ||
GtkListStore *list_store = g_object_get_data (G_OBJECT (import_data->main_window), "lstore"); | ||
GSList *otps = NULL; | ||
set_otps_from_uris (otp_uri, &otps); | ||
if (g_slist_length (otps) != 1) { | ||
return g_strdup ("No valid otpauth uris found"); | ||
} | ||
|
||
gchar *err_msg = check_params (otps); | ||
if (err_msg != NULL){ | ||
return err_msg; | ||
} | ||
|
||
err_msg = update_db_from_otps (otps, import_data->db_data, list_store); | ||
if (err_msg != NULL) { | ||
return err_msg; | ||
} | ||
|
||
free_otps_gslist (otps, g_slist_length (otps)); | ||
|
||
return NULL; | ||
} | ||
|
||
|
||
static gchar * | ||
check_params (GSList *otps) | ||
{ | ||
otp_t *otp = g_slist_nth_data (otps, 0); | ||
if (otp->label == NULL) { | ||
return g_strdup ("Label can not be empty, otp not imported"); | ||
} | ||
|
||
if (strlen (otp->secret) == 0) { | ||
return g_strdup ("Secret can not be empty, otp not imported"); | ||
} | ||
|
||
return NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#pragma once | ||
|
||
gchar *add_data_to_db (const gchar *otp_uri, | ||
ImportData *import_data); |
Oops, something went wrong.