From 904a5a81cfcc19c7029f0a961cfb97f7d1a2fe9f Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 15 Oct 2015 01:19:24 +0100 Subject: [PATCH] Add ability to script commands after connect --- Makefile.am | 4 +- src/command/command.c | 10 ++- src/command/commands.c | 7 ++ src/config/account.c | 9 ++- src/config/account.h | 3 +- src/config/accounts.c | 28 ++++++- src/config/accounts.h | 2 + src/config/scripts.c | 106 +++++++++++++++++++++++++ src/config/scripts.h | 38 +++++++++ src/event/server_events.c | 6 ++ src/profanity.c | 2 + src/ui/console.c | 4 +- src/xmpp/connection.c | 4 +- tests/unittests/config/stub_accounts.c | 2 + tests/unittests/test_cmd_account.c | 14 ++-- tests/unittests/test_cmd_connect.c | 6 +- tests/unittests/test_cmd_join.c | 8 +- tests/unittests/test_cmd_otr.c | 2 +- 18 files changed, 230 insertions(+), 25 deletions(-) create mode 100644 src/config/scripts.c create mode 100644 src/config/scripts.h diff --git a/Makefile.am b/Makefile.am index 3e37fe7d..4466e851 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,8 @@ core_sources = \ src/config/tlscerts.c src/config/tlscerts.h \ src/config/account.c src/config/account.h \ src/config/preferences.c src/config/preferences.h \ - src/config/theme.c src/config/theme.h + src/config/theme.c src/config/theme.h \ + src/config/scripts.c src/config/scripts.h unittest_sources = \ src/contact.c src/contact.h src/common.c \ @@ -61,6 +62,7 @@ unittest_sources = \ src/config/tlscerts.c src/config/tlscerts.h \ src/config/preferences.c src/config/preferences.h \ src/config/theme.c src/config/theme.h \ + src/config/scripts.c src/config/scripts.h \ src/window_list.c src/window_list.h \ src/event/server_events.c src/event/server_events.h \ src/event/client_events.c src/event/client_events.h \ diff --git a/src/command/command.c b/src/command/command.c index 6309ce93..cd3a8c03 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -1488,12 +1488,14 @@ static struct cmd_t command_defs[] = "/account set nick ", "/account set otr ", "/account set pgpkeyid ", + "/account set startscript