aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/util.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-10 17:01:45 +0100
committerfiaxh <git@mx.ax.lt>2017-03-10 17:11:25 +0100
commit2fe8489d368a371aefbfbe66e74621a8df14cdc2 (patch)
tree4dec90236b28101383753ffe4a1c7a34b09b0208 /xmpp-vala/src/module/util.vala
parent7a1aa8c806a63cfd031c082524501e26d4a181ee (diff)
downloaddino-2fe8489d368a371aefbfbe66e74621a8df14cdc2.tar.gz
dino-2fe8489d368a371aefbfbe66e74621a8df14cdc2.zip
Rename vala-xmpp library to xmpp-vala
Diffstat (limited to 'xmpp-vala/src/module/util.vala')
-rw-r--r--xmpp-vala/src/module/util.vala21
1 files changed, 21 insertions, 0 deletions
diff --git a/xmpp-vala/src/module/util.vala b/xmpp-vala/src/module/util.vala
new file mode 100644
index 00000000..65a9b261
--- /dev/null
+++ b/xmpp-vala/src/module/util.vala
@@ -0,0 +1,21 @@
+namespace Xmpp {
+ string? get_bare_jid(string jid) {
+ return jid.split("/")[0];
+ }
+
+ bool is_bare_jid(string jid) {
+ return !jid.contains("/");
+ }
+
+ string? get_resource_part(string jid) {
+ return jid.split("/")[1];
+ }
+
+ public string random_uuid() {
+ uint8[] rand = new uint8[16];
+ char[] str = new char[37];
+ UUID.generate_random(rand);
+ UUID.unparse_upper(rand, str);
+ return (string) str;
+ }
+} \ No newline at end of file