massive refactoring to switch from camelCase to snake_case:
historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a pre-PEP8 code, to use the same coding style as in Twisted. However, snake_case is more readable and it's better to follow PEP8 best practices, so it has been decided to move on full snake_case. Because Libervia has a huge codebase, this ended with a ugly mix of camelCase and snake_case. To fix that, this patch does a big refactoring by renaming every function and method (including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case. This is a massive change, and may result in some bugs.
This commit is contained in:
parent
d50412c7f7
commit
6a6f15707a
1 changed files with 9945 additions and 9945 deletions
|
|
@ -86,18 +86,18 @@ class XEP_0249(object):
|
|||
def __init__(self, host):
|
||||
log.info(_("Plugin XEP_0249 initialization"))
|
||||
self.host = host
|
||||
host.memory.updateParams(self.params)
|
||||
host.bridge.addMethod(
|
||||
"inviteMUC", ".plugin", in_sign="ssa{ss}s", out_sign="", method=self._invite
|
||||
host.memory.update_params(self.params)
|
||||
host.bridge.add_method(
|
||||
"muc_invite", ".plugin", in_sign="ssa{ss}s", out_sign="", method=self._invite
|
||||
)
|
||||
try:
|
||||
self.host.plugins[C.TEXT_CMDS].registerTextCommands(self)
|
||||
self.host.plugins[C.TEXT_CMDS].register_text_commands(self)
|
||||
except KeyError:
|
||||
log.info(_("Text commands not available"))
|
||||
host.registerNamespace('x-conference', NS_X_CONFERENCE)
|
||||
host.trigger.add("messageReceived", self._messageReceivedTrigger)
|
||||
host.register_namespace('x-conference', NS_X_CONFERENCE)
|
||||
host.trigger.add("messageReceived", self._message_received_trigger)
|
||||
|
||||
def getHandler(self, client):
|
||||
def get_handler(self, client):
|
||||
return XEP_0249_handler()
|
||||
|
||||
def _invite(self, guest_jid_s, room_jid_s, options, profile_key):
|
||||
|
|
@ -109,7 +109,7 @@ class XEP_0249(object):
|
|||
@param profile_key: %(doc_profile_key)s
|
||||
"""
|
||||
# TODO: check parameters validity
|
||||
client = self.host.getClient(profile_key)
|
||||
client = self.host.get_client(profile_key)
|
||||
self.invite(client, jid.JID(guest_jid_s), jid.JID(room_jid_s, options))
|
||||
|
||||
def invite(self, client, guest, room, options={}):
|
||||
|
|
@ -136,7 +136,7 @@ class XEP_0249(object):
|
|||
|
||||
@param room (jid.JID): JID of the room
|
||||
"""
|
||||
client = self.host.getClient(profile_key)
|
||||
client = self.host.get_client(profile_key)
|
||||
log.info(
|
||||
_("Invitation accepted for room %(room)s [%(profile)s]")
|
||||
% {"room": room_jid.userhost(), "profile": client.profile}
|
||||
|
|
@ -146,7 +146,7 @@ class XEP_0249(object):
|
|||
)
|
||||
return d
|
||||
|
||||
def _messageReceivedTrigger(self, client, message_elt, post_treat):
|
||||
def _message_received_trigger(self, client, message_elt, post_treat):
|
||||
"""Check if a direct invitation is in the message, and handle it"""
|
||||
x_elt = next(message_elt.elements(NS_X_CONFERENCE, 'x'), None)
|
||||
if x_elt is None:
|
||||
|
|
@ -165,7 +165,7 @@ class XEP_0249(object):
|
|||
from_jid_s = message_elt["from"]
|
||||
room_jid = jid.JID(room_jid_s)
|
||||
try:
|
||||
self.host.plugins["XEP-0045"].checkRoomJoined(client, room_jid)
|
||||
self.host.plugins["XEP-0045"].check_room_joined(client, room_jid)
|
||||
except exceptions.NotFound:
|
||||
pass
|
||||
else:
|
||||
|
|
@ -174,7 +174,7 @@ class XEP_0249(object):
|
|||
)
|
||||
return
|
||||
|
||||
autojoin = self.host.memory.getParamA(
|
||||
autojoin = self.host.memory.param_get_a(
|
||||
AUTOJOIN_NAME, AUTOJOIN_KEY, profile_key=client.profile
|
||||
)
|
||||
|
||||
|
|
@ -186,14 +186,14 @@ class XEP_0249(object):
|
|||
"declined according to your personal settings."
|
||||
) % {"user": from_jid_s, "room": room_jid_s}
|
||||
title = D_("MUC invitation")
|
||||
xml_tools.quickNote(self.host, client, msg, title, C.XMLUI_DATA_LVL_INFO)
|
||||
xml_tools.quick_note(self.host, client, msg, title, C.XMLUI_DATA_LVL_INFO)
|
||||
else: # leave the default value here
|
||||
confirm_msg = D_(
|
||||
"You have been invited by %(user)s to join the room %(room)s. "
|
||||
"Do you accept?"
|
||||
) % {"user": from_jid_s, "room": room_jid_s}
|
||||
confirm_title = D_("MUC invitation")
|
||||
d = xml_tools.deferConfirm(
|
||||
d = xml_tools.defer_confirm(
|
||||
self.host, confirm_msg, confirm_title, profile=client.profile
|
||||
)
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ class XEP_0249(object):
|
|||
"You must provide a valid JID to invite, like in '/invite "
|
||||
"contact@{host}'"
|
||||
).format(host=my_host)
|
||||
self.host.plugins[C.TEXT_CMDS].feedBack(client, feedback, mess_data)
|
||||
self.host.plugins[C.TEXT_CMDS].feed_back(client, feedback, mess_data)
|
||||
return False
|
||||
if not contact_jid.user:
|
||||
contact_jid.user, contact_jid.host = contact_jid.host, my_host
|
||||
|
|
|
|||
Loading…
Reference in a new issue