Show tinyurl errors and usage in chat windows

This commit is contained in:
James Booth
2012-07-29 21:47:30 +01:00
parent fe12352b57
commit 2375b7ae52
3 changed files with 32 additions and 2 deletions

View File

@@ -290,6 +290,9 @@ _cmd_tiny(const char * const inp)
GString *error = g_string_new("/tiny, badly formed URL: "); GString *error = g_string_new("/tiny, badly formed URL: ");
g_string_append(error, url); g_string_append(error, url);
cons_bad_show(error->str); cons_bad_show(error->str);
if (win_in_chat()) {
win_bad_show(error->str);
}
g_string_free(error, TRUE); g_string_free(error, TRUE);
free(url); free(url);
} else if (win_in_chat()) { } else if (win_in_chat()) {
@@ -305,7 +308,10 @@ _cmd_tiny(const char * const inp)
free(url); free(url);
} }
} else { } else {
cons_show("usage: /tiny url"); cons_show("Usage: /tiny url");
if (win_in_chat()) {
win_show("Usage: /tiny url");
}
} }
return TRUE; return TRUE;

View File

@@ -70,6 +70,8 @@ void win_contact_online(const char * const from, const char * const show,
void win_contact_offline(const char * const from, const char * const show, void win_contact_offline(const char * const from, const char * const show,
const char * const status); const char * const status);
void win_disconnected(void); void win_disconnected(void);
void win_show(const char * const msg);
void win_bad_show(const char * const msg);
// console window actions // console window actions
void cons_help(void); void cons_help(void);

View File

@@ -261,6 +261,28 @@ win_show_outgoing_msg(const char * const from, const char * const to,
} }
} }
void
win_show(const char * const msg)
{
WINDOW *win = _wins[_curr_prof_win].win;
_win_show_time(win);
wprintw(win, "%s\n", msg);
dirty = TRUE;
}
void
win_bad_show(const char * const msg)
{
WINDOW *win = _wins[_curr_prof_win].win;
_win_show_time(win);
wattron(win, COLOR_PAIR(6));
wprintw(win, "%s\n", msg);
wattroff(win, COLOR_PAIR(6));
dirty = TRUE;
}
void void
win_contact_online(const char * const from, const char * const show, win_contact_online(const char * const from, const char * const show,
const char * const status) const char * const status)
@@ -362,7 +384,7 @@ cons_help(void)
cons_show("/prefs : Show current UI preferences."); cons_show("/prefs : Show current UI preferences.");
cons_show("/connect user@host : Login to jabber."); cons_show("/connect user@host : Login to jabber.");
cons_show("/msg user@host mesg : Send mesg to user."); cons_show("/msg user@host mesg : Send mesg to user.");
cons_show("/tiny url : Send url as tinyurl"); cons_show("/tiny url : Send url as tinyurl in current chat.");
cons_show("/close : Close a chat window."); cons_show("/close : Close a chat window.");
cons_show("/who : Find out who is online."); cons_show("/who : Find out who is online.");
cons_show("/ros : List all contacts."); cons_show("/ros : List all contacts.");