voicecall: add API to find call by status
authorFrédéric Danis <frederic.danis@linux.intel.com>
Wed, 13 Apr 2011 16:05:30 +0000 (18:05 +0200)
committerDenis Kenzior <denkenz@gmail.com>
Tue, 19 Apr 2011 18:53:24 +0000 (13:53 -0500)
src/ofono.h
src/voicecall.c

index 156bc40..82d7e34 100644 (file)
@@ -270,6 +270,9 @@ int __ofono_voicecall_tone_send(struct ofono_voicecall *vc,
                                ofono_voicecall_tone_cb_t cb, void *user_data);
 void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id);
 
+struct ofono_call *__ofono_voicecall_find_call_with_status(
+                               struct ofono_voicecall *vc, int status);
+
 #include <ofono/sms.h>
 
 struct sms;
index 9878050..f2e03e5 100644 (file)
@@ -1098,6 +1098,22 @@ static gboolean voicecalls_have_incoming(struct ofono_voicecall *vc)
        return voicecalls_have_with_status(vc, CALL_STATUS_INCOMING);
 }
 
+struct ofono_call *__ofono_voicecall_find_call_with_status(
+                               struct ofono_voicecall *vc, int status)
+{
+       GSList *l;
+       struct voicecall *v;
+
+       for (l = vc->call_list; l; l = l->next) {
+               v = l->data;
+
+               if (v->call->status == status)
+                       return v->call;
+       }
+
+       return NULL;
+}
+
 static void voicecalls_multiparty_changed(GSList *old, GSList *new)
 {
        GSList *o, *n;