view src/protocols/zephyr/error_message.c @ 7431:643cbc9a6035

[gaim-migrate @ 8036] This is good enough for CVS. This is new logging. It centers around the highly modular "GaimLogLogger," which controls how to write the log. Currently I only have the plain text logger. I wrote the beginning of an XML logger, but decided I didn't think it was that great an idea. Plugins can implement loggers themselves, so you can have, like, an SQL logger or something. The default logger writes to a file unique to the conversation, and they're saved on disk in a heirarchical fashion: ~/.gaim/logs/aim/seanegn/robflynn-date.log would be a conversation I had with Rob on date. What doesn't work: System logging The search button in the log viewer. Oh, chats probably don't log either, I didn't test. You can only log in plain text right now. Obviously, it's not done yet. But you can play around with it, and give it some love. I'll get back to it tomorrow after school, maybe. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 05 Nov 2003 06:15:49 +0000
parents 347e456550e6
children 64895571248f
line wrap: on
line source

/*
 * $Header$
 * $Source$
 * $Locker$
 *
 * Copyright 1987 by the Student Information Processing Board
 * of the Massachusetts Institute of Technology
 *
 * For copyright info, see "mit-sipb-copyright.h".
 */

#include "error_table.h"
#include "mit-sipb-copyright.h"
#include "com_err.h"
#include <sysdep.h>

static const char rcsid[] =
    "$Header$";
static const char copyright[] =
    "Copyright 1986, 1987, 1988 by the Student Information Processing Board\nand the department of Information Systems\nof the Massachusetts Institute of Technology";

char *error_table_name_r __P((int, char *));

struct et_list * _et_list = (struct et_list *) NULL;

const char * error_message (code)
long	code;
{
    static char buf[COM_ERR_BUF_LEN];

    return(error_message_r(code, buf));
}

const char * error_message_r (code, buf)
long	code;
char	*buf;
{
    int offset;
    struct et_list *et;
    int table_num;
    int started = 0;
    char *cp, namebuf[6];

    offset = code & ((1<<ERRCODE_RANGE)-1);
    table_num = code - offset;
    if (!table_num)
	return strerror(offset);
    for (et = _et_list; et; et = et->next) {
	if (et->table->base == table_num) {
	    /* This is the right table */
	    if (et->table->n_msgs <= offset)
		break;
	    return(et->table->msgs[offset]);
	}
    }

    strcpy (buf, "Unknown code ");
    if (table_num) {
	strcat (buf, error_table_name_r (table_num, namebuf));
	strcat (buf, " ");
    }
    for (cp = buf; *cp; cp++)
	;
    if (offset >= 100) {
	*cp++ = '0' + offset / 100;
	offset %= 100;
	started++;
    }
    if (started || offset >= 10) {
	*cp++ = '0' + offset / 10;
	offset %= 10;
    }
    *cp++ = '0' + offset;
    *cp = '\0';
    return(buf);
}