/* * private string TranslatePresence (McPresence p) * { * string translated = null; * switch (p) { * case McPresence.Available: * translated = "Available"; * break; * case McPresence.Away: * translated = "Away"; * break; * case McPresence.DoNotDisturb: * translated = "Do Not Disturb"; * break; * case McPresence.ExtendedAway: * translated = "Extended Away"; * break; * case McPresence.Hidden: * translated = "Hidden"; * break; * case McPresence.Offline: * translated = "Offline"; * break; * case McPresence.Unset: * translated = "Unset"; * break; * } * * return translated; * } * * private string TranslateStatus (McStatus s) * { * string translated = null; * * switch (s) { * case McStatus.Connected: * translated = "Connected"; * break; * case McStatus.Connecting: * translated = "Connecting"; * break; * case McStatus.Disconnected: * translated = "Disconnected"; * break; * } * * return translated; * } */ public void Initialize() { IMissionControl mc = bus.GetObject <IMissionControl> (Constants.MISSIONCONTROL_IFACE, new ObjectPath(Constants.MISSIONCONTROL_PATH)); if (mc == null) { Console.WriteLine(MSG_PREFIX + "Unable to find MissonControl interface."); return; } string[] conn; conn = mc.GetOnlineConnections(); for (int i = 0; i < conn.Length; i++) { McStatus conn_status = mc.GetConnectionStatus(conn[i]); string bus_name; ObjectPath op; mc.GetConnection(conn[i], out bus_name, out op); string account = mc.GetAccountForConnection(op.ToString()); Console.WriteLine(MSG_PREFIX + "Account Name: {0}", conn[i]); Console.WriteLine(MSG_PREFIX + "Connection status: {0}", conn_status.ToString()); Console.WriteLine(MSG_PREFIX + "Object Path: {0}", op.ToString()); Console.WriteLine(MSG_PREFIX + "GetAccountForConnection: {0}", account); } McPresence presence = mc.GetPresence(); McPresence presence_actual = mc.GetPresenceActual(); string message = mc.GetPresenceMessage(); string message_actual = mc.GetPresenceMessageActual(); Console.WriteLine(MSG_PREFIX + "Presence Information"); Console.WriteLine(MSG_PREFIX + "Presence: {0}", presence.ToString()); Console.WriteLine(MSG_PREFIX + "Actual Presence: {0}", presence_actual.ToString()); Console.WriteLine(MSG_PREFIX + "Presence Message: {0}", message); Console.WriteLine(MSG_PREFIX + "Actual Presence Message: {0}", message_actual); mc.PresenceChanged += OnPresenceChanged; mc.AccountStatusChanged += OnAccountStatusChanged; Timer timer = new Timer(); timer.Interval = 30000; // hang around for 10 seconds to test signals timer.Elapsed += new ElapsedEventHandler(Disconnect); timer.Start(); while (running) { bus.Iterate(); } Console.WriteLine(MSG_PREFIX + "Testing complete."); }
private void OnAccountStatusChanged(McStatus status, McPresence presence, ConnectionStatusReason reason, string account_id) { Console.WriteLine(MSG_PREFIX + "OnAccountStatusChanged: status {0}, presence {1}, account {2}", status.ToString(), presence.ToString(), account_id); //System.Threading.Thread.Sleep (5000); for (long i = 0; i < 1000000000; i++) { } Console.WriteLine(MSG_PREFIX + "Done looping"); }
public void Initialize() { BusG.Init(); Application.Init(); // init GTK app for use of Glib mainloop IMissionControl mc = bus.GetObject <IMissionControl> (Constants.MISSIONCONTROL_IFACE, new ObjectPath(Constants.MISSIONCONTROL_PATH)); if (mc == null) { Console.WriteLine(MSG_PREFIX + "Unable to find MissonControl interface."); return; } string bus_name = null; ObjectPath op = null; McStatus status = mc.GetConnectionStatus(account); if (status == McStatus.Connected) { mc.GetConnection(account, out bus_name, out op); iconn = bus.GetObject <IConnection> (Constants.CONNMANAGER_GABBLE_IFACE, op); // get connection if (iconn == null) { running = false; } else { Console.WriteLine(MSG_PREFIX + "Got connection using account {0}, bus {1}, path {2}" , account, bus_name, op); //iconn.NewChannel += OnNewChannel; // deprecated as of 0.17.23 irequests = bus.GetObject <IRequests> (bus_name, op); irequests.NewChannels += OnNewChannels; irequests.ChannelClosed += OnChannelClosed; // don't really need this self_handle = iconn.SelfHandle; Console.WriteLine(MSG_PREFIX + "Your handle is {0}", self_handle); /* * SetTubeCapability (bus_name, op); // tell Telepathy about our special tube * string service = DTUBE_HANDLER_IFACE + "." + DTUBETEST_IFACE; * string service_path = DTUBE_HANDLER_PATH + DTUBETEST_PATH; * if (tube_partner == null) * ClaimTubeName (service, service_path); */ ProcessContacts(bus_name, op); if (transfer_partner_handle > 0) { SetupFileTransfer(); } else if (transfer_partner != null) { Console.WriteLine(MSG_PREFIX + "Our tube partner is missing. Quiting."); running = false; } } } if (running) { Application.Run(); // run Glib mainloop } Console.WriteLine(MSG_PREFIX + "Test complete."); }
public void Initialize() { BusG.Init(); Application.Init(); // init GTK app for use of Glib mainloop IMissionControl mc = bus.GetObject <IMissionControl> (Constants.MISSIONCONTROL_IFACE, new ObjectPath(Constants.MISSIONCONTROL_PATH)); if (mc == null) { Console.WriteLine(MSG_PREFIX + "Unable to find MissonControl interface."); return; } string bus_name = null; ObjectPath op = null; string[] online = mc.GetOnlineConnections(); McStatus status = McStatus.Disconnected; if (online.Length == 0) { Console.WriteLine(MSG_PREFIX + "There are 0 online connections."); } else { status = mc.GetConnectionStatus(account); } if (status == McStatus.Connected) { mc.GetConnection(account, out bus_name, out op); iconn = bus.GetObject <IConnection> (Constants.CONNMANAGER_GABBLE_IFACE, op); // get connection if (iconn == null) { running = false; } else { Console.WriteLine(MSG_PREFIX + "Got connection using account {0}, bus {1}, path {2}" , account, bus_name, op); //iconn.NewChannel += OnNewChannel; // deprecated as of 0.17.23 irequests = bus.GetObject <IRequests> (bus_name, op); irequests.NewChannels += OnNewChannels; irequests.ChannelClosed += OnChannelClosed; // don't really need this self_handle = iconn.SelfHandle; Console.WriteLine(MSG_PREFIX + "Your handle is {0}", self_handle); SetTubeCapability(bus_name, op); // tell Telepathy about our special tube string service = DTUBE_HANDLER_IFACE + "." + DTUBETEST_IFACE; string service_path = DTUBE_HANDLER_PATH + DTUBETEST_PATH; if (tube_partner == null) { ClaimTubeName(service, service_path); } ProcessContacts(bus_name, op); if (tube_partner_handle > 0) { SetupTube(); } else if (tube_partner != null) { Console.WriteLine(MSG_PREFIX + "Our tube partner is missing. Quitting."); running = false; } } } else { Console.WriteLine(MSG_PREFIX + account + " not connected."); Console.WriteLine(MSG_PREFIX + "will wait for a connection to test MC"); Console.WriteLine(MSG_PREFIX + "Press CTRL+C to quit."); mc.AccountStatusChanged += OnAccountStatusChanged; //running = false; } /* * while (running) { * bus.Iterate (); * if (dbus_conn != null) * dbus_conn.Iterate (); // loop private connection for tube * } */ if (running) { Application.Run(); // run Glib mainloop } if (tube_initiator > 0) { Cleanup(); } Console.WriteLine(MSG_PREFIX + "Test complete."); }
private void OnAccountStatusChanged(McStatus status, McPresence presence, ConnectionStatusReason reason, string account_id) { Console.WriteLine(MSG_PREFIX + "OnAccountStatusChanged: status {0}, presence {1}, reason {2}, " + "account_id {3}", status, presence, reason, account_id); }
private void OnAccountStatusChanged(McStatus status, McPresence presence, ConnectionStatusReason reason, string account_id) { Console.WriteLine (MSG_PREFIX + "OnAccountStatusChanged: status {0}, presence {1}, reason {2}, " + "account_id {3}", status, presence, reason, account_id); }