about summary refs log tree commit diff stats
path: root/tests
Commit message (Expand)AuthorAgeFilesLines
...
* Remove win_vprintln_chJames Booth2016-10-151-1/+0
* Remove ui_current_error_lineJames Booth2016-10-151-2/+0
* Remove ui_win_error_lineJames Booth2016-10-151-1/+0
* Rename win_get_string -> win_to_stringJames Booth2016-10-151-1/+1
* Add ch arg to win_printf_lineJames Booth2016-10-151-1/+1
* Add win_printf_lineJames Booth2016-10-121-0/+2
* Remove win_print, use win_printf insteadJames Booth2016-10-111-1/+0
* Rename win_vprint -> win_printfJames Booth2016-10-111-1/+1
* Use current room for /bookmark add and /bookmark removeJames Booth2016-10-051-1/+2
* Tests: disable occupants panel in functional testsJames Booth2016-09-262-2/+2
* Tests: longer timeout for failing functional test on travisJames Booth2016-09-261-0/+2
* Merge branch 'master' into win-orderJames Booth2016-09-252-1/+11
|\
| * Fix assertion errors in unit testsJames Booth2016-09-252-1/+11
* | Allow vertical positioning of all windowsJames Booth2016-09-231-1/+1
* | Rename /titlebar -> /wintitleJames Booth2016-09-221-1/+1
|/
* Add /inputwin top|bottom commandJames Booth2016-09-191-0/+1
* Rename Bookmark->jid to Bookmark->barejidJames Booth2016-08-281-7/+7
* log_info on private carbonsJames Booth2016-08-283-0/+32
* Use hash table for bookmarksJames Booth2016-08-212-3/+1
* Send receipt request only when receiver supports featureJames Booth2016-08-186-6/+51
* Only include receipts feature in disco responses when enabledJames Booth2016-08-181-0/+2
* Use hashtables for plugin disco featuresJames Booth2016-08-173-0/+147
* Rename Capabilties -> EntityCapabilitiesJames Booth2016-08-131-2/+2
* Move all filepath handling to files.cJames Booth2016-07-241-18/+2
* Move xgd functionsJames Booth2016-07-241-2/+2
* Move window functions to window_list.cJames Booth2016-07-243-315/+0
* Move autoaway checkJames Booth2016-07-241-0/+2
* Moved window_list.cJames Booth2016-07-241-1/+1
* Moved roster_list.cJames Booth2016-07-244-4/+4
* Moved muc.cJames Booth2016-07-244-4/+4
* Moved jid.cJames Booth2016-07-241-2/+2
* Moved contact.cJames Booth2016-07-243-3/+3
* Moved chat_session.cJames Booth2016-07-245-6/+6
* Move event timeout to connection moduleJames Booth2016-07-241-1/+1
* Remove plugin window on /closeJames Booth2016-07-121-1/+1
* Unit test for callback_add_command()James Booth2016-07-041-7/+32
* Free plugins commands on quitJames Booth2016-07-044-1/+39
* Revert "WIP - Unload plugin commands"James Booth2016-06-301-1/+1
* WIP - Unload plugin commandsJames Booth2016-06-291-1/+1
* Move /statuses options to /presence commandJames Booth2016-05-314-61/+61
* Option to bookmark room invitesJames Booth2016-05-231-0/+5
* Rename command sourcesJames Booth2016-05-2212-15/+15
* Add cmd_autocomplete.cJames Booth2016-05-201-1/+2
* Remove JABBER_STARTED, JABBER_UNDEFINED connection statesJames Booth2016-05-1012-85/+0
* Move disco info struct to connectionJames Booth2016-05-071-1/+1
* Remove redundant tls secured functionJames Booth2016-05-061-1/+1
* Move send stanza functionJames Booth2016-05-061-1/+1
* Move conn is secure functionJames Booth2016-05-061-1/+1
* Move tls peer cert functionJames Booth2016-05-061-1/+1
* Move uuid functionsJames Booth2016-05-061-2/+2
_cpy[strlen(inp) + 1]; strcpy(inp_cpy, inp); char *command = strtok(inp_cpy, " "); result = _handle_command(command, inp); } else { result = _cmd_default(inp); } inp_clear(); return result; } static int _handle_command(char *command, char *inp) { int result = FALSE; if (strcmp(command, "/quit") == 0) { result = _cmd_quit(); } else if (strcmp(command, "/help") == 0) { result = _cmd_help(); } else if (strcmp(command, "/who") == 0) { result = _cmd_who(); } else if (strcmp(command, "/msg") == 0) { result = _cmd_msg(inp); } else if (strcmp(command, "/close") == 0) { result = _cmd_close(inp); } else if (strcmp(command, "/connect") == 0) { result = _cmd_connect(inp); } else { result = _cmd_default(inp); } return result; } static int _cmd_connect(char *inp) { int result = FALSE; jabber_status_t conn_status = jabber_connection_status(); if ((conn_status != JABBER_DISCONNECTED) && (conn_status != JABBER_STARTED)) { cons_not_disconnected(); result = TRUE; } else if (strlen(inp) < 10) { cons_bad_connect(); result = TRUE; } else { char *user; user = strndup(inp+9, strlen(inp)-9); status_bar_get_password(); status_bar_refresh(); char passwd[21]; inp_block(); inp_get_password(passwd); inp_non_block(); conn_status = jabber_connect(user, passwd); if (conn_status == JABBER_CONNECTING) cons_show("Connecting..."); if (conn_status == JABBER_DISCONNECTED) cons_bad_show("Connection to server failed."); result = TRUE; } return result; } static int _cmd_quit(void) { return FALSE; } static int _cmd_help(void) { cons_help(); return TRUE; } static int _cmd_who(void) { jabber_status_t conn_status = jabber_connection_status(); if (conn_status != JABBER_CONNECTED) cons_not_connected(); else jabber_roster_request(); return TRUE; } static int _cmd_msg(char *inp) { char *usr = NULL; char *msg = NULL; jabber_status_t conn_status = jabber_connection_status(); if (conn_status != JABBER_CONNECTED) { cons_not_connected(); } else { // copy input char inp_cpy[strlen(inp) + 1]; strcpy(inp_cpy, inp); // get user strtok(inp_cpy, " "); usr = strtok(NULL, " "); if ((usr != NULL) && (strlen(inp) > (5 + strlen(usr) + 1))) { msg = strndup(inp+5+strlen(usr)+1, strlen(inp)-(5+strlen(usr)+1)); if (msg != NULL) { jabber_send(msg, usr); win_show_outgoing_msg("me", usr, msg); } else { cons_bad_message(); } } else { cons_bad_message(); } } return TRUE; } static int _cmd_close(char *inp) { if (!win_close_win()) cons_bad_command(inp); return TRUE; } static int _cmd_default(char *inp) { if (win_in_chat()) { char *recipient = win_get_recipient(); jabber_send(inp, recipient); win_show_outgoing_msg("me", recipient, inp); free(recipient); } else { cons_bad_command(inp); } return TRUE; }