summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poezio/core/core.py3
-rw-r--r--poezio/utils.py21
2 files changed, 23 insertions, 1 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py
index ffdd11d1..17e352de 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -42,6 +42,7 @@ from poezio import events
from poezio import theming
from poezio import timed_events
from poezio import windows
+from poezio import utils
from poezio.bookmarks import (
BookmarkList,
@@ -1005,7 +1006,7 @@ class Core:
return
nick = self.own_nick
- localpart = uuid.uuid4().hex
+ localpart = utils.pronounceable()
room_str = '{!s}@{!s}'.format(localpart, default_muc)
try:
room = JID(room_str)
diff --git a/poezio/utils.py b/poezio/utils.py
new file mode 100644
index 00000000..124d2002
--- /dev/null
+++ b/poezio/utils.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+"""
+ Utilities
+"""
+
+from random import choice
+
+VOWELS = 'aiueo'
+CONSONANTS = 'bcdfghjklmnpqrstvwxz'
+
+
+def pronounceable(length: int = 6) -> str:
+ """Generates a pronounceable name"""
+ out = ''
+ vowels = choice((True, False))
+ for _ in range(0, length):
+ out += choice(VOWELS if vowels else CONSONANTS)
+ vowels = not vowels
+ return out