aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/util.vala
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala/src/module/util.vala')
-rw-r--r--xmpp-vala/src/module/util.vala36
1 files changed, 13 insertions, 23 deletions
diff --git a/xmpp-vala/src/module/util.vala b/xmpp-vala/src/module/util.vala
index e42c4768..1043dee1 100644
--- a/xmpp-vala/src/module/util.vala
+++ b/xmpp-vala/src/module/util.vala
@@ -1,32 +1,22 @@
using Gee;
namespace Xmpp {
- public string get_bare_jid(string jid) {
- return jid.split("/")[0];
- }
-
- public bool is_bare_jid(string jid) {
- return !jid.contains("/");
- }
-
- public string? get_resource_part(string jid) {
- return jid.split("/")[1];
- }
- public string random_uuid() {
- uint32 b1 = Random.next_int();
- uint16 b2 = (uint16)Random.next_int();
- uint16 b3 = (uint16)(Random.next_int() | 0x4000u) & ~0xb000u;
- uint16 b4 = (uint16)(Random.next_int() | 0x8000u) & ~0x4000u;
- uint16 b5_1 = (uint16)Random.next_int();
- uint32 b5_2 = Random.next_int();
- return "%08x-%04x-%04x-%04x-%04x%08x".printf(b1, b2, b3, b4, b5_1, b5_2);
- }
+public string random_uuid() {
+ uint32 b1 = Random.next_int();
+ uint16 b2 = (uint16)Random.next_int();
+ uint16 b3 = (uint16)(Random.next_int() | 0x4000u) & ~0xb000u;
+ uint16 b4 = (uint16)(Random.next_int() | 0x8000u) & ~0x4000u;
+ uint16 b5_1 = (uint16)Random.next_int();
+ uint32 b5_2 = Random.next_int();
+ return "%08x-%04x-%04x-%04x-%04x%08x".printf(b1, b2, b3, b4, b5_1, b5_2);
+}
public abstract class StanzaListener<T> : Object {
public abstract string action_group { get; }
public abstract string[] after_actions { get; }
- public abstract async void run(Core.XmppStream stream, T stanza);
+
+ public abstract async void run(XmppStream stream, T stanza);
}
public class StanzaListenerHolder<T> : Object {
@@ -42,14 +32,14 @@ public class StanzaListenerHolder<T> : Object {
resort_list();
}
- public async void run(Core.XmppStream stream, T stanza) {
+ public async void run(XmppStream stream, T stanza) {
foreach (StanzaListener<T> l in listeners) {
yield l.run(stream, stanza);
}
}
private bool set_contains_action(Gee.List<StanzaListener<T>> s, string[] actions) {
- foreach(StanzaListener<T> l in s) {
+ foreach (StanzaListener<T> l in s) {
if (l.action_group in actions) {
return true;
}