1
0
Fork 0

Format new register code correctly

This commit is contained in:
Michael Vetter 2021-10-13 21:32:44 +02:00
parent aedef61c91
commit 46c8245af9
15 changed files with 36 additions and 45 deletions

View File

@ -60,6 +60,6 @@ scan-view ...
### Finding typos
We include a `.codespellrc` configuration file for `codespell` in the root directory.
Before comitting it might make sense to run `codespell` to see if you made any typos.
Before committing it might make sense to run `codespell` to see if you made any typos.
You can run the `make spell` command for this.

View File

@ -3032,4 +3032,3 @@ command_mangen(void)
g_free(header);
g_list_free(cmds);
}

View File

@ -9599,4 +9599,3 @@ cmd_register(ProfWin* window, const char* const command, gchar** args)
log_info("we are leaving the registration process");
return TRUE;
}

View File

@ -250,4 +250,3 @@ gboolean cmd_silence(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_register(ProfWin* window, const char* const command, gchar** args);
#endif

View File

@ -262,4 +262,3 @@ cl_ev_send_priv_msg(ProfPrivateWin* privwin, const char* const msg, const char*
jid_destroy(jidp);
}
}

View File

@ -52,4 +52,3 @@ void cl_ev_send_muc_msg(ProfMucWin* mucwin, const char* const msg, const char* c
void cl_ev_send_priv_msg(ProfPrivateWin* privwin, const char* const msg, const char* const oob_url);
#endif

View File

@ -268,4 +268,3 @@ _shutdown(void)
ui_close();
prefs_close();
}

View File

@ -78,7 +78,8 @@ typedef struct prof_conn_t
GHashTable* requested_features;
} ProfConnection;
typedef struct {
typedef struct
{
const char* username;
const char* password;
} prof_reg_t;
@ -251,9 +252,10 @@ connection_connect(const char* const jid, const char* const passwd, const char*
return conn.conn_status;
}
static int iq_reg2_cb(xmpp_conn_t *xmpp_conn, xmpp_stanza_t *stanza, void *userdata)
static int
iq_reg2_cb(xmpp_conn_t* xmpp_conn, xmpp_stanza_t* stanza, void* userdata)
{
const char *type;
const char* type;
(void)userdata;
@ -280,12 +282,13 @@ quit:
return 0;
}
static int iq_reg_cb(xmpp_conn_t *xmpp_conn, xmpp_stanza_t *stanza, void *userdata)
static int
iq_reg_cb(xmpp_conn_t* xmpp_conn, xmpp_stanza_t* stanza, void* userdata)
{
prof_reg_t *reg = (prof_reg_t *)userdata;
xmpp_stanza_t *registered = NULL;
xmpp_stanza_t *query;
const char *type;
prof_reg_t* reg = (prof_reg_t*)userdata;
xmpp_stanza_t* registered = NULL;
xmpp_stanza_t* query;
const char* type;
type = xmpp_stanza_get_type(stanza);
if (!type || strcmp(type, "error") == 0) {
@ -320,7 +323,7 @@ quit:
}
static int
_register_handle_error(xmpp_conn_t *xmpp_conn, xmpp_stanza_t *stanza, void *userdata)
_register_handle_error(xmpp_conn_t* xmpp_conn, xmpp_stanza_t* stanza, void* userdata)
{
(void)stanza;
(void)userdata;
@ -333,11 +336,12 @@ _register_handle_error(xmpp_conn_t *xmpp_conn, xmpp_stanza_t *stanza, void *user
return 0;
}
static int _register_handle_proceedtls_default(xmpp_conn_t *xmpp_conn,
xmpp_stanza_t *stanza,
void *userdata)
static int
_register_handle_proceedtls_default(xmpp_conn_t* xmpp_conn,
xmpp_stanza_t* stanza,
void* userdata)
{
const char *name = xmpp_stanza_get_name(stanza);
const char* name = xmpp_stanza_get_name(stanza);
(void)userdata;
@ -355,7 +359,8 @@ static int _register_handle_proceedtls_default(xmpp_conn_t *xmpp_conn,
return 0;
}
static int _register_handle_missing_features(xmpp_conn_t *xmpp_conn, void *userdata)
static int
_register_handle_missing_features(xmpp_conn_t* xmpp_conn, void* userdata)
{
(void)userdata;
@ -366,13 +371,13 @@ static int _register_handle_missing_features(xmpp_conn_t *xmpp_conn, void *userd
}
static int
_register_handle_features(xmpp_conn_t *xmpp_conn, xmpp_stanza_t *stanza, void *userdata)
_register_handle_features(xmpp_conn_t* xmpp_conn, xmpp_stanza_t* stanza, void* userdata)
{
prof_reg_t *reg = (prof_reg_t *)userdata;
xmpp_ctx_t *ctx = conn.xmpp_ctx;
xmpp_stanza_t *child;
xmpp_stanza_t *iq;
char *domain;
prof_reg_t* reg = (prof_reg_t*)userdata;
xmpp_ctx_t* ctx = conn.xmpp_ctx;
xmpp_stanza_t* child;
xmpp_stanza_t* iq;
char* domain;
xmpp_timed_handler_delete(xmpp_conn, _register_handle_missing_features);
@ -420,15 +425,15 @@ _register_handle_features(xmpp_conn_t *xmpp_conn, xmpp_stanza_t *stanza, void *u
}
static void
_register_handler(xmpp_conn_t *xmpp_conn,
xmpp_conn_event_t status,
int error,
xmpp_stream_error_t *stream_error,
void *userdata)
_register_handler(xmpp_conn_t* xmpp_conn,
xmpp_conn_event_t status,
int error,
xmpp_stream_error_t* stream_error,
void* userdata)
{
conn.conn_last_event = status;
prof_reg_t *reg = (prof_reg_t *)userdata;
prof_reg_t* reg = (prof_reg_t*)userdata;
int secured;
(void)error;
@ -468,13 +473,12 @@ _register_handler(xmpp_conn_t *xmpp_conn,
default:
break;
}
}
jabber_conn_status_t
connection_register(const char* const altdomain, int port, const char* const tls_policy,
const char* const username, const char* const password)
const char* const username, const char* const password)
{
long flags;
@ -540,7 +544,7 @@ connection_register(const char* const altdomain, int port, const char* const tls
#undef LOG_FLAG_IF_SET
}
prof_reg_t *reg;
prof_reg_t* reg;
reg = calloc(1, sizeof(*reg));
if (reg == NULL) {
@ -1109,4 +1113,3 @@ connection_get_profanity_identifier(void)
{
return prof_identifier;
}

View File

@ -47,7 +47,7 @@ void connection_check_events(void);
jabber_conn_status_t connection_connect(const char* const fulljid, const char* const passwd, const char* const altdomain, int port,
const char* const tls_policy, const char* const auth_policy);
jabber_conn_status_t connection_register(const char* const altdomain, int port, const char* const tls_policy,
const char* const username, const char* const password);
const char* const username, const char* const password);
void connection_disconnect(void);
void connection_set_disconnected(void);
@ -70,4 +70,3 @@ void connection_remove_available_resource(const char* const resource);
char* connection_create_stanza_id(void);
#endif

View File

@ -2804,4 +2804,3 @@ iq_muc_register_nick(const char* const roomjid)
xmpp_stanza_release(iq);
xmpp_stanza_release(query);
}

View File

@ -545,4 +545,3 @@ _session_free_saved_details(void)
FREE_SET_NULL(saved_details.tls_policy);
FREE_SET_NULL(saved_details.auth_policy);
}

View File

@ -2924,4 +2924,3 @@ stanza_get_service_contact_addresses(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza)
return addresses;
}

View File

@ -415,4 +415,3 @@ xmpp_stanza_t* stanza_create_approve_voice(xmpp_ctx_t* ctx, const char* const id
xmpp_stanza_t* stanza_create_muc_register_nick(xmpp_ctx_t* ctx, const char* const id, const char* const jid, const char* const node, DataForm* form);
#endif

View File

@ -316,4 +316,3 @@ Autocomplete form_get_value_ac(DataForm* form, const char* const tag);
void form_reset_autocompleters(DataForm* form);
#endif

View File

@ -146,7 +146,7 @@ connection_get_profanity_identifier(void)
jabber_conn_status_t
connection_register(const char* const altdomain, int port, const char* const tls_policy,
const char* const username, const char* const password)
const char* const username, const char* const password)
{
check_expected(altdomain);
check_expected(port);