|
|
|
@ -36,8 +36,8 @@
|
|
|
|
|
|
|
|
|
|
#include "jabberaccount.h"
|
|
|
|
|
#include <kdebug.h>
|
|
|
|
|
#define qDebug( X ) kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << X << endl
|
|
|
|
|
#define qWarning( X ) kdWarning() <<k_funcinfo<< X << endl
|
|
|
|
|
#define tqDebug( X ) kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << X << endl
|
|
|
|
|
#define tqWarning( X ) kdWarning() <<k_funcinfo<< X << endl
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
@ -111,10 +111,10 @@ void JingleClientSlots::callCreated(cricket::Call *call)
|
|
|
|
|
|
|
|
|
|
void JingleClientSlots::callDestroyed(cricket::Call *call)
|
|
|
|
|
{
|
|
|
|
|
qDebug("JingleClientSlots: Call destroyed");
|
|
|
|
|
tqDebug("JingleClientSlots: Call destroyed");
|
|
|
|
|
Jid jid(call->sessions()[0]->remote_address().c_str());
|
|
|
|
|
if (voiceCaller_->calling(jid)) {
|
|
|
|
|
qDebug(TQString("Removing unterminated call to %1").arg(jid.full()));
|
|
|
|
|
tqDebug(TQString("Removing unterminated call to %1").arg(jid.full()));
|
|
|
|
|
voiceCaller_->removeCall(jid);
|
|
|
|
|
emit voiceCaller_->terminated(jid);
|
|
|
|
|
}
|
|
|
|
@ -138,7 +138,7 @@ void JingleClientSlots::requestSignaling()
|
|
|
|
|
|
|
|
|
|
void JingleClientSlots::stateChanged(cricket::Call *call, cricket::Session *session, cricket::Session::State state)
|
|
|
|
|
{
|
|
|
|
|
qDebug(TQString("jinglevoicecaller.cpp: State changed (%1)").arg(state));
|
|
|
|
|
tqDebug(TQString("jinglevoicecaller.cpp: State changed (%1)").arg(state));
|
|
|
|
|
// Why is c_str() stuff needed to make it compile on OS X ?
|
|
|
|
|
Jid jid(session->remote_address().c_str());
|
|
|
|
|
|
|
|
|
@ -156,7 +156,7 @@ void JingleClientSlots::stateChanged(cricket::Call *call, cricket::Session *sess
|
|
|
|
|
}
|
|
|
|
|
else if (state == cricket::Session::STATE_SENTMODIFY) { }
|
|
|
|
|
else if (state == cricket::Session::STATE_RECEIVEDMODIFY) {
|
|
|
|
|
qWarning(TQString("jinglevoicecaller.cpp: RECEIVEDMODIFY not implemented yet (was from %1)").arg(jid.full()));
|
|
|
|
|
tqWarning(TQString("jinglevoicecaller.cpp: RECEIVEDMODIFY not implemented yet (was from %1)").arg(jid.full()));
|
|
|
|
|
}
|
|
|
|
|
else if (state == cricket::Session::STATE_SENTREJECT) { }
|
|
|
|
|
else if (state == cricket::Session::STATE_RECEIVEDREJECT) {
|
|
|
|
@ -195,9 +195,9 @@ void JingleVoiceCaller::initialize()
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
TQString jid = ((ClientStream&) account()->client()->client()->stream()).jid().full();
|
|
|
|
|
qDebug(TQString("jinglevoicecaller.cpp: Creating new caller for %1").arg(jid));
|
|
|
|
|
tqDebug(TQString("jinglevoicecaller.cpp: Creating new caller for %1").arg(jid));
|
|
|
|
|
if (jid.isEmpty()) {
|
|
|
|
|
qWarning("jinglevoicecaller.cpp: Empty JID");
|
|
|
|
|
tqWarning("jinglevoicecaller.cpp: Empty JID");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -271,7 +271,7 @@ bool JingleVoiceCaller::calling(const Jid& jid)
|
|
|
|
|
|
|
|
|
|
void JingleVoiceCaller::call(const Jid& jid)
|
|
|
|
|
{
|
|
|
|
|
qDebug(TQString("jinglevoicecaller.cpp: Calling %1").arg(jid.full()));
|
|
|
|
|
tqDebug(TQString("jinglevoicecaller.cpp: Calling %1").arg(jid.full()));
|
|
|
|
|
cricket::Call *c = ((cricket::PhoneSessionClient*)(phone_client_))->CreateCall();
|
|
|
|
|
c->InitiateSession(buzz::Jid(jid.full().ascii()));
|
|
|
|
|
phone_client_->SetFocus(c);
|
|
|
|
@ -279,7 +279,7 @@ void JingleVoiceCaller::call(const Jid& jid)
|
|
|
|
|
|
|
|
|
|
void JingleVoiceCaller::accept(const Jid& j)
|
|
|
|
|
{
|
|
|
|
|
qDebug("jinglevoicecaller.cpp: Accepting call");
|
|
|
|
|
tqDebug("jinglevoicecaller.cpp: Accepting call");
|
|
|
|
|
cricket::Call* call = calls_[j.full()];
|
|
|
|
|
if (call != NULL) {
|
|
|
|
|
call->AcceptSession(call->sessions()[0]);
|
|
|
|
@ -289,7 +289,7 @@ void JingleVoiceCaller::accept(const Jid& j)
|
|
|
|
|
|
|
|
|
|
void JingleVoiceCaller::reject(const Jid& j)
|
|
|
|
|
{
|
|
|
|
|
qDebug("jinglevoicecaller.cpp: Rejecting call");
|
|
|
|
|
tqDebug("jinglevoicecaller.cpp: Rejecting call");
|
|
|
|
|
cricket::Call* call = calls_[j.full()];
|
|
|
|
|
if (call != NULL) {
|
|
|
|
|
call->RejectSession(call->sessions()[0]);
|
|
|
|
@ -299,7 +299,7 @@ void JingleVoiceCaller::reject(const Jid& j)
|
|
|
|
|
|
|
|
|
|
void JingleVoiceCaller::terminate(const Jid& j)
|
|
|
|
|
{
|
|
|
|
|
qDebug(TQString("jinglevoicecaller.cpp: Terminating call to %1").arg(j.full()));
|
|
|
|
|
tqDebug(TQString("jinglevoicecaller.cpp: Terminating call to %1").arg(j.full()));
|
|
|
|
|
cricket::Call* call = calls_[j.full()];
|
|
|
|
|
if (call != NULL) {
|
|
|
|
|
call->Terminate();
|
|
|
|
@ -314,20 +314,20 @@ void JingleVoiceCaller::sendStanza(const char* stanza)
|
|
|
|
|
|
|
|
|
|
void JingleVoiceCaller::registerCall(const Jid& jid, cricket::Call* call)
|
|
|
|
|
{
|
|
|
|
|
qDebug("jinglevoicecaller.cpp: Registering call\n");
|
|
|
|
|
tqDebug("jinglevoicecaller.cpp: Registering call\n");
|
|
|
|
|
kdDebug(14000) << k_funcinfo << jid.full() << endl;
|
|
|
|
|
if (!calls_.contains(jid.full())) {
|
|
|
|
|
calls_[jid.full()] = call;
|
|
|
|
|
}
|
|
|
|
|
// else {
|
|
|
|
|
// qWarning("jinglevoicecaller.cpp: Auto-rejecting call because another call is currently open");
|
|
|
|
|
// tqWarning("jinglevoicecaller.cpp: Auto-rejecting call because another call is currently open");
|
|
|
|
|
// call->RejectSession(call->sessions()[0]);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void JingleVoiceCaller::removeCall(const Jid& j)
|
|
|
|
|
{
|
|
|
|
|
qDebug(TQString("JingleVoiceCaller: Removing call to %1").arg(j.full()));
|
|
|
|
|
tqDebug(TQString("JingleVoiceCaller: Removing call to %1").arg(j.full()));
|
|
|
|
|
calls_.remove(j.full());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -341,7 +341,7 @@ void JingleVoiceCaller::receiveStanza(const TQString& stanza)
|
|
|
|
|
Jid from = Jid(doc.documentElement().attribute("from"));
|
|
|
|
|
TQString type = doc.documentElement().attribute("type");
|
|
|
|
|
if (type == "unavailable" && calls_.contains(from.full())) {
|
|
|
|
|
qDebug("JingleVoiceCaller: User went offline without closing a call.");
|
|
|
|
|
tqDebug("JingleVoiceCaller: User went offline without closing a call.");
|
|
|
|
|
removeCall(from);
|
|
|
|
|
emit terminated(from);
|
|
|
|
|
}
|
|
|
|
@ -363,7 +363,7 @@ void JingleVoiceCaller::receiveStanza(const TQString& stanza)
|
|
|
|
|
|
|
|
|
|
// Spread the word
|
|
|
|
|
if (ok) {
|
|
|
|
|
qDebug(TQString("jinglevoicecaller.cpp: Handing down %1").arg(stanza));
|
|
|
|
|
tqDebug(TQString("jinglevoicecaller.cpp: Handing down %1").arg(stanza));
|
|
|
|
|
buzz::XmlElement *e = buzz::XmlElement::ForStr(stanza.ascii());
|
|
|
|
|
phone_client_->OnIncomingStanza(e);
|
|
|
|
|
}
|
|
|
|
|