Changeset 3c80a9d for otr.c


Ignore:
Timestamp:
2008-02-03T22:28:13Z (16 years ago)
Author:
Sven Moritz Hallberg <sm@…>
Branches:
master
Children:
a13855a
Parents:
764c7d1
Message:

otr: check some error conditions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • otr.c

    r764c7d1 r3c80a9d  
    164164        e = otrl_privkey_read(irc->otr_us, s);
    165165        if(e && e!=ENOENT) {
    166                 log_message(LOGLVL_ERROR, "%s: %s", s, strerror(e));
     166                log_message(LOGLVL_ERROR, "otr load: %s: %s", s, strerror(e));
    167167        }
    168168        g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->nick);
    169169        e = otrl_privkey_read_fingerprints(irc->otr_us, s, NULL, NULL);
    170170        if(e && e!=ENOENT) {
    171                 log_message(LOGLVL_ERROR, "%s: %s", s, strerror(e));
     171                log_message(LOGLVL_ERROR, "otr load: %s: %s", s, strerror(e));
    172172        }
    173173       
     
    181181{
    182182        char s[512];
     183        gcry_error_t e;
    183184
    184185        log_message(LOGLVL_DEBUG, "otr_save '%s'", irc->nick);
    185186
    186187        g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->nick);
    187         otrl_privkey_write_fingerprints(irc->otr_us, s);
     188        e = otrl_privkey_write_fingerprints(irc->otr_us, s);
     189        if(e) {
     190                log_message(LOGLVL_ERROR, "otr save: %s: %s", s, strerror(e));
     191        }
    188192}
    189193
     
    537541                u->ic->acc->user, u->ic->acc->prpl->name, 1, NULL, NULL, NULL);
    538542        if(!ctx) {
     543                /* huh? out of memory or what? */
    539544                return;
    540545        }
     
    686691        context = otrl_context_find(us, handle,
    687692                ic->acc->user, ic->acc->prpl->name, 1, NULL, NULL, NULL);
    688         if(!context) return;
     693        if(!context) {
     694                /* huh? out of memory or what? */
     695                return;
     696        }
    689697        nextMsg = context->smstate->nextExpected;
    690698
     
    915923        if(kg->done) {
    916924                if(kg->result) {
    917                         irc_usermsg(kg->irc, "otr keygen failed: libgcrypt error"); /* TODO: diagnostics */
     925                        irc_usermsg(kg->irc, "otr keygen: %s", strerror(kg->result));
    918926                } else {
    919927                        irc_usermsg(kg->irc, "otr keygen for %s/%s complete", kg->handle, kg->protocol);
Note: See TracChangeset for help on using the changeset viewer.