Changeset 3064ea4 for otr.c


Ignore:
Timestamp:
2008-02-16T15:20:58Z (12 years ago)
Author:
Sven Moritz Hallberg <sm@…>
Branches:
master
Children:
1221ef0
Parents:
dc9797f
Message:

rework keygen messages and add some notices

File:
1 edited

Legend:

Unmodified
Added
Removed
  • otr.c

    rdc9797f r3064ea4  
    230230        gcry_error_t e;
    231231        gcry_error_t enoent = gcry_error_from_errno(ENOENT);
     232        int kg=0;
    232233
    233234        log_message(LOGLVL_DEBUG, "otr_load '%s'", irc->nick);
     
    246247        /* check for otr keys on all accounts */
    247248        for(a=irc->accounts; a; a=a->next) {
    248                 otr_check_for_key(a);
     249                kg = otr_check_for_key(a) || kg;
     250        }
     251        if(kg) {
     252                irc_usermsg(irc, "Notice: "
     253                        "The accounts above do not have OTR encryption keys associated with them, yet. "
     254                    "These keys are now being generated in the background. "
     255                    "You will be notified as they are completed. "
     256                    "It is not necessary to wait; "
     257                    "BitlBee can be used normally during key generation. "
     258                    "You may safely ignore this message if you don't know what OTR is. ;)");
    249259        }
    250260}
     
    291301}
    292302
    293 void otr_check_for_key(account_t *a)
     303int otr_check_for_key(account_t *a)
    294304{
    295305        irc_t *irc = a->irc;
     
    299309        if(k) {
    300310                irc_usermsg(irc, "otr: %s/%s ready", a->user, a->prpl->name);
     311                return 0;
    301312        } if(keygen_in_progress(irc, a->user, a->prpl->name)) {
    302                 irc_usermsg(irc, "otr: keygen for %s/%s in progress", a->user, a->prpl->name);
     313                irc_usermsg(irc, "otr: keygen for %s/%s already in progress", a->user, a->prpl->name);
     314                return 0;
    303315        } else {
     316                irc_usermsg(irc, "otr: starting background keygen for %s/%s", a->user, a->prpl->name);
    304317                otr_keygen(irc, a->user, a->prpl->name);
     318                return 1;
    305319        }
    306320}
     
    12451259        }
    12461260        if(count==0)
    1247                 irc_usermsg(irc, "  no fingerprints");
     1261                irc_usermsg(irc, "  (none)");
    12481262}
    12491263
     
    13851399        OtrlPrivKey *key;
    13861400        char human[45];
    1387 
    1388         /* list all privkeys */
     1401        kg_t *kg;
     1402
     1403        /* list all privkeys (including ones being generated) */
    13891404        irc_usermsg(irc, "\x1fprivate keys:\x1f");
    13901405        for(key=irc->otr->us->privkey_root; key; key=key->next) {
     
    14071422                        irc_usermsg(irc, "    %s", human);
    14081423        }
     1424        for(kg=irc->otr->todo; kg; kg=kg->next) {
     1425                irc_usermsg(irc, "  %s/%s - DSA", kg->accountname, kg->protocol);
     1426                irc_usermsg(irc, "    (being generated)");
     1427        }
     1428        if(key == irc->otr->us->privkey_root && kg == irc->otr->todo)
     1429                irc_usermsg(irc, "  (none)");
    14091430
    14101431        /* list all contexts */
     
    14311452                g_free(userstring);
    14321453        }
     1454        if(ctx == irc->otr->us->context_root)
     1455                irc_usermsg(irc, "  (none)");
    14331456}
    14341457
     
    14991522        if(keygen_in_progress(irc, handle, protocol))
    15001523                return;
    1501        
    1502         irc_usermsg(irc, "generating new private key for %s/%s...", handle, protocol);
    15031524
    15041525        /* see if we already have a keygen child running. if not, start one and put a
     
    16871708                        acc->user, acc->prpl->name);
    16881709        } else {
     1710                irc_usermsg(acc->irc, "starting background keygen for %s/%s",
     1711                        acc->user, acc->prpl->name);
     1712                irc_usermsg(acc->irc, "you will be notified when it completes");
    16891713                otr_keygen(acc->irc, acc->user, acc->prpl->name);
    16901714        }
Note: See TracChangeset for help on using the changeset viewer.