Renamed stanza verification functions

This commit is contained in:
James Booth
2015-06-06 23:00:05 +01:00
parent 98b06b717c
commit 35babf392f
5 changed files with 14 additions and 14 deletions

View File

@@ -407,7 +407,7 @@ _shutdown(void)
close(listen_socket); close(listen_socket);
prime_free_all(); prime_free_all();
stanza_free_all(); stanzas_free_all();
pthread_mutex_lock(&send_queue_lock); pthread_mutex_lock(&send_queue_lock);
g_list_free_full(send_queue, free); g_list_free_full(send_queue, free);

View File

@@ -55,7 +55,7 @@ stanzas_contains_id(char *id)
} }
void void
stanza_add(XMPPStanza *stanza) stanzas_add(XMPPStanza *stanza)
{ {
pthread_mutex_lock(&stanzas_lock); pthread_mutex_lock(&stanzas_lock);
stanzas = g_list_append(stanzas, stanza); stanzas = g_list_append(stanzas, stanza);
@@ -149,7 +149,7 @@ _stanzas_equal(XMPPStanza *first, XMPPStanza *second)
} }
int int
stanza_verify_any(XMPPStanza *stanza) stanzas_verify_any(XMPPStanza *stanza)
{ {
pthread_mutex_lock(&stanzas_lock); pthread_mutex_lock(&stanzas_lock);
if (!stanzas) { if (!stanzas) {
@@ -173,7 +173,7 @@ stanza_verify_any(XMPPStanza *stanza)
} }
int int
stanza_verify_last(XMPPStanza *stanza) stanzas_verify_last(XMPPStanza *stanza)
{ {
pthread_mutex_lock(&stanzas_lock); pthread_mutex_lock(&stanzas_lock);
if (!stanzas) { if (!stanzas) {
@@ -198,7 +198,7 @@ stanza_verify_last(XMPPStanza *stanza)
} }
void void
stanza_free_all(void) stanzas_free_all(void)
{ {
pthread_mutex_lock(&stanzas_lock); pthread_mutex_lock(&stanzas_lock);
g_list_free_full(stanzas, (GDestroyNotify)stanza_free); g_list_free_full(stanzas, (GDestroyNotify)stanza_free);

View File

@@ -27,13 +27,13 @@
#include "server/stanza.h" #include "server/stanza.h"
void stanza_add(XMPPStanza *stanza); void stanzas_add(XMPPStanza *stanza);
int stanza_verify_any(XMPPStanza *stanza); int stanzas_verify_any(XMPPStanza *stanza);
int stanza_verify_last(XMPPStanza *stanza); int stanzas_verify_last(XMPPStanza *stanza);
int stanzas_contains_id(char *id); int stanzas_contains_id(char *id);
void stanza_free_all(void); void stanzas_free_all(void);
#endif #endif

View File

@@ -75,7 +75,7 @@ end_element(void *data, const char *element)
curr_stanza = curr_stanza->parent; curr_stanza = curr_stanza->parent;
} else { } else {
log_println("RECV: %s", curr_string->str); log_println("RECV: %s", curr_string->str);
stanza_add(curr_stanza); stanzas_add(curr_stanza);
if (stanza_get_child_by_ns(curr_stanza, "jabber:iq:auth")) { if (stanza_get_child_by_ns(curr_stanza, "jabber:iq:auth")) {
auth_cb(curr_stanza); auth_cb(curr_stanza);
} else { } else {

View File

@@ -96,12 +96,12 @@ verify_any(char *stanza_text)
int result = 0; int result = 0;
if (timeoutsecs <= 0) { if (timeoutsecs <= 0) {
result = stanza_verify_any(curr_stanza); result = stanzas_verify_any(curr_stanza);
} else { } else {
double elapsed = 0.0; double elapsed = 0.0;
GTimer *timer = g_timer_new(); GTimer *timer = g_timer_new();
while (elapsed < timeoutsecs * 1.0) { while (elapsed < timeoutsecs * 1.0) {
result = stanza_verify_any(curr_stanza); result = stanzas_verify_any(curr_stanza);
if (result) { if (result) {
break; break;
} }
@@ -136,12 +136,12 @@ verify_last(char *stanza_text)
int result = 0; int result = 0;
if (timeoutsecs <= 0) { if (timeoutsecs <= 0) {
result = stanza_verify_last(curr_stanza); result = stanzas_verify_last(curr_stanza);
} else { } else {
double elapsed = 0.0; double elapsed = 0.0;
GTimer *timer = g_timer_new(); GTimer *timer = g_timer_new();
while (elapsed < timeoutsecs * 1.0) { while (elapsed < timeoutsecs * 1.0) {
result = stanza_verify_last(curr_stanza); result = stanzas_verify_last(curr_stanza);
if (result) { if (result) {
break; break;
} }