Skip to content

Commit

Permalink
Improved log command, added status component
Browse files Browse the repository at this point in the history
git-svn-id: http://sanoi.webfactional.com/trunk@98 79def182-f41f-0410-b320-e94a04284523
  • Loading branch information
mario committed Aug 30, 2007
1 parent d072311 commit 7ac1cd0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ init_all()
c = g_key_file_get_string(keyfile_get(), "core", "logging", &err);
if (err != NULL) {
if (err->code == G_KEY_FILE_ERROR_INVALID_VALUE)
g_warning("cannot turn logging on: %s", err->message);
g_warning("cannot turn logging to: %s", err->message);

g_clear_error(&err);
} else {
Expand Down
11 changes: 3 additions & 8 deletions src/ui-command.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,9 @@ command_func_quit(gint argc, gchar ** argv)
gboolean
command_func_log(gint argc, gchar ** argv)
{
if (argc > 2)
g_warning("usage: /log [on|off]");
if (argc == 1) {
if (get_logging() == TRUE)
g_message("logging is on");
else
g_message("logging is off");
}
if (argc != 2)
g_warning("usage: /log [on|off|status]");

if (argc == 2)
set_logging(argv[1]);
return 0;
Expand Down
16 changes: 13 additions & 3 deletions src/ui-logfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,22 @@ write_to_log(const gchar * account, const gchar * contact, const gchar * author,
void
set_logging(gchar * c)
{
if (g_ascii_strcasecmp(c, "on") == 0)
if (g_ascii_strcasecmp(c, "on") == 0){
logging = TRUE;
else if (g_ascii_strcasecmp(c, "off") == 0)
g_message("Logging is on!");
}
else if (g_ascii_strcasecmp(c, "off") == 0){
logging = FALSE;
g_message("Logging is off!");
}
else if (g_ascii_strcasecmp(c,"status") == 0){
if (logging == TRUE)
g_message("Logging is on!");
else
g_message("Logging is off!");
}
else
logging = FALSE;
g_warning("usage: /log [on|off|status]");
}

gboolean
Expand Down

0 comments on commit 7ac1cd0

Please sign in to comment.