From fe633d3363df250248876c337d49c78f4541a8ae Mon Sep 17 00:00:00 2001 From: Tony Olagbaiye Date: Sat, 3 Jul 2021 21:58:55 +0100 Subject: [PATCH] badge --- README.org | 1 + account.c | 1 + account.h | 3 +++ command.h | 3 +++ config.c | 16 ++++++++++++++++ connection.c | 5 +++++ 6 files changed, 29 insertions(+) diff --git a/README.org b/README.org index 7e85286..797c19d 100644 --- a/README.org +++ b/README.org @@ -16,6 +16,7 @@ [[https://github.com/bqv/weechat-xmpp/issues?q=is:issue+is:closed][file:https://img.shields.io/github/issues-closed/bqv/weechat-xmpp.svg]] [[https://github.com/bqv/weechat-xmpp/blob/master/LICENSE][file:https://img.shields.io/github/license/bqv/weechat-xmpp.svg]] [[https://github.com/bqv/weechat-extras/][file:https://img.shields.io/badge/weechat--extras-xmpp-blue.svg]] +[[https://github.com/bqv/weechat-extras/][file:https://inverse.chat/badge.svg?room=weechat@conference.hmm.st]] | Status: | XMPP for power users and digital masochists | | Location: | [[http://github.com/bqv/weechat-xmpp]] | diff --git a/account.c b/account.c index 2535275..b0a14d8 100644 --- a/account.c +++ b/account.c @@ -30,6 +30,7 @@ char *account_options[ACCOUNT_NUM_OPTIONS][2] = { "autoconnect", "" }, { "resource", "" }, { "status", "probably about to segfault" }, + { "autojoin", "" }, }; struct t_account *account__search(const char *name) diff --git a/account.h b/account.h index 202c5fa..2f56de8 100644 --- a/account.h +++ b/account.h @@ -17,6 +17,7 @@ enum t_account_option ACCOUNT_OPTION_AUTOCONNECT, ACCOUNT_OPTION_RESOURCE, ACCOUNT_OPTION_STATUS, + ACCOUNT_OPTION_AUTOJOIN, ACCOUNT_NUM_OPTIONS, }; @@ -50,6 +51,8 @@ enum t_account_option weechat_config_string(account->options[ACCOUNT_OPTION_RESOURCE]) #define account_status(account) \ weechat_config_string(account->options[ACCOUNT_OPTION_STATUS]) +#define account_autojoin(account) \ + weechat_config_string(account->options[ACCOUNT_OPTION_AUTOJOIN]) struct t_account { diff --git a/command.h b/command.h index f8af048..fb87318 100644 --- a/command.h +++ b/command.h @@ -5,6 +5,9 @@ #ifndef _WEECHAT_XMPP_COMMAND_H_ #define _WEECHAT_XMPP_COMMAND_H_ +int command__enter(const void *pointer, void *data, + struct t_gui_buffer *buffer, int argc, + char **argv, char **argv_eol); void command__init(); #endif /*WEECHAT_XMPP_COMMAND_H*/ diff --git a/config.c b/config.c index b7e6c66..09fa0c6 100644 --- a/config.c +++ b/config.c @@ -186,6 +186,22 @@ config__account_new_option (struct t_config_file *config_file, callback_change_data, NULL, NULL, NULL); break; + case ACCOUNT_OPTION_AUTOJOIN: + new_option = weechat_config_new_option ( + config_file, section, + option_name, "string", + N_("XMPP Channel Autojoin"), + NULL, 0, 0, + default_value, value, + null_value_allowed, + callback_check_value, + callback_check_value_pointer, + callback_check_value_data, + callback_change, + callback_change_pointer, + callback_change_data, + NULL, NULL, NULL); + break; case ACCOUNT_NUM_OPTIONS: break; } diff --git a/connection.c b/connection.c index 5676ec6..899c36b 100644 --- a/connection.c +++ b/connection.c @@ -225,6 +225,11 @@ void connection__handler(xmpp_conn_t *conn, xmpp_conn_event_t status, xmpp_send(conn, pres); xmpp_stanza_release(pres); + + command__enter(NULL, NULL, account->buffer, 2, argv, argv_eol); + + xmpp_send(conn, pres); + xmpp_stanza_release(pres); } else { //weechat_printf(account->buffer, "DEBUG: disconnected"); //xmpp_stop(account->context);