impromptu: pronounceable MUC names

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent db9b4230
Pipeline #4161 failed with stages
in 3 minutes and 19 seconds
......@@ -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)
......
#!/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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment