aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/applications/networking/instant-messengers/skype-call-recorder/conference.patch
blob: 8b8ce8fd7bbf1a291ce4c476e9967caf5439557b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
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