void OtrInternal::deleteFingerprint(const psiotr::Fingerprint& fingerprint)
{
    ConnContext* context = otrl_context_find(m_userstate,
                                             fingerprint.username.toUtf8().constData(),
                                             fingerprint.account.toUtf8().constData(),
                                             OTR_PROTOCOL_STRING,
#if (OTRL_VERSION_MAJOR >= 4)
                                             OTRL_INSTAG_BEST,
#endif
                                             false, NULL, NULL, NULL);
    if (context)
    {
        ::Fingerprint* fp = otrl_context_find_fingerprint(context,
                                                          fingerprint.fingerprint,
                                                          0, NULL);
        if (fp)
        {
            if (context->active_fingerprint == fp)
            {
                otrl_context_force_finished(context);
            }
            otrl_context_forget_fingerprint(fp, true);
            write_fingerprints();
        }
    }
}
void OtrInternal::verifyFingerprint(const psiotr::Fingerprint& fingerprint,
                                    bool verified)
{
    ConnContext* context = otrl_context_find(m_userstate,
                                             fingerprint.username.toUtf8().constData(),
                                             fingerprint.account.toUtf8().constData(),
                                             OTR_PROTOCOL_STRING,
#if (OTRL_VERSION_MAJOR >= 4)
                                             OTRL_INSTAG_BEST,
#endif
                                             false, NULL, NULL, NULL);
    if (context)
    {
        ::Fingerprint* fp = otrl_context_find_fingerprint(context,
                                                          fingerprint.fingerprint,
                                                          0, NULL);
        if (fp)
        {
            otrl_context_set_trust(fp, verified? "verified" : "");
            write_fingerprints();

            if (context->active_fingerprint == fp)
            {
                m_callback->stateChange(QString::fromUtf8(context->accountname),
                                        QString::fromUtf8(context->username),
                                        psiotr::OTR_STATECHANGE_TRUST);
            }
        }
    }
}
예제 #3
0
GtMD5Tab* gt_md5_tab_new(const char *sequence_file, void *seqs,
                         GtGetSeqFunc get_seq, GtGetSeqLenFunc get_seq_len,
                         GtUword num_of_seqs, bool use_cache_file,
                         bool use_file_locking)
{
  GtMD5Tab *md5_tab;
  bool reading_succeeded = false;
  GtStr *fingerprints_filename;
  gt_assert(sequence_file && seqs && get_seq && get_seq_len);
  md5_tab = gt_calloc(1, sizeof *md5_tab);
  md5_tab->num_of_md5s = num_of_seqs;
  fingerprints_filename = gt_str_new_cstr(sequence_file);
  gt_str_append_cstr(fingerprints_filename, GT_MD5_TAB_FILE_SUFFIX);
  if (use_cache_file && gt_file_exists(gt_str_get(fingerprints_filename)) &&
      !gt_file_is_newer(sequence_file, gt_str_get(fingerprints_filename))) {
    /* only try to read the fingerprint file if the sequence file was not
       modified in the meantime */
    reading_succeeded = read_fingerprints(md5_tab,
                                          gt_str_get(fingerprints_filename),
                                          use_file_locking);
  }
  if (!reading_succeeded) {
    md5_tab->md5_fingerprints = gt_calloc(num_of_seqs, sizeof (char*));
    add_fingerprints(md5_tab->md5_fingerprints, seqs, get_seq, get_seq_len,
                     num_of_seqs);
    md5_tab->owns_md5s = true;
    if (use_cache_file) {
      write_fingerprints(md5_tab->md5_fingerprints, md5_tab->num_of_md5s,
                         fingerprints_filename, use_file_locking);
    }
  }
  gt_str_delete(fingerprints_filename);
  return md5_tab;
}
/**
 * set fingerprint verified/not verified
 */
void OtrConnection::verifyFingerprint(unsigned char* fp, bool verified) {
	ConnContext* context;
	Fingerprint* fingerprint;
	for (context = userstate->context_root; context != NULL; context = context->next) {
		fingerprint = otrl_context_find_fingerprint(context, 
						            fp, 
						            0, NULL);
		if (verified) {
			otrl_context_set_trust(fingerprint, "verified");
		}
		else {
			otrl_context_set_trust(fingerprint, "");
		}
	}
	write_fingerprints();
}
/**
 * Delete a known fingerprint.
 */
void OtrConnection::deleteFingerprint(unsigned char* fpHash) {
	qWarning() << "löschen";
	ConnContext* context;
	Fingerprint* fp;
//	char fpHuman[45];
//	otrl_privkey_hash_to_human(fpHuman, fpHash);
	for (context = userstate->context_root; context != NULL; context = context->next) {
		fp = otrl_context_find_fingerprint(context, 
						   fpHash, 
						   0, NULL);
		if (fp != NULL) {
			otrl_context_forget_fingerprint(fp, 1);
			break;
		}
	}
	write_fingerprints();
}
예제 #6
0
void OtrInternal::deleteFingerprint(const qutimotr::Fingerprint& fingerprint)
{
    ConnContext* context;
    ::Fingerprint* fp;

    for (context = m_userstate->context_root; context != NULL;
         context = context->next)
    {
        fp = otrl_context_find_fingerprint(context, fingerprint.fingerprint, 0,
                                           NULL);
        if (fp != NULL)
        {
            otrl_context_forget_fingerprint(fp, true);
            break;
        }
    }
    write_fingerprints();
}
예제 #7
0
void OtrInternal::verifyFingerprint(const qutimotr::Fingerprint& fingerprint,
                                    bool verified)
{
    ConnContext* context;
    ::Fingerprint* fp;

    for (context = m_userstate->context_root; context != NULL;
         context = context->next)
    {
        fp = otrl_context_find_fingerprint(context, fingerprint.fingerprint,
                                           0, NULL);
        if (verified)
        {
            otrl_context_set_trust(fp, "verified");
        }
        else
        {
            otrl_context_set_trust(fp, "");
        }
    }

    write_fingerprints();
}