Esempio n. 1
0
File: 2p.c Progetto: rsampaio/locker
static int db_get_callback(void* arg, int num_rows, char** argv, char** column_name)
{
  int i;
  for(i=0; i<num_rows; i++){
    printf("%s", decrypt_text(argv[i], cfg.gpg_key));
  }
  printf("\n");
  return 0;
}
Esempio n. 2
0
static void
dvi_received (GtkClipboard *board, const gchar *text, SeahorseApplet *sapplet)
{
    SeahorseTextType type;      /* Type of the current block */
    gchar *rawtext = NULL;      /* Replacement text */
    guint keys = 0;             /* Number of keys imported */
    const gchar *start;         /* Pointer to start of the block */
    const gchar *end;           /* Pointer to end of the block */
    
    /* Try to figure out what clipboard contains */
    if (text == NULL)
		type = SEAHORSE_TEXT_TYPE_NONE;
	else 
	    type = detect_text_type (text, -1, &start, &end);
    
    if (type == SEAHORSE_TEXT_TYPE_NONE || type == SEAHORSE_TEXT_TYPE_PLAIN) {
        seahorse_notification_display(_("No PGP key or message was found on clipboard"),
                                      _("No PGP data found."), FALSE, NULL, GTK_WIDGET(sapplet));
		return;
	}
    
    switch (type) {

    /* A key, import it */
    case SEAHORSE_TEXT_TYPE_KEY:
        keys = import_keys (text, sapplet);
        break;

    /* A message decrypt it */
    case SEAHORSE_TEXT_TYPE_MESSAGE:
        rawtext = decrypt_text (text, sapplet);
        break;

    /* A message verify it */
    case SEAHORSE_TEXT_TYPE_SIGNED:
        rawtext = verify_text (text, sapplet);
        break;

    default:
        g_assert_not_reached ();
        break;
    };
    
    /* We got replacement text */
    if (rawtext) {

        gtk_clipboard_set_text (board, rawtext, strlen (rawtext));
        detect_received (board, rawtext, sapplet);
        
        if (((type == SEAHORSE_TEXT_TYPE_MESSAGE) && 
             (seahorse_gconf_get_boolean (DISPLAY_CLIPBOARD_DEC_KEY) == TRUE)) || 
            ((type == SEAHORSE_TEXT_TYPE_SIGNED) && 
             (seahorse_gconf_get_boolean (DISPLAY_CLIPBOARD_VER_KEY) == TRUE))) {
            /* TRANSLATORS: This means 'The text that was decrypted' */
            display_text (_("Decrypted Text"), rawtext, TRUE);
        }
        
        g_free (rawtext);
        rawtext = NULL;
    }
}