Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/settings.c @ 2337:ffd0e57e9563
Defined types shall end with "_t"
author | franky |
---|---|
date | Sun, 12 May 2019 11:32:30 +0200 |
parents | f5402d705f67 |
children | 7f11a567d236 |
comparison
equal
deleted
inserted
replaced
2336:0dc317b5599d | 2337:ffd0e57e9563 |
---|---|
45 | 45 |
46 typedef struct { | 46 typedef struct { |
47 gchar *pgp_keyid; /* KeyId the contact is supposed to use */ | 47 gchar *pgp_keyid; /* KeyId the contact is supposed to use */ |
48 guint pgp_disabled; /* If TRUE, PGP is disabled for outgoing messages */ | 48 guint pgp_disabled; /* If TRUE, PGP is disabled for outgoing messages */ |
49 guint pgp_force; /* If TRUE, PGP is used w/o negotiation */ | 49 guint pgp_force; /* If TRUE, PGP is used w/o negotiation */ |
50 } T_pgpopt; | 50 } pgpopt_t; |
51 #endif | 51 #endif |
52 | 52 |
53 typedef struct { | 53 typedef struct { |
54 settings_guard_t guard; | 54 settings_guard_t guard; |
55 } installed_guard_t; | 55 } installed_guard_t; |
515 // Enable/disable PGP encryption for jid. | 515 // Enable/disable PGP encryption for jid. |
516 // (Set value to TRUE to disable encryption) | 516 // (Set value to TRUE to disable encryption) |
517 void settings_pgp_setdisabled(const char *bjid, guint value) | 517 void settings_pgp_setdisabled(const char *bjid, guint value) |
518 { | 518 { |
519 #ifdef HAVE_GPGME | 519 #ifdef HAVE_GPGME |
520 T_pgpopt *pgpdata; | 520 pgpopt_t *pgpdata; |
521 pgpdata = g_hash_table_lookup(pgpopt, bjid); | 521 pgpdata = g_hash_table_lookup(pgpopt, bjid); |
522 if (!pgpdata) { | 522 if (!pgpdata) { |
523 // If value is 0, we do not need to create a structure (that's | 523 // If value is 0, we do not need to create a structure (that's |
524 // the default value). | 524 // the default value). |
525 if (value) { | 525 if (value) { |
526 pgpdata = g_new0(T_pgpopt, 1); | 526 pgpdata = g_new0(pgpopt_t, 1); |
527 pgpdata->pgp_disabled = value; | 527 pgpdata->pgp_disabled = value; |
528 g_hash_table_insert(pgpopt, g_strdup(bjid), pgpdata); | 528 g_hash_table_insert(pgpopt, g_strdup(bjid), pgpdata); |
529 } | 529 } |
530 } else { | 530 } else { |
531 pgpdata->pgp_disabled = value; | 531 pgpdata->pgp_disabled = value; |
538 // settings_pgp_getdisabled(jid) | 538 // settings_pgp_getdisabled(jid) |
539 // Return TRUE if PGP encryption should be disabled for jid. | 539 // Return TRUE if PGP encryption should be disabled for jid. |
540 guint settings_pgp_getdisabled(const char *bjid) | 540 guint settings_pgp_getdisabled(const char *bjid) |
541 { | 541 { |
542 #ifdef HAVE_GPGME | 542 #ifdef HAVE_GPGME |
543 T_pgpopt *pgpdata; | 543 pgpopt_t *pgpdata; |
544 pgpdata = g_hash_table_lookup(pgpopt, bjid); | 544 pgpdata = g_hash_table_lookup(pgpopt, bjid); |
545 if (pgpdata) | 545 if (pgpdata) |
546 return pgpdata->pgp_disabled; | 546 return pgpdata->pgp_disabled; |
547 else | 547 else |
548 return FALSE; // Default: not disabled | 548 return FALSE; // Default: not disabled |
555 // Force (or not) PGP encryption for jid. | 555 // Force (or not) PGP encryption for jid. |
556 // When value is TRUE, PGP support will be assumed for the remote client. | 556 // When value is TRUE, PGP support will be assumed for the remote client. |
557 void settings_pgp_setforce(const char *bjid, guint value) | 557 void settings_pgp_setforce(const char *bjid, guint value) |
558 { | 558 { |
559 #ifdef HAVE_GPGME | 559 #ifdef HAVE_GPGME |
560 T_pgpopt *pgpdata; | 560 pgpopt_t *pgpdata; |
561 pgpdata = g_hash_table_lookup(pgpopt, bjid); | 561 pgpdata = g_hash_table_lookup(pgpopt, bjid); |
562 if (!pgpdata) { | 562 if (!pgpdata) { |
563 // If value is 0, we do not need to create a structure (that's | 563 // If value is 0, we do not need to create a structure (that's |
564 // the default value). | 564 // the default value). |
565 if (value) { | 565 if (value) { |
566 pgpdata = g_new0(T_pgpopt, 1); | 566 pgpdata = g_new0(pgpopt_t, 1); |
567 pgpdata->pgp_force = value; | 567 pgpdata->pgp_force = value; |
568 g_hash_table_insert(pgpopt, g_strdup(bjid), pgpdata); | 568 g_hash_table_insert(pgpopt, g_strdup(bjid), pgpdata); |
569 } | 569 } |
570 } else { | 570 } else { |
571 pgpdata->pgp_force = value; | 571 pgpdata->pgp_force = value; |
578 // settings_pgp_getforce(jid) | 578 // settings_pgp_getforce(jid) |
579 // Return TRUE if PGP enforcement is set for jid. | 579 // Return TRUE if PGP enforcement is set for jid. |
580 guint settings_pgp_getforce(const char *bjid) | 580 guint settings_pgp_getforce(const char *bjid) |
581 { | 581 { |
582 #ifdef HAVE_GPGME | 582 #ifdef HAVE_GPGME |
583 T_pgpopt *pgpdata; | 583 pgpopt_t *pgpdata; |
584 pgpdata = g_hash_table_lookup(pgpopt, bjid); | 584 pgpdata = g_hash_table_lookup(pgpopt, bjid); |
585 if (pgpdata) | 585 if (pgpdata) |
586 return pgpdata->pgp_force; | 586 return pgpdata->pgp_force; |
587 else | 587 else |
588 return FALSE; // Default | 588 return FALSE; // Default |
595 // Set the PGP KeyId for user jid. | 595 // Set the PGP KeyId for user jid. |
596 // Use keyid = NULL to erase the previous KeyId. | 596 // Use keyid = NULL to erase the previous KeyId. |
597 void settings_pgp_setkeyid(const char *bjid, const char *keyid) | 597 void settings_pgp_setkeyid(const char *bjid, const char *keyid) |
598 { | 598 { |
599 #ifdef HAVE_GPGME | 599 #ifdef HAVE_GPGME |
600 T_pgpopt *pgpdata; | 600 pgpopt_t *pgpdata; |
601 pgpdata = g_hash_table_lookup(pgpopt, bjid); | 601 pgpdata = g_hash_table_lookup(pgpopt, bjid); |
602 if (!pgpdata) { | 602 if (!pgpdata) { |
603 // If keyid is NULL, we do not need to create a structure (that's | 603 // If keyid is NULL, we do not need to create a structure (that's |
604 // the default value). | 604 // the default value). |
605 if (keyid) { | 605 if (keyid) { |
606 pgpdata = g_new0(T_pgpopt, 1); | 606 pgpdata = g_new0(pgpopt_t, 1); |
607 pgpdata->pgp_keyid = g_strdup(keyid); | 607 pgpdata->pgp_keyid = g_strdup(keyid); |
608 g_hash_table_insert(pgpopt, g_strdup(bjid), pgpdata); | 608 g_hash_table_insert(pgpopt, g_strdup(bjid), pgpdata); |
609 } | 609 } |
610 } else { | 610 } else { |
611 g_free(pgpdata->pgp_keyid); | 611 g_free(pgpdata->pgp_keyid); |
622 // settings_pgp_getkeyid(jid) | 622 // settings_pgp_getkeyid(jid) |
623 // Get the PGP KeyId for user jid. | 623 // Get the PGP KeyId for user jid. |
624 const char *settings_pgp_getkeyid(const char *bjid) | 624 const char *settings_pgp_getkeyid(const char *bjid) |
625 { | 625 { |
626 #ifdef HAVE_GPGME | 626 #ifdef HAVE_GPGME |
627 T_pgpopt *pgpdata; | 627 pgpopt_t *pgpdata; |
628 pgpdata = g_hash_table_lookup(pgpopt, bjid); | 628 pgpdata = g_hash_table_lookup(pgpopt, bjid); |
629 if (pgpdata) | 629 if (pgpdata) |
630 return pgpdata->pgp_keyid; | 630 return pgpdata->pgp_keyid; |
631 #endif | 631 #endif |
632 return NULL; | 632 return NULL; |