PhoneCall::PhoneCall(const Settings &settings) :
m_Settings(settings)
{
+ qDebug() << "Created new default Phone Call: " << *this;
}
PhoneCall::~PhoneCall()
if(Tel().indexOf("0") == 0)
setTel(QString(Tel()).replace(QRegExp("^0"), "+44"));
- // We directly access the m_Attachments member variable here rather than the
- // accessor as the accessor is const
if(attachments.count() > 0)
foreach(RTComElAttachment *attachment, attachments)
Attachments().append(new Attachment(*attachment));
+
+ qDebug() << "Created new Phone Call from RtCom:\n" << *this;
}
+
+PhoneCall::PhoneCall(const Settings &settings, const eDestination destination, const QDateTime ×tamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments) :
+ m_Settings(settings), m_Destination(destination), m_Timestamp(timestamp), m_Tel(tel),
+ m_DurationInSeconds(durationInSeconds), m_Attachments(attachments)
+{
+ if(Tel().indexOf("0") == 0)
+ setTel(QString(Tel()).replace(QRegExp("^0"), "+44"));
+
+ // TODO: Copy attachments.
+// if(attachments.count() > 0)
+// foreach(const QSharedPointer<Attachment *> &attachment, attachments)
+// Attachments().append(attachment);
+
+ qDebug() << "Created new Phone Call: " << *this;
+}
+
#include <QDebug>
const uint PhoneCall::HashCode() const
{
RTComElEvent * PhoneCall::toRTComEvent(const NumberToNameLookup &numberToNameLookup) const
{
QList<QString> voiceMailList;
+ voiceMailList << "+447945353070"; // T-Mobile UK Voicemail
QString groupId((Tel().length() < 7 || Tel().indexOf(QRegExp("[:alpha:]+")) > -1)
? Tel()
RTCOM_EL_EVENT_SET_FIELD (event, event_type, g_strdup("RTCOM_EL_EVENTTYPE_CALL_VOICEMAIL"));
else
RTCOM_EL_EVENT_SET_FIELD (event, event_type, g_strdup("RTCOM_EL_EVENTTYPE_CALL"));
- RTCOM_EL_EVENT_SET_FIELD (event, storage_time, Timestamp().toUTC().toTime_t());
RTCOM_EL_EVENT_SET_FIELD (event, start_time, Timestamp().toUTC().toTime_t());
- RTCOM_EL_EVENT_SET_FIELD (event, end_time, Timestamp().toUTC().toTime_t());
+ RTCOM_EL_EVENT_SET_FIELD (event, end_time, Timestamp().addSecs(DurationInSeconds()).toUTC().toTime_t());
+ RTCOM_EL_EVENT_SET_FIELD (event, storage_time, Timestamp().addSecs(DurationInSeconds()).toUTC().toTime_t());
//RTCOM_EL_EVENT_SET_FIELD (event, is_read, 0);
RTCOM_EL_EVENT_SET_FIELD (event, outgoing, Destination() == PhoneCall::OUTGOING ? 1 : 0);
+ //if(local_uid) // Voicemail local_uid transform needed here
RTCOM_EL_EVENT_SET_FIELD (event, local_uid, g_strdup("ring/tel/ring"));
//RTCOM_EL_EVENT_SET_FIELD (&event, local_name, g_strdup("<SelfHandle>"));
RTCOM_EL_EVENT_SET_FIELD (event, remote_uid, g_strdup(Tel().toUtf8()));
//RTCOM_EL_EVENT_SET_FIELD (&event, remote_name, g_strdup(QString::number(numberToNameLookup.ContactDetails().value(Tel()).second).toUtf8()));
RTCOM_EL_EVENT_SET_FIELD (event, remote_ebook_uid, g_strdup(QString::number(numberToNameLookup.ContactDetails().value(Tel()).first).toUtf8()));
RTCOM_EL_EVENT_SET_FIELD (event, group_uid, g_strdup(groupId.toUtf8()));
- //RTCOM_EL_EVENT_SET_FIELD (event, free_text, g_strdup(Contents().replace(0x2029, "\n").toUtf8()));
- //RTCOM_EL_EVENT_SET_FIELD (event, free_text, g_strdup(Contents().toUtf8()));
return event;
}
QDebug operator<<(QDebug dbg, PhoneCall& event)
{
- dbg.nospace() << "\tFolder:\t\t" << (event.Destination() == PhoneCall::OUTGOING ? "Sent" : "Inbox") << "\n";
+ dbg.nospace() << "\tDirection:\t\t" << (event.Destination() == PhoneCall::OUTGOING ? "Made" : "Recieved") << "\n";
dbg.nospace() << "\tTimestamp:\t" << event.Timestamp().toUTC() << "\n";
- dbg.nospace() << "\tDuration:\t" << event.DurationInSeconds() << "\n";
+ dbg.nospace() << "\tDuration:\t\t" << event.DurationInSeconds() << " seconds\n";
dbg.nospace() << "\tRemote-Tel:\t" << event.Tel() << "\n";
//dbg.nospace() << "\tremote-name:\t" << event.fld_remote_name << "\n";