TMP
This commit is contained in:
parent
1dd68f7d58
commit
9fc78a4485
@ -18,13 +18,75 @@
|
||||
|
||||
using TelepathyGLib;
|
||||
|
||||
[DBUS (name = "org.freedesktop.Telepathy.ConnectionManager.cauchy")]
|
||||
public class Cauchy.ConnectionManager : BaseConnectionManager {
|
||||
class construct {
|
||||
cm_dbus_name = "cauchy";
|
||||
[DBus (name = "org.freedesktop.Telepathy.ConnectionManager")]
|
||||
public class Cauchy.ConnectionManager : Object {
|
||||
public struct CMParams {
|
||||
string name;
|
||||
ConnMgrParamFlags flags;
|
||||
string signature;
|
||||
Variant default_value;
|
||||
}
|
||||
|
||||
construct {
|
||||
add_protocol(new Cauchy.Protocol());
|
||||
public unowned string
|
||||
get_name()
|
||||
throws TelepathyGLib.Error
|
||||
{
|
||||
return "cauchy";
|
||||
}
|
||||
|
||||
public bool
|
||||
has_protocol(string protocol)
|
||||
throws TelepathyGLib.Error
|
||||
{
|
||||
return (protocol == "matrix");
|
||||
}
|
||||
|
||||
public void
|
||||
get_parameters(string protocol,
|
||||
out CMParams[] parameters)
|
||||
throws TelepathyGLib.Error
|
||||
{
|
||||
parameters = {
|
||||
};
|
||||
|
||||
parameters += CMParams() {
|
||||
name = "account",
|
||||
flags = ConnMgrParamFlags.REQUIRED,
|
||||
signature = "s",
|
||||
default_value = new Variant.maybe(VariantType.STRING, null)
|
||||
};
|
||||
}
|
||||
|
||||
private void
|
||||
on_bus_acquired(DBusConnection conn)
|
||||
{
|
||||
try {
|
||||
conn.register_object(
|
||||
"/org/freedesktop/Telepathy/ConnectionManager/cauchy",
|
||||
this);
|
||||
} catch (IOError e) {
|
||||
stderr.printf("Could not register service: %s\n", e.message);
|
||||
}
|
||||
|
||||
try {
|
||||
conn.register_object(
|
||||
"/org/freedesktop/Telepathy/ConnectionManager/cauchy/matrix",
|
||||
new Cauchy.Protocol());
|
||||
} catch (IOError e) {
|
||||
stderr.printf("Could not register protocol: %s\n", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public void
|
||||
run()
|
||||
{
|
||||
Bus.own_name(BusType.SESSION,
|
||||
"org.freedesktop.Telepathy.ConnectionManager.cauchy",
|
||||
BusNameOwnerFlags.NONE,
|
||||
on_bus_acquired,
|
||||
() => {},
|
||||
() => stderr.printf("Could not acquire name.\n"));
|
||||
|
||||
new MainLoop().run();
|
||||
}
|
||||
}
|
||||
|
@ -18,4 +18,22 @@
|
||||
|
||||
using TelepathyGLib;
|
||||
|
||||
public class Cauchy.Protocol : BaseProtocol {}
|
||||
[DBus (name = "org.freedesktop.Telepathy.Protocol")]
|
||||
public class Cauchy.Protocol : Object {
|
||||
public void
|
||||
identify_account(HashTable<string, Variant> parameters,
|
||||
out string account_id)
|
||||
throws TelepathyGLib.Error
|
||||
{
|
||||
throw new TelepathyGLib.Error.NOT_IMPLEMENTED(
|
||||
"This feature is not implemented");
|
||||
}
|
||||
|
||||
public void
|
||||
normalize_contact(string contact_id, out string normalized_contact_id)
|
||||
throws TelepathyGLib.Error
|
||||
{
|
||||
throw new TelepathyGLib.Error.NOT_IMPLEMENTED(
|
||||
"This feature is meaningless on Matrix");
|
||||
}
|
||||
}
|
||||
|
32
src/cauchy.c
32
src/cauchy.c
@ -20,37 +20,17 @@
|
||||
|
||||
#include <telepathy-glib/telepathy-glib.h>
|
||||
|
||||
#include "cauchy-connection-manager.h"
|
||||
#include "cauchy.h"
|
||||
#include "cauchy-debug.h"
|
||||
|
||||
static TpBaseConnectionManager *
|
||||
_construct_cm(void)
|
||||
{
|
||||
TpBaseConnectionManager *base_cm = TP_BASE_CONNECTION_MANAGER(
|
||||
g_object_new(CAUCHY_TYPE_CONNECTION_MANAGER, NULL));
|
||||
|
||||
return base_cm;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
TpDebugSender *debug_sender;
|
||||
int result;
|
||||
CauchyConnectionManager *cm;
|
||||
|
||||
g_type_init();
|
||||
tp_debug_divert_messages(g_getenv("CAUCHY_LOGFILE"));
|
||||
cm = cauchy_connection_manager_new();
|
||||
cauchy_connection_manager_run(cm);
|
||||
g_object_unref(cm);
|
||||
|
||||
cauchy_debug_init();
|
||||
|
||||
debug_sender = tp_debug_sender_dup();
|
||||
|
||||
result = tp_run_connection_manager(
|
||||
"telepathy-cauchy", VERSION,
|
||||
_construct_cm,
|
||||
argc, argv);
|
||||
|
||||
g_object_unref (debug_sender);
|
||||
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ namespace TelepathyGLib {
|
||||
public abstract class BaseProtocol : GLib.Object {
|
||||
[CCode (has_construct_function = false)]
|
||||
public BaseProtocol();
|
||||
|
||||
public string name { get; construct; }
|
||||
}
|
||||
|
||||
[CCode (cheader_filename = "telepathy-glib/telepathy-glib.h")]
|
||||
|
Loading…
Reference in New Issue
Block a user