1
0
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Added some logging and updated man page

This commit is contained in:
James Booth 2012-08-22 00:30:24 +01:00
parent b30662fef7
commit 4dbd8bbefa
9 changed files with 62 additions and 8 deletions

View File

@ -1,6 +1,10 @@
.TH Profanity 1 "August 2012" "Profanity XMPP client"
.SH NAME
Profanity \- a simple console based XMPP chat client for Linux
Profanity \- a simple console based XMPP chat client for Linux, see the homepage
at:
.br
.PP
<http://www.boothj5.com/profanity.shtml>
.SH SYNOPSIS
.B profanity
[-vhd] [-l level]
@ -119,7 +123,35 @@ forground or background colour on your terminal.
The [connections] section is the list of users that will appear in tab
completion for the /connect command. This list is automatically populated
when you successfully log in as a user.
.SH BUGS
Bugs can either be reported by sending a mail directly to:
.br
.PP
<boothj5web@gmail.com>
.br
.PP
or to the mailing list at:
.br
.PP
<https://groups.google.com/forum/#!forum/profanitydev>
.br
.PP
or with a Github account by logging issues on the issue tracker at:
.br
.PP
<https://github.com/boothj5/profanity>
.SH LICENSE
Copyright (C) 2012 James Booth <boothj5web@gmail.com>.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH AUTHORS/CREDITS
.B Profanity
was written by James Booth
.B <boothj5@gmail.com>
.B <boothj5web@gmail.com>
with contributions from:
.br
.PP
Dolan O'Toole
.br
Colin Bradley

View File

@ -28,6 +28,7 @@
#include "chat_log.h"
#include "common.h"
#include "util.h"
#include "log.h"
static GHashTable *logs;
static GTimeZone *tz;
@ -37,6 +38,7 @@ static void _close_file(gpointer key, gpointer value, gpointer user_data);
void
chat_log_init(void)
{
log_msg(PROF_LEVEL_INFO, "prof", "Initialising chat logs");
tz = g_time_zone_new_local();
logs = g_hash_table_new(NULL, (GEqualFunc) g_strcmp0);
}
@ -86,6 +88,7 @@ chat_log_chat(const char * const login, char *other,
void
chat_log_close(void)
{
log_msg(PROF_LEVEL_INFO, "prof", "Closing down chat logs");
g_hash_table_foreach(logs, (GHFunc) _close_file, NULL);
g_time_zone_unref(tz);
}

View File

@ -360,6 +360,7 @@ process_input(char *inp)
void
command_init(void)
{
log_msg(PROF_LEVEL_INFO, "prof", "Initialising commands");
commands_ac = p_autocomplete_new();
unsigned int i;

View File

@ -29,12 +29,14 @@
#include "contact.h"
#include "contact_list.h"
#include "prof_autocomplete.h"
#include "log.h"
static PAutocomplete ac;
void
contact_list_init(void)
{
log_msg(PROF_LEVEL_INFO, "prof", "Initialising contact list");
ac = p_obj_autocomplete_new((PStrFunc)p_contact_name,
(PCopyFunc)p_contact_copy,
(PEqualDeepFunc)p_contacts_equal_deep,

View File

@ -111,6 +111,7 @@ static int _ping_timed_handler(xmpp_conn_t * const conn, void * const userdata);
void
jabber_init(const int disable_tls)
{
log_msg(PROF_LEVEL_INFO, "prof", "Initialising XMPP");
jabber_conn.conn_status = JABBER_STARTED;
jabber_conn.presence = PRESENCE_OFFLINE;
jabber_conn.tls_disabled = disable_tls;
@ -126,6 +127,7 @@ jabber_conn_status_t
jabber_connect(const char * const user,
const char * const passwd)
{
log_msg(PROF_LEVEL_INFO, "prof", "Connecting as %s", user);
xmpp_initialize();
jabber_conn.log = xmpp_get_file_logger();
@ -159,6 +161,7 @@ void
jabber_disconnect(void)
{
if (jabber_conn.conn_status == JABBER_CONNECTED) {
log_msg(PROF_LEVEL_INFO, "prof", "Closing connection");
xmpp_conn_release(jabber_conn.conn);
xmpp_ctx_free(jabber_conn.ctx);
xmpp_shutdown();
@ -343,6 +346,7 @@ _jabber_conn_handler(xmpp_conn_t * const conn,
title_bar_set_status(PRESENCE_ONLINE);
cons_show(line);
log_msg(PROF_LEVEL_INFO, "prof", line);
win_page_off();
status_bar_print_message(jid);
status_bar_refresh();
@ -366,9 +370,11 @@ _jabber_conn_handler(xmpp_conn_t * const conn,
else {
if (jabber_conn.conn_status == JABBER_CONNECTED) {
cons_bad_show("Lost connection.");
log_msg(PROF_LEVEL_INFO, "prof", "Lost connection");
win_disconnected();
} else {
cons_bad_show("Login failed.");
log_msg(PROF_LEVEL_INFO, "prof", "Login failed");
}
win_page_off();
log_msg(PROF_LEVEL_INFO, CONN, "disconnected");

View File

@ -81,4 +81,3 @@ log_close(void)
g_time_zone_unref(tz);
fclose(logp);
}

View File

@ -80,6 +80,7 @@ static void _save_prefs(void);
void
prefs_load(void)
{
log_msg(PROF_LEVEL_INFO, "prof", "Loading preferences");
ac = p_autocomplete_new();
prefs_loc = g_string_new(getenv("HOME"));
g_string_append(prefs_loc, "/.profanity/config");
@ -109,6 +110,7 @@ prefs_load(void)
void
prefs_close(void)
{
log_msg(PROF_LEVEL_INFO, "prof", "Closing down preferences");
g_key_file_free(prefs);
}

View File

@ -26,6 +26,7 @@
#include <glib.h>
#include "config.h"
#include "profanity.h"
#include "log.h"
#include "chat_log.h"
@ -36,7 +37,7 @@
#include "contact_list.h"
#include "tinyurl.h"
static log_level_t get_log_level(char *log_level);
static log_level_t _get_log_level(char *log_level);
static void _profanity_shutdown(void);
void
@ -44,6 +45,8 @@ profanity_run(void)
{
gboolean cmd_result = TRUE;
log_msg(PROF_LEVEL_INFO, "prof", "Starting main event loop");
inp_non_block();
while(cmd_result == TRUE) {
int ch = ERR;
@ -73,9 +76,9 @@ void
profanity_init(const int disable_tls, char *log_level)
{
create_config_directory();
log_level_t prof_log_level = get_log_level(log_level);
log_level_t prof_log_level = _get_log_level(log_level);
log_init(prof_log_level);
log_msg(PROF_LEVEL_INFO, PROF, "Starting Profanity...");
log_msg(PROF_LEVEL_INFO, PROF, "Starting Profanity (%s)...", PACKAGE_VERSION);
chat_log_init();
prefs_load();
gui_init();
@ -91,12 +94,14 @@ _profanity_shutdown(void)
log_msg(PROF_LEVEL_INFO, PROF, "Profanity is shutting down.");
jabber_disconnect();
gui_close();
log_close();
chat_log_close();
prefs_close();
log_msg(PROF_LEVEL_INFO, "prof", "Shutdown complete");
log_close();
}
static log_level_t get_log_level(char *log_level)
static log_level_t
_get_log_level(char *log_level)
{
if (strcmp(log_level, "DEBUG") == 0) {
return PROF_LEVEL_DEBUG;

View File

@ -36,6 +36,7 @@
#include "command.h"
#include "preferences.h"
#include "tinyurl.h"
#include "log.h"
#define CONS_WIN_TITLE "_cons"
#define PAD_SIZE 200
@ -84,6 +85,7 @@ static void _win_notify_typing(char * short_from);
void
gui_init(void)
{
log_msg(PROF_LEVEL_INFO, "prof", "Initialising UI");
initscr();
cbreak();
keypad(stdscr, TRUE);
@ -135,12 +137,14 @@ gui_refresh(void)
void
gui_close(void)
{
log_msg(PROF_LEVEL_INFO, "prof", "Closing UI");
endwin();
}
void
gui_resize(const int ch, const char * const input, const int size)
{
log_msg(PROF_LEVEL_INFO, "prof", "Resizing UI");
title_bar_resize();
status_bar_resize();
_win_resize_all();