1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

form_get_field_by_var->form_get_form_type_field

This commit is contained in:
James Booth 2014-09-13 21:55:46 +01:00
parent 0a4dea55d5
commit c4b4cb557f
4 changed files with 7 additions and 7 deletions

View File

@ -172,7 +172,7 @@ caps_create_sha1_str(xmpp_stanza_t * const query)
} else if (g_strcmp0(xmpp_stanza_get_name(child), STANZA_NAME_X) == 0) {
if (strcmp(xmpp_stanza_get_ns(child), STANZA_NS_DATA) == 0) {
form = form_create(child);
char *form_type = form_get_field_by_var(form, "FORM_TYPE");
char *form_type = form_get_form_type_field(form);
form_names = g_slist_insert_sorted(form_names, g_strdup(form_type), (GCompareFunc)strcmp);
g_hash_table_insert(forms, g_strdup(form_type), form);
}
@ -196,7 +196,7 @@ caps_create_sha1_str(xmpp_stanza_t * const query)
curr = form_names;
while (curr != NULL) {
form = g_hash_table_lookup(forms, curr->data);
char *form_type = form_get_field_by_var(form, "FORM_TYPE");
char *form_type = form_get_form_type_field(form);
g_string_append(s, form_type);
g_string_append(s, "<");

View File

@ -374,12 +374,12 @@ _form_destroy(DataForm *form)
}
static char *
_form_get_field_by_var(DataForm *form, const char * const var)
_form_get_form_type_field(DataForm *form)
{
GSList *curr = form->fields;
while (curr != NULL) {
FormField *field = curr->data;
if (g_strcmp0(field->var, var) == 0) {
if (g_strcmp0(field->var, "FORM_TYPE") == 0) {
return field->values->data;
}
curr = g_slist_next(curr);
@ -428,7 +428,7 @@ void
form_init_module(void)
{
form_destroy = _form_destroy;
form_get_field_by_var = _form_get_field_by_var;
form_get_form_type_field = _form_get_form_type_field;
form_set_value_by_tag = _form_set_value_by_tag;
form_tag_exists = _form_tag_exists;
}

View File

@ -827,7 +827,7 @@ _disco_info_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz
DataForm *form = form_create(softwareinfo);
FormField *formField = NULL;
char *form_type = form_get_field_by_var(form, "FORM_TYPE");
char *form_type = form_get_form_type_field(form);
if (g_strcmp0(form_type, STANZA_DATAFORM_SOFTWARE) == 0) {
GSList *field = form->fields;
while (field != NULL) {

View File

@ -207,7 +207,7 @@ void (*roster_send_add_new)(const char * const barejid, const char * const name)
void (*roster_send_remove)(const char * const barejid);
void (*form_destroy)(DataForm *form);
char * (*form_get_field_by_var)(DataForm *form, const char * const var);
char * (*form_get_form_type_field)(DataForm *form);
void (*form_set_value_by_tag)(DataForm *form, const char * const tag, char *value);
gboolean (*form_tag_exists)(DataForm *form, const char * const tag);