Commit 08e9cd63 authored by Sylvain Berfini's avatar Sylvain Berfini

Simple wrapper for sending logs by email

parent 5f7ea397
......@@ -162,6 +162,10 @@ namespace Linphone.Agents
public void ComposingReceived(LinphoneChatRoom room)
{
}
public void LogUploadStatusChanged(bool uploadComplete, string info)
{
}
#endregion
}
}
......@@ -1618,6 +1618,26 @@ void composing_received(LinphoneCore *lc, LinphoneChatRoom *room)
Linphone::Core::gApiLock.LeaveListener();
}
void log_collection_upload_progress_indication(LinphoneCore *lc, size_t progress) {
Linphone::Core::gApiLock.EnterListener();
Linphone::Core::LinphoneCoreListener^ listener = Linphone::Core::Globals::Instance->LinphoneCore->CoreListener;
if (listener != nullptr)
{
//TODO
}
Linphone::Core::gApiLock.LeaveListener();
}
void log_collection_upload_state_changed(LinphoneCore *lc, LinphoneCoreLogCollectionUploadState state, const char *info) {
Linphone::Core::gApiLock.EnterListener();
Linphone::Core::LinphoneCoreListener^ listener = Linphone::Core::Globals::Instance->LinphoneCore->CoreListener;
if (listener != nullptr)
{
listener->LogUploadStatusChanged(state == LinphoneCoreLogCollectionUploadState::LinphoneCoreLogCollectionUploadStateDelivered, info ? Linphone::Core::Utils::cctops(info) : nullptr);
}
Linphone::Core::gApiLock.LeaveListener();
}
Linphone::Core::LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener) :
lc(nullptr),
listener(coreListener)
......@@ -1679,6 +1699,8 @@ void Linphone::Core::LinphoneCore::Init()
vtable->call_stats_updated = call_stats_updated;
vtable->message_received = message_received;
vtable->is_composing_received = composing_received;
vtable->log_collection_upload_progress_indication = log_collection_upload_progress_indication;
vtable->log_collection_upload_state_changed = log_collection_upload_state_changed;
this->lc = linphone_core_new_with_config(vtable, config ? config->config : NULL, NULL);
RefToPtrProxy<LinphoneCore^> *proxy = new RefToPtrProxy<LinphoneCore^>(this);
......
......@@ -83,6 +83,8 @@ namespace Linphone
/// </summary>
/// <param name="room">The room for which the composing status has been updated</param>
void ComposingReceived(LinphoneChatRoom^ room);
void LogUploadStatusChanged(Platform::Boolean uploadComplete, Platform::String^ info);
};
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ using Linphone.Views;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Net.NetworkInformation;
using Microsoft.Phone.Networking.Voip;
using Microsoft.Phone.Tasks;
using System;
using System.Collections.Generic;
using System.Diagnostics;
......@@ -1005,6 +1006,17 @@ namespace Linphone.Model
}
});
}
public void LogUploadStatusChanged(bool uploadComplete, string info)
{
BaseModel.UIDispatcher.BeginInvoke(() =>
{
if (uploadComplete)
{
SendEmail(info);
}
});
}
#endregion
#region Contact Lookup
......@@ -1061,5 +1073,14 @@ namespace Linphone.Model
}
}
#endregion
private void SendEmail(string body)
{
EmailComposeTask email = new EmailComposeTask();
email.To = "linphone-wphone@belledonne-communications.com";
email.Subject = "Logs report";
email.Body = body;
email.Show();
}
}
}
......@@ -85,12 +85,7 @@ namespace Linphone.Views
private void email_Click_1(object sender, EventArgs e)
{
string body = logs.Length > 32000 ? logs.Substring(logs.Length - 32000) : logs;
EmailComposeTask email = new EmailComposeTask();
email.To = "linphone-wphone@belledonne-communications.com";
email.Subject = "Logs report";
email.Body = body;
email.Show();
LinphoneManager.Instance.LinphoneCore.UploadLogCollection();
}
private void delete_Click_1(object sender, EventArgs e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment