diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/command/command.c | 20 | ||||
-rw-r--r-- | src/command/commands.c | 25 | ||||
-rw-r--r-- | src/config/accounts.c | 20 | ||||
-rw-r--r-- | src/config/accounts.h | 2 | ||||
-rw-r--r-- | src/tools/p_sha1.c | 18 | ||||
-rw-r--r-- | src/ui/core.c | 13 | ||||
-rw-r--r-- | src/xmpp/iq.c | 4 | ||||
-rw-r--r-- | src/xmpp/xmpp.h | 2 |
8 files changed, 76 insertions, 28 deletions
diff --git a/src/command/command.c b/src/command/command.c index 5726b49f..178e90b1 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -207,11 +207,14 @@ static struct cmd_t command_defs[] = { "/info", cmd_info, parse_args, 0, 1, NULL, - { "/info [contact|nick]", "Show basic information about a contact, or room member.", + { "/info [contact|nick]", "Show basic information about a contact, room, or room member.", { "/info [contact|nick]", "--------------------", - "Show information including current subscription status and summary information for each connected resource.", + "Show basic information about a contact, room, or room member.", + "If in the console, a contact must be specified.", "If in a chat window the parameter is not required, the current recipient will be used.", + "If in a chat room, providing no arguments will display information about the room.", + "If in a chat room, supplying a nick will show information about the occupant.", "", "Example : /info mybuddy@chat.server.org", "Example : /info kai", @@ -381,9 +384,9 @@ static struct cmd_t command_defs[] = { "/form", cmd_form, parse_args, 1, 2, NULL, - { "/form show|submit|cancel|help", "Form handling.", - { "/form show|submit|cancel|help", - "-----------------------------", + { "/form show|submit|cancel|help [tag]", "Form handling.", + { "/form show|submit|cancel|help [tag]", + "-----------------------------------", "show - Show the current form.", "submit - Submit the current form.", "cancel - Cancel changes to the current form.", @@ -551,10 +554,7 @@ static struct cmd_t command_defs[] = { "/privileges on|off", "Show occupant privileges in chat rooms.", { "/privileges on|off", "---------------------------", - "If enabled:", - "The room roster will be broken down my role.", - "An occupants role and affiliation will be shown when they join a room.", - "Changes to occupant privileges will be shown in the chat room.", + "If enabled the room roster will be broken down my role, and role information will be showin in the room.", NULL } } }, { "/beep", @@ -1194,6 +1194,8 @@ cmd_init(void) account_clear_ac = autocomplete_new(); autocomplete_add(account_clear_ac, "password"); + autocomplete_add(account_clear_ac, "server"); + autocomplete_add(account_clear_ac, "port"); autocomplete_add(account_clear_ac, "otr"); close_ac = autocomplete_new(); diff --git a/src/command/commands.c b/src/command/commands.c index 40640485..0dc26fff 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -362,6 +362,14 @@ cmd_account(gchar **args, struct cmd_help_t help) accounts_clear_password(account_name); cons_show("Removed password for account %s", account_name); cons_show(""); + } else if (strcmp(property, "server") == 0) { + accounts_clear_server(account_name); + cons_show("Removed server for account %s", account_name); + cons_show(""); + } else if (strcmp(property, "port") == 0) { + accounts_clear_port(account_name); + cons_show("Removed port for account %s", account_name); + cons_show(""); } else if (strcmp(property, "otr") == 0) { accounts_clear_otr(account_name); cons_show("OTR policy removed for account %s", account_name); @@ -1827,6 +1835,7 @@ cmd_form_field(char *tag, gchar **args) } else { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); } break; @@ -1837,6 +1846,7 @@ cmd_form_field(char *tag, gchar **args) if (value == NULL) { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); } else { form_set_value(form, tag, value); ui_current_print_line("Field updated..."); @@ -1848,6 +1858,7 @@ cmd_form_field(char *tag, gchar **args) if ((value == NULL) || !form_field_contains_option(form, tag, value)) { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); } else { form_set_value(form, tag, value); ui_current_print_line("Field updated..."); @@ -1863,11 +1874,13 @@ cmd_form_field(char *tag, gchar **args) if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); break; } if (value == NULL) { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); break; } if (g_strcmp0(cmd, "add") == 0) { @@ -1880,11 +1893,13 @@ cmd_form_field(char *tag, gchar **args) if (!g_str_has_prefix(value, "val")) { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); break; } if (strlen(value) < 4) { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); break; } @@ -1892,6 +1907,7 @@ cmd_form_field(char *tag, gchar **args) if ((index < 1) || (index > form_get_value_count(form, tag))) { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); break; } @@ -1912,11 +1928,13 @@ cmd_form_field(char *tag, gchar **args) if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); break; } if (value == NULL) { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); break; } if (g_strcmp0(args[0], "add") == 0) { @@ -1932,6 +1950,7 @@ cmd_form_field(char *tag, gchar **args) } else { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); } break; } @@ -1948,6 +1967,7 @@ cmd_form_field(char *tag, gchar **args) } else { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); } } break; @@ -1959,11 +1979,13 @@ cmd_form_field(char *tag, gchar **args) if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); break; } if (value == NULL) { ui_current_print_line("Invalid command, usage:"); ui_show_form_field_help(current, form, tag); + ui_current_print_line(""); break; } if (g_strcmp0(args[0], "add") == 0) { @@ -2369,13 +2391,12 @@ cmd_room(gchar **args, struct cmd_help_t help) iq_confirm_instant_room(room); muc_set_requires_config(room, FALSE); win_save_print(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Room unlocked."); - cons_show("Room unlocked: %s (%d)", room, ui_index); return TRUE; } } if (g_strcmp0(args[0], "destroy") == 0) { - iq_destroy_instant_room(room); + iq_destroy_room(room); return TRUE; } diff --git a/src/config/accounts.c b/src/config/accounts.c index b5e27127..175cac5f 100644 --- a/src/config/accounts.c +++ b/src/config/accounts.c @@ -441,6 +441,24 @@ _accounts_clear_password(const char * const account_name) } static void +_accounts_clear_server(const char * const account_name) +{ + if (accounts_account_exists(account_name)) { + g_key_file_remove_key(accounts, account_name, "server", NULL); + _save_accounts(); + } +} + +static void +_accounts_clear_port(const char * const account_name) +{ + if (accounts_account_exists(account_name)) { + g_key_file_remove_key(accounts, account_name, "port", NULL); + _save_accounts(); + } +} + +static void _accounts_clear_otr(const char * const account_name) { if (accounts_account_exists(account_name)) { @@ -869,6 +887,8 @@ accounts_init_module(void) accounts_set_priority_all = _accounts_set_priority_all; accounts_get_priority_for_presence_type = _accounts_get_priority_for_presence_type; accounts_clear_password = _accounts_clear_password; + accounts_clear_server = _accounts_clear_server; + accounts_clear_port = _accounts_clear_port; accounts_clear_otr = _accounts_clear_otr; accounts_add_otr_policy = _accounts_add_otr_policy; } diff --git a/src/config/accounts.h b/src/config/accounts.h index 299fdf0b..97c125eb 100644 --- a/src/config/accounts.h +++ b/src/config/accounts.h @@ -78,6 +78,8 @@ void (*accounts_set_priority_all)(const char * const account_name, const gint va gint (*accounts_get_priority_for_presence_type)(const char * const account_name, resource_presence_t presence_type); void (*accounts_clear_password)(const char * const account_name); +void (*accounts_clear_server)(const char * const account_name); +void (*accounts_clear_port)(const char * const account_name); void (*accounts_clear_otr)(const char * const account_name); void (*accounts_add_otr_policy)(const char * const account_name, const char * const contact_jid, const char * const policy); diff --git a/src/tools/p_sha1.c b/src/tools/p_sha1.c index 7c059c97..1936b89c 100644 --- a/src/tools/p_sha1.c +++ b/src/tools/p_sha1.c @@ -101,19 +101,14 @@ A million repetitions of "a" #include "p_sha1.h" +static uint32_t host_to_be(uint32_t i); void P_SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]); #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) /* blk0() and blk() perform the initial expand. */ /* I got the idea of expanding during the round function from SSLeay */ -/* FIXME: can we do this in an endian-proof way? */ -#ifdef WORDS_BIGENDIAN -#define blk0(i) block->l[i] -#else -#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ - |(rol(block->l[i],8)&0x00FF00FF)) -#endif +#define blk0(i) (block->l[i] = host_to_be(block->l[i])) #define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ ^block->l[(i+2)&15]^block->l[i&15],1)) @@ -138,6 +133,15 @@ void SHAPrintContext(P_P_SHA1_CTX *context, char *msg){ } #endif /* VERBOSE */ +static uint32_t host_to_be(uint32_t i) +{ + static const union { + unsigned u; + unsigned char c; + } check = {1}; + return check.c ? (rol(i,24)&0xFF00FF00)|(rol(i,8)&0x00FF00FF) : i; +} + /* Hash a single 512-bit block. This is the core of the algorithm. */ void P_SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]) { diff --git a/src/ui/core.c b/src/ui/core.c index c6971aca..f50ad982 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -1824,7 +1824,7 @@ _ui_room_requires_config(const char * const room_jid) win_save_print(window, '-', NULL, 0, 0, "", ""); win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "", - "Room requires configuration."); + "Room locked, requires configuration."); win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Use '/room accept' to accept the defaults"); win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "", @@ -1841,8 +1841,6 @@ _ui_room_requires_config(const char * const room_jid) } else { status_bar_new(num); } - - cons_show("Room created, locked: %s (%d)", room_jid, ui_index); } } @@ -2558,7 +2556,8 @@ static void _ui_show_form(ProfWin *window, const char * const room, DataForm *form) { if (form->title != NULL) { - win_save_print(window, '-', NULL, 0, 0, "", form->title); + win_save_print(window, '-', NULL, NO_EOL, 0, "", "Form title: "); + win_save_print(window, '-', NULL, NO_DATE, 0, "", form->title); } else { win_save_vprint(window, '-', NULL, 0, 0, "", "Configuration for room %s.", room); } @@ -2609,9 +2608,9 @@ _ui_handle_room_configuration(const char * const room, DataForm *form) ui_show_form(window, room, form); win_save_print(window, '-', NULL, 0, 0, "", ""); - win_save_print(window, '-', NULL, 0, COLOUR_ROOMINFO, "", "Use '/form submit' to save changes."); - win_save_print(window, '-', NULL, 0, COLOUR_ROOMINFO, "", "Use '/form cancel' to cancel changes."); - win_save_print(window, '-', NULL, 0, COLOUR_ROOMINFO, "", "See '/form help' for more information."); + win_save_print(window, '-', NULL, 0, 0, "", "Use '/form submit' to save changes."); + win_save_print(window, '-', NULL, 0, 0, "", "Use '/form cancel' to cancel changes."); + win_save_print(window, '-', NULL, 0, 0, "", "See '/form help' for more information."); win_save_print(window, '-', NULL, 0, 0, "", ""); } diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index b8530b7c..a33f2291 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -234,7 +234,7 @@ _iq_confirm_instant_room(const char * const room_jid) } static void -_iq_destroy_instant_room(const char * const room_jid) +_iq_destroy_room(const char * const room_jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -1241,7 +1241,7 @@ iq_init_module(void) iq_send_software_version = _iq_send_software_version; iq_set_autoping = _iq_set_autoping; iq_confirm_instant_room = _iq_confirm_instant_room; - iq_destroy_instant_room = _iq_destroy_instant_room; + iq_destroy_room = _iq_destroy_room; iq_send_ping = _iq_send_ping; iq_request_room_config_form = _iq_request_room_config_form; iq_room_config_cancel = _iq_room_config_cancel; diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index 1d391cbc..15f0a7a5 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -185,7 +185,7 @@ void (*iq_disco_info_request)(gchar *jid); void (*iq_disco_items_request)(gchar *jid); void (*iq_set_autoping)(int seconds); void (*iq_confirm_instant_room)(const char * const room_jid); -void (*iq_destroy_instant_room)(const char * const room_jid); +void (*iq_destroy_room)(const char * const room_jid); void (*iq_request_room_config_form)(const char * const room_jid); void (*iq_submit_room_config)(const char * const room, DataForm *form); void (*iq_room_config_cancel)(const char * const room_jid); |