~tardypad/wee-most

88a3f88abe70dc78a2ebe07a56ad744b78797265 — Damien Tardy-Panis 3 months ago 4b867e8
Always put a space before =
2 files changed, 52 insertions(+), 52 deletions(-)

M wee_most/config.py
M wee_most/server.py
M wee_most/config.py => wee_most/config.py +48 -48
@@ 12,82 12,82 @@ class PluginConfig:

    general_settings = [
        Setting(
            name= 'autoconnect',
            default= '',
            description= 'Comma separated list of server names to automatically connect to at start',
            name = 'autoconnect',
            default = '',
            description = 'Comma separated list of server names to automatically connect to at start',
        ),
        Setting(
            name= 'bot_suffix',
            default= ' [BOT]',
            description= 'The suffix for bot names',
            name = 'bot_suffix',
            default = ' [BOT]',
            description = 'The suffix for bot names',
        ),
        Setting(
            name= 'channel_prefix_direct',
            default= '',
            description= 'The prefix of buffer names for direct messages channels',
            name = 'channel_prefix_direct',
            default = '',
            description = 'The prefix of buffer names for direct messages channels',
        ),
        Setting(
            name= 'channel_prefix_group',
            default= '&',
            description= 'The prefix of buffer names for group channels',
            name = 'channel_prefix_group',
            default = '&',
            description = 'The prefix of buffer names for group channels',
        ),
        Setting(
            name= 'channel_prefix_private',
            default= '%',
            description= 'The prefix of buffer names for private channels',
            name = 'channel_prefix_private',
            default = '%',
            description = 'The prefix of buffer names for private channels',
        ),
        Setting(
            name= 'channel_prefix_public',
            default= '#',
            description= 'The prefix of buffer names for public channels',
            name = 'channel_prefix_public',
            default = '#',
            description = 'The prefix of buffer names for public channels',
        ),
        Setting(
            name= 'color_bot_suffix',
            default= 'darkgray',
            description= 'Color for the bot suffix in message attachments',
            name = 'color_bot_suffix',
            default = 'darkgray',
            description = 'Color for the bot suffix in message attachments',
        ),
        Setting(
            name= 'color_deleted',
            default= 'red',
            description= 'Color for deleted messages',
            name = 'color_deleted',
            default = 'red',
            description = 'Color for deleted messages',
        ),
        Setting(
            name= 'color_parent_reply',
            default= 'lightgreen',
            description= 'Color for parent message of a reply',
            name = 'color_parent_reply',
            default = 'lightgreen',
            description = 'Color for parent message of a reply',
        ),
        Setting(
            name= 'color_quote',
            default= 'yellow',
            description= 'Color for quoted messages',
            name = 'color_quote',
            default = 'yellow',
            description = 'Color for quoted messages',
        ),
        Setting(
            name= 'download_location',
            default= download_dir + '/wee-most',
            description= 'Location for storing downloaded files',
            name = 'download_location',
            default = download_dir + '/wee-most',
            description = 'Location for storing downloaded files',
        ),
        Setting(
            name= 'channel_loading_indicator',
            default= '…',
            description= 'Indicator for channels being loaded with content',
            name = 'channel_loading_indicator',
            default = '…',
            description = 'Indicator for channels being loaded with content',
        ),
    ]

    server_settings = [
        Setting(
            name= 'url',
            default= '',
            description= 'URL of {} server',
            name = 'url',
            default = '',
            description = 'URL of {} server',
        ),
        Setting(
            name= 'password',
            default= '',
            description= 'Password for authentication to {} server',
            name = 'password',
            default = '',
            description = 'Password for authentication to {} server',
        ),
        Setting(
            name= 'username',
            default= '',
            description= 'Username for authentication to {} server',
            name = 'username',
            default = '',
            description = 'Username for authentication to {} server',
        ),
    ]



@@ 121,9 121,9 @@ class PluginConfig:
    def add_server_options(self, server_id):
        for s in self.server_settings:
            self._add_setting(self.Setting(
                name= "server." + server_id + "." + s.name,
                default= s.default,
                description= s.description.format(server_id),
                name = "server." + server_id + "." + s.name,
                default = s.default,
                description = s.description.format(server_id),
                ))

    def setup(self):

M wee_most/server.py => wee_most/server.py +4 -4
@@ 267,8 267,8 @@ def connect_server_cb(server_id, command, rc, out, err):
    me = User(**response)
    me.color = weechat.config_string(weechat.config_get("weechat.color.chat_nick_self"))

    server.token=token_search.group(1)
    server.me= me
    server.token = token_search.group(1)
    server.me = me

    try:
        worker = wee_most.websocket.Worker(server)


@@ 278,8 278,8 @@ def connect_server_cb(server_id, command, rc, out, err):

    reconnection_loop_hook = weechat.hook_timer(5 * 1000, 0, 0, "reconnection_loop_cb", server.id)

    server.worker= worker
    server.reconnection_loop_hook= reconnection_loop_hook
    server.worker = worker
    server.reconnection_loop_hook = reconnection_loop_hook

    weechat.prnt("", "Connected to " + server_id)