From 3f6d7c56edd6c1f21b872adaec743ee0c583a947 Mon Sep 17 00:00:00 2001 From: Tristan Matthews <tristan.matthews@savoirfairelinux.com> Date: Fri, 18 Apr 2014 16:52:59 -0400 Subject: [PATCH] daemon: add getDisplayNames(conferenceID) D-Bus method Refs #45628 --- daemon/src/client/callmanager.cpp | 6 ++++++ daemon/src/client/callmanager.h | 1 + .../src/client/dbus/callmanager-introspec.xml | 17 +++++++++++++++++ daemon/src/conference.cpp | 13 +++++++++++++ daemon/src/conference.h | 6 ++++++ daemon/src/managerimpl.cpp | 18 +++++++++++++++++- daemon/src/managerimpl.h | 6 ++++++ gnome/src/dbus/callmanager-introspec.xml | 17 +++++++++++++++++ 8 files changed, 83 insertions(+), 1 deletion(-) diff --git a/daemon/src/client/callmanager.cpp b/daemon/src/client/callmanager.cpp index 398b52bfbb..5152a59e8b 100644 --- a/daemon/src/client/callmanager.cpp +++ b/daemon/src/client/callmanager.cpp @@ -186,6 +186,12 @@ CallManager::getParticipantList(const std::string& confID) return Manager::instance().getParticipantList(confID); } +std::vector<std::string> +CallManager::getDisplayNames(const std::string& confID) +{ + return Manager::instance().getDisplayNames(confID); +} + std::string CallManager::getConferenceId(const std::string& callID) { diff --git a/daemon/src/client/callmanager.h b/daemon/src/client/callmanager.h index 0ad19356cf..d85f8ad56a 100644 --- a/daemon/src/client/callmanager.h +++ b/daemon/src/client/callmanager.h @@ -120,6 +120,7 @@ class CallManager bool unholdConference(const std::string& confID); std::vector<std::string> getConferenceList(); std::vector<std::string> getParticipantList(const std::string& confID); + std::vector<std::string> getDisplayNames(const std::string& confID); std::string getConferenceId(const std::string& callID); std::map<std::string, std::string> getConferenceDetails(const std::string& callID); diff --git a/daemon/src/client/dbus/callmanager-introspec.xml b/daemon/src/client/dbus/callmanager-introspec.xml index bd97bdff75..41896bcc99 100644 --- a/daemon/src/client/dbus/callmanager-introspec.xml +++ b/daemon/src/client/dbus/callmanager-introspec.xml @@ -534,6 +534,23 @@ </arg> </signal> + <method name="getDisplayNames" tp:name-for-bindings="getDisplayNames"> + <tp:added version="1.3.0"/> + <tp:docstring> + Get the display name of every participant in a given conference, or their number as a fallback. + </tp:docstring> + <arg type="s" name="confID" direction="in"> + <tp:docstring> + The conference ID. + </tp:docstring> + </arg> + <arg type="as" name="list" direction="out"> + <tp:docstring> + The list of the display names. + </tp:docstring> + </arg> + </method> + <method name="getParticipantList" tp:name-for-bindings="getParticipantList"> <tp:added version="0.9.7"/> <tp:docstring> diff --git a/daemon/src/conference.cpp b/daemon/src/conference.cpp index 87e8861438..0d745868eb 100644 --- a/daemon/src/conference.cpp +++ b/daemon/src/conference.cpp @@ -139,6 +139,19 @@ ParticipantSet Conference::getParticipantList() const return participants_; } +std::vector<std::string> +Conference::getDisplayNames() const +{ + std::vector<std::string> result; + + for (const auto &p : participants_) { + auto details = Manager::instance().getCallDetails(p); + const auto tmp = details["DISPLAY_NAME"]; + result.push_back(tmp.empty() ? details["PEER_NUMBER"] : tmp); + } + return result; +} + bool Conference::toggleRecording() { const bool startRecording = Recordable::toggleRecording(); diff --git a/daemon/src/conference.h b/daemon/src/conference.h index 52856c60fb..e2203da2e5 100644 --- a/daemon/src/conference.h +++ b/daemon/src/conference.h @@ -100,6 +100,12 @@ class Conference : public Recordable { */ ParticipantSet getParticipantList() const; + /** + * Get the display names or peer numbers for this conference + */ + std::vector<std::string> + getDisplayNames() const; + /** * Start/stop recording toggle */ diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index e9b388e9be..34e00fe46e 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -2798,7 +2798,23 @@ std::vector<std::string> ManagerImpl::getConferenceList() const return v; } -std::vector<std::string> ManagerImpl::getParticipantList(const std::string& confID) const +std::vector<std::string> +ManagerImpl::getDisplayNames(const std::string& confID) const +{ + std::vector<std::string> v; + ConferenceMap::const_iterator iter_conf = conferenceMap_.find(confID); + + if (iter_conf != conferenceMap_.end()) { + return iter_conf->second->getDisplayNames(); + } else { + WARN("Did not find conference %s", confID.c_str()); + } + + return v; +} + +std::vector<std::string> +ManagerImpl::getParticipantList(const std::string& confID) const { std::vector<std::string> v; ConferenceMap::const_iterator iter_conf = conferenceMap_.find(confID); diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h index 256f2430d3..2f4a76f767 100644 --- a/daemon/src/managerimpl.h +++ b/daemon/src/managerimpl.h @@ -480,6 +480,12 @@ class ManagerImpl { */ std::vector<std::string> getParticipantList(const std::string& confID) const; + /** + * Get a list of the display names for everyone in a conference + * @return std::vector<std::string> A list of display names + */ + std::vector<std::string> getDisplayNames(const std::string& confID) const; + std::string getConferenceId(const std::string& callID); /** diff --git a/gnome/src/dbus/callmanager-introspec.xml b/gnome/src/dbus/callmanager-introspec.xml index bd97bdff75..41896bcc99 100644 --- a/gnome/src/dbus/callmanager-introspec.xml +++ b/gnome/src/dbus/callmanager-introspec.xml @@ -534,6 +534,23 @@ </arg> </signal> + <method name="getDisplayNames" tp:name-for-bindings="getDisplayNames"> + <tp:added version="1.3.0"/> + <tp:docstring> + Get the display name of every participant in a given conference, or their number as a fallback. + </tp:docstring> + <arg type="s" name="confID" direction="in"> + <tp:docstring> + The conference ID. + </tp:docstring> + </arg> + <arg type="as" name="list" direction="out"> + <tp:docstring> + The list of the display names. + </tp:docstring> + </arg> + </method> + <method name="getParticipantList" tp:name-for-bindings="getParticipantList"> <tp:added version="0.9.7"/> <tp:docstring> -- GitLab