Open Source Telephony
 help / color / mirror / Atom feed
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau <frederic.dalleau@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 2/2] voicecall: manage multiparty list in AT+CHLD=2X
Date: Wed, 29 Jun 2011 21:38:53 +0200	[thread overview]
Message-ID: <1309376333-6076-3-git-send-email-frederic.dalleau@linux.intel.com> (raw)
In-Reply-To: <1309376333-6076-1-git-send-email-frederic.dalleau@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2108 bytes --]

---
 src/voicecall.c |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 8e4ab58..e55f44b 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2756,6 +2756,38 @@ static void emulator_mpty_join_cb(const struct ofono_error *error, void *data)
 	g_free(mp);
 }
 
+static void emulator_mpty_private_chat_cb(const struct ofono_error *error,
+							void *data)
+{
+	struct mpty_cb_info *mp = data;
+	GSList *old;
+	GSList *l;
+
+	ofono_emulator_send_final(mp->em, error);
+
+	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+		g_free(mp);
+		return;
+	}
+
+	old = g_slist_copy(mp->vc->multiparty_list);
+
+	l = g_slist_find_custom(mp->vc->multiparty_list,
+				GINT_TO_POINTER(mp->id), call_compare_by_id);
+
+	if (l) {
+		mp->vc->multiparty_list =
+			g_slist_remove(mp->vc->multiparty_list, l->data);
+
+		if (mp->vc->multiparty_list->next == NULL) {
+			g_slist_free(mp->vc->multiparty_list);
+			mp->vc->multiparty_list = 0;
+		}
+	}
+
+	voicecalls_multiparty_changed(old, mp->vc->multiparty_list);
+	g_slist_free(old);
+	g_free(mp);
 }
 
 static void emulator_ata_cb(struct ofono_emulator *em,
@@ -2990,11 +3022,35 @@ static void emulator_chld_cb(struct ofono_emulator *em,
 		}
 
 		if (chld >= 21 && chld <= 27) {
+			GSList *l;
+			struct mpty_cb_info *mp;
+			unsigned int id = chld - 20;
+
 			if (vc->driver->private_chat == NULL)
 				goto fail;
 
-			vc->driver->private_chat(vc, chld - 20,
-					emulator_generic_cb, em);
+			for (l = vc->multiparty_list; l; l = l->next) {
+				struct voicecall *v = l->data;
+				if (v->call->id == id)
+					break;
+			}
+
+			if (l == NULL)
+				goto fail;
+
+			if (voicecalls_have_held(vc))
+				goto fail;
+
+			mp = g_try_malloc0(sizeof(struct mpty_cb_info));
+			if (!mp)
+				goto fail;
+
+			mp->vc = vc;
+			mp->em = em;
+			mp->id = id;
+
+			vc->driver->private_chat(vc, id,
+					emulator_mpty_private_chat_cb, mp);
 			return;
 		}
 
-- 
1.7.1


      parent reply	other threads:[~2011-06-29 19:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-29 19:38 [PATCH 0/2] Manage multiparty list in emulator CHLD calls =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-06-29 19:38 ` [PATCH 1/2] voicecall: manage multiparty list in AT+CHLD=3 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-06-29 21:09   ` Denis Kenzior
2011-06-29 19:38 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309376333-6076-3-git-send-email-frederic.dalleau@linux.intel.com \
    --to=frederic.dalleau@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox