nixpkgs/pkgs/applications/networking/instant-messengers/skype-call-recorder/conference.patch
2013-04-05 17:53:35 +02:00

149 lines
3.8 KiB
Diff

From abd67f1d44eef81baf2e9729f95e002c4ecc7350 Mon Sep 17 00:00:00 2001
From: jlh <jlh@gmx.ch>
Date: Fri, 16 Oct 2009 17:40:54 +0200
Subject: [PATCH] Rudimentary support for recording hosted conference calls
---
call.cpp | 37 +++++++++++++++++++++++++++++++++++--
call.h | 11 ++++++++++-
2 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/call.cpp b/call.cpp
index c2b02f2..663c1c1 100644
--- a/call.cpp
+++ b/call.cpp
@@ -90,9 +90,10 @@ void AutoSync::reset() {
// Call class
-Call::Call(QObject *p, Skype *sk, CallID i) :
- QObject(p),
+Call::Call(CallHandler *h, Skype *sk, CallID i) :
+ QObject(h),
skype(sk),
+ handler(h),
id(i),
status("UNKNOWN"),
writer(NULL),
@@ -119,6 +120,13 @@ Call::Call(QObject *p, Skype *sk, CallID i) :
debug(QString("Call %1: cannot get partner display name").arg(id));
displayName = "Unnamed Caller";
}
+
+ // Skype does not properly send updates when the CONF_ID property
+ // changes. since we need this information, check it now on all calls
+ handler->updateConfIDs();
+ // this call isn't yet in the list of calls, thus we need to
+ // explicitely check its CONF_ID
+ updateConfID();
}
Call::~Call() {
@@ -134,6 +142,10 @@ Call::~Call() {
// QT takes care of deleting servers and sockets
}
+void Call::updateConfID() {
+ confID = skype->getObject(QString("CALL %1 CONF_ID").arg(id)).toLong();
+}
+
bool Call::okToDelete() const {
// this is used for checking whether past calls may now be deleted.
// when a past call hasn't been decided yet whether it should have been
@@ -270,6 +282,11 @@ void Call::startRecording(bool force) {
if (isRecording)
return;
+ if (handler->isConferenceRecording(confID)) {
+ debug(QString("Call %1: call is part of a conference that is already being recorded").arg(id));
+ return;
+ }
+
if (force) {
emit showLegalInformation();
} else {
@@ -589,6 +606,22 @@ CallHandler::~CallHandler() {
delete legalInformationDialog;
}
+void CallHandler::updateConfIDs() {
+ QList<Call *> list = calls.values();
+ for (int i = 0; i < list.size(); i++)
+ list.at(i)->updateConfID();
+}
+
+bool CallHandler::isConferenceRecording(CallID id) const {
+ QList<Call *> list = calls.values();
+ for (int i = 0; i < list.size(); i++) {
+ Call *c = list.at(i);
+ if (c->getConfID() == id && c->getIsRecording())
+ return true;
+ }
+ return false;
+}
+
void CallHandler::callCmd(const QStringList &args) {
CallID id = args.at(0).toInt();
diff --git a/call.h b/call.h
index cb8396d..b746f46 100644
--- a/call.h
+++ b/call.h
@@ -43,6 +43,8 @@ class QTcpServer;
class QTcpSocket;
class LegalInformationDialog;
+class CallHandler;
+
typedef int CallID;
class AutoSync {
@@ -68,18 +70,21 @@ private:
class Call : public QObject {
Q_OBJECT
public:
- Call(QObject *, Skype *, CallID);
+ Call(CallHandler *, Skype *, CallID);
~Call();
void startRecording(bool = false);
void stopRecording(bool = true);
+ void updateConfID();
bool okToDelete() const;
void setStatus(const QString &);
QString getStatus() const { return status; }
bool statusDone() const;
bool statusActive() const;
CallID getID() const { return id; }
+ CallID getConfID() const { return confID; }
void removeFile();
void hideConfirmation(int);
+ bool getIsRecording() const { return isRecording; }
signals:
void startedCall(int, const QString &);
@@ -99,10 +104,12 @@ private:
private:
Skype *skype;
+ CallHandler *handler;
CallID id;
QString status;
QString skypeName;
QString displayName;
+ CallID confID;
AudioFileWriter *writer;
bool isRecording;
int stereo;
@@ -140,6 +147,8 @@ class CallHandler : public QObject {
public:
CallHandler(QObject *, Skype *);
~CallHandler();
+ void updateConfIDs();
+ bool isConferenceRecording(CallID) const;
void callCmd(const QStringList &);
signals:
--
1.6.5.GIT