Move caps_create_query_response_stanza -> stanza_create_caps_query_element
This commit is contained in:
@@ -106,6 +106,27 @@ caps_init(void)
|
||||
my_sha1 = NULL;
|
||||
}
|
||||
|
||||
GList*
|
||||
caps_get_features(void)
|
||||
{
|
||||
GList *result = NULL;
|
||||
|
||||
GList *curr = prof_features;
|
||||
while (curr) {
|
||||
result = g_list_append(result, curr->data);
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
|
||||
GList *plugin_features = plugins_get_disco_features();
|
||||
curr = plugin_features;
|
||||
while (curr) {
|
||||
result = g_list_append(result, curr->data);
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
caps_add_by_ver(const char *const ver, EntityCapabilities *caps)
|
||||
{
|
||||
@@ -540,7 +561,7 @@ char*
|
||||
caps_get_my_sha1(xmpp_ctx_t *const ctx)
|
||||
{
|
||||
if (my_sha1 == NULL) {
|
||||
xmpp_stanza_t *query = caps_create_query_response_stanza(ctx);
|
||||
xmpp_stanza_t *query = stanza_create_caps_query_element(ctx);
|
||||
my_sha1 = caps_create_sha1_str(query);
|
||||
xmpp_stanza_release(query);
|
||||
}
|
||||
@@ -557,62 +578,6 @@ caps_reset_ver(void)
|
||||
}
|
||||
}
|
||||
|
||||
xmpp_stanza_t*
|
||||
caps_create_query_response_stanza(xmpp_ctx_t *const ctx)
|
||||
{
|
||||
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
|
||||
xmpp_stanza_set_ns(query, XMPP_NS_DISCO_INFO);
|
||||
|
||||
xmpp_stanza_t *identity = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(identity, "identity");
|
||||
xmpp_stanza_set_attribute(identity, "category", "client");
|
||||
xmpp_stanza_set_attribute(identity, "type", "console");
|
||||
|
||||
GString *name_str = g_string_new("Profanity ");
|
||||
g_string_append(name_str, PACKAGE_VERSION);
|
||||
if (strcmp(PACKAGE_STATUS, "development") == 0) {
|
||||
#ifdef HAVE_GIT_VERSION
|
||||
g_string_append(name_str, "dev.");
|
||||
g_string_append(name_str, PROF_GIT_BRANCH);
|
||||
g_string_append(name_str, ".");
|
||||
g_string_append(name_str, PROF_GIT_REVISION);
|
||||
#else
|
||||
g_string_append(name_str, "dev");
|
||||
#endif
|
||||
}
|
||||
xmpp_stanza_set_attribute(identity, "name", name_str->str);
|
||||
g_string_free(name_str, TRUE);
|
||||
xmpp_stanza_add_child(query, identity);
|
||||
xmpp_stanza_release(identity);
|
||||
|
||||
GList *curr = prof_features;
|
||||
while (curr) {
|
||||
xmpp_stanza_t *feature = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(feature, STANZA_NAME_FEATURE);
|
||||
xmpp_stanza_set_attribute(feature, STANZA_ATTR_VAR, curr->data);
|
||||
xmpp_stanza_add_child(query, feature);
|
||||
xmpp_stanza_release(feature);
|
||||
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
|
||||
GList *plugin_features = plugins_get_disco_features();
|
||||
curr = plugin_features;
|
||||
while (curr) {
|
||||
xmpp_stanza_t *feature = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(feature, STANZA_NAME_FEATURE);
|
||||
xmpp_stanza_set_attribute(feature, STANZA_ATTR_VAR, curr->data);
|
||||
xmpp_stanza_add_child(query, feature);
|
||||
xmpp_stanza_release(feature);
|
||||
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
g_list_free(plugin_features);
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
void
|
||||
caps_close(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user