1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Command changes

Changed names of who/ros
Coloured output for who
Who only works online
This commit is contained in:
James Booth 2012-03-08 23:14:35 +00:00
parent cfc2307808
commit db259f64a0
2 changed files with 20 additions and 10 deletions

View File

@ -34,7 +34,7 @@ static int _handle_command(char *command, char *inp);
static int _cmd_quit(void); static int _cmd_quit(void);
static int _cmd_help(void); static int _cmd_help(void);
static int _cmd_who(void); static int _cmd_who(void);
static int _cmd_pres(void); static int _cmd_ros(void);
static int _cmd_connect(char *inp); static int _cmd_connect(char *inp);
static int _cmd_msg(char *inp); static int _cmd_msg(char *inp);
static int _cmd_close(char *inp); static int _cmd_close(char *inp);
@ -72,10 +72,10 @@ static int _handle_command(char *command, char *inp)
result = _cmd_quit(); result = _cmd_quit();
} else if (strcmp(command, "/help") == 0) { } else if (strcmp(command, "/help") == 0) {
result = _cmd_help(); result = _cmd_help();
} else if (strcmp(command, "/ros") == 0) {
result = _cmd_ros();
} else if (strcmp(command, "/who") == 0) { } else if (strcmp(command, "/who") == 0) {
result = _cmd_who(); result = _cmd_who();
} else if (strcmp(command, "/pres") == 0) {
result = _cmd_pres();
} else if (strcmp(command, "/msg") == 0) { } else if (strcmp(command, "/msg") == 0) {
result = _cmd_msg(inp); result = _cmd_msg(inp);
} else if (strcmp(command, "/close") == 0) { } else if (strcmp(command, "/close") == 0) {
@ -134,7 +134,7 @@ static int _cmd_help(void)
return TRUE; return TRUE;
} }
static int _cmd_who(void) static int _cmd_ros(void)
{ {
jabber_status_t conn_status = jabber_connection_status(); jabber_status_t conn_status = jabber_connection_status();
@ -146,10 +146,16 @@ static int _cmd_who(void)
return TRUE; return TRUE;
} }
static int _cmd_pres(void) static int _cmd_who(void)
{ {
struct contact_list *list = get_contact_list(); jabber_status_t conn_status = jabber_connection_status();
cons_show_online_contacts(list);
if (conn_status != JABBER_CONNECTED) {
cons_not_connected();
} else {
struct contact_list *list = get_contact_list();
cons_show_online_contacts(list);
}
return TRUE; return TRUE;
} }

View File

@ -213,9 +213,10 @@ void cons_help(void)
cons_show("/help : This help."); cons_show("/help : This help.");
cons_show("/connect user@host : Login to jabber."); cons_show("/connect user@host : Login to jabber.");
cons_show("/who : Get roster.");
cons_show("/close : Close a chat window.");
cons_show("/msg user@host mesg : Send mesg to user."); cons_show("/msg user@host mesg : Send mesg to user.");
cons_show("/who : Find out who is online.");
cons_show("/ros : List all contacts.");
cons_show("/close : Close a chat window.");
cons_show("/quit : Quit Profanity."); cons_show("/quit : Quit Profanity.");
cons_show("F1 : This console window."); cons_show("F1 : This console window.");
cons_show("F2-10 : Chat windows."); cons_show("F2-10 : Chat windows.");
@ -235,7 +236,10 @@ void cons_show_online_contacts(struct contact_list *list)
int i; int i;
for (i = 0; i < list->size; i++) { for (i = 0; i < list->size; i++) {
char *contact = list->contacts[i]; char *contact = list->contacts[i];
cons_show(contact); _win_show_time(_cons_win);
wattron(_cons_win, COLOR_PAIR(2));
wprintw(_cons_win, "%s\n", contact);
wattroff(_cons_win, COLOR_PAIR(2));
} }
} }