summaryrefslogtreecommitdiffstats
path: root/src/indmanager/ind_manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/indmanager/ind_manager.c')
-rw-r--r--src/indmanager/ind_manager.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/indmanager/ind_manager.c b/src/indmanager/ind_manager.c
index e2fba79..d3a73e8 100644
--- a/src/indmanager/ind_manager.c
+++ b/src/indmanager/ind_manager.c
@@ -458,6 +458,30 @@ bool pair_enumeration(IMManager *manager, IMEnumerationPair *epair)
return true;
}
+// When the filter is added there is no enum pairs created
+// This function will generate pairs where they are missing
+bool first_poll(IMManager *manager, IMError *err)
+{
+ DEBUG("IM first poll called");
+ if (!manager) {
+ *err = IM_ERR_MANAGER;
+ return false;
+ }
+ if (!manager->enums) {
+ // Nothing to poll
+ return true;
+ }
+ IMEnumerationPair *epair = NULL;
+ for (epair = manager->enums->first; epair; epair = epair->next) {
+ if (epair->this_enum == NULL && epair->prev_enum == NULL) {
+ if (!pair_enumeration(manager, epair)) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
bool _im_poll(IMManager *manager, IMError *err)
{
DEBUG("IM poll called");
@@ -653,6 +677,13 @@ static void *manage(void *data)
DEBUG("manage thread waiting to indication start");
pthread_cond_wait(&_t_cond, &_t_mutex);
}
+
+ if (manager->polling) {
+ if (!first_poll(manager, &err)) {
+ pthread_mutex_unlock(&_t_mutex);
+ return (void *)err;
+ }
+ }
pthread_mutex_unlock(&_t_mutex);
DEBUG("manage thread calling watcher");