Commit graph libervia-backend/src/plugins/plugin_misc_text_commands.py
Author SHA1 Message Date
Goffi
97337202cb core, jp: component handling + client handling refactoring:
- SàT can now handle components
    - plugin have now a "modes" key in PLUGIN_INFO where they declare if they can be used with clients and or components. They default to be client only.
    - components are really similar to clients, but with some changes in behaviour:
        * component has "entry point", which is a special plugin with a componentStart method, which is called just after component is connected
        * trigger end with a different suffixes (e.g. profileConnected vs profileConnectedComponent), so a plugin which manage both clients and components can have different workflow
        * for clients, only triggers of plugins handling client mode are launched
        * for components, only triggers of plugins needed in dependencies are launched. They all must handle component mode.
        * component have a sendHistory attribute (False by default) which can be set to True to allow saving sent messages into history
        * for convenience, "client" is still used in method even if it can now be a component
        * a new "component" boolean attribute tells if we have a component or a client
        * components have to add themselve Message protocol
        * roster and presence protocols are not added for components
        * component default port is 5347 (which is Prosody's default port)
    - asyncCreateProfile has been renamed for profileCreate, both to follow new naming convention and to prepare the transition to fully asynchronous bridge
    - createProfile has a new "component" attribute. When used to create a component, it must be set to a component entry point
    - jp: added --component argument to profile/create
    - disconnect bridge method is now asynchronous, this way frontends can know when disconnection is finished
    - new PI_* constants for PLUGIN_INFO values (not used everywhere yet)
    - client/component connection workflow has been moved to their classes instead of being a host methods
    - host.messageSend is now client.sendMessage, and former client.sendMessage is now client.sendMessageData.
    - identities are now handled in client.identities list, so it can be updated dynamically by plugins (in the future, frontends should be able to update them too through bridge)
    - profileConnecting* profileConnected* profileDisconnected* and getHandler now all use client instead of profile
2017-02-12 17:55:43 +01:00
Goffi
115f5ae0e1 plugin otr: various improvments:
- messageSend trigger now use pre_xml_treatments so it doesn't block other triggers of higher priority
    - text commands now use a very high priority, as it is local command and should not be blocked in most of cases
    - new otrState signal, to send state change to frontends
    - history is not skipped anymore, a future option may change this behaviour
    - OTR trigger are skipped on groupchat messages
    - context_manager is now in client instead of being global to plugin
    - removed fixPotr as it is fixed upstream

note triggers should be improved for encryption methods, as skipping an encrypter may break security, but putting it in top priority may break nice features.

fix bug 170
2017-02-01 21:44:24 +01:00
Goffi
e744c29963 plugin text commands: added /whoami command which return current full jid 2017-01-05 20:29:19 +01:00
Goffi
eb1dd1d177 plugin XEP-0245: removed plugin XEP-0245:
at the end it adds complications to handle XEP-0245 in backend (because edge cases must be handled: info type with group chat, history when message is info but for a group chat, etc) while it's trivial to handle it in frontend.
    So /me detection is handled in QuickFrontend and cmd_me is back into plugin_misc_text_commands, it is the choice of the frontend to display or not the "/me" (for frontends based on QuickFrontend it remains automatic).
2016-08-28 21:00:53 +02:00
Goffi
04515e5013 plugin XEP-0045, quick_frontend + primitivus (chat): cleaning of XEP-0045 (first pass):
- bridge methods/signals now all start with "muc" to follow new convention
    - internal method use client instead of profile to follow new convention
    - removed excetpions from plugin XEP-0045 in favor of core.exceptions, NotReady added
    - cleaned/simplified several part of the code. checkClient removed as it is not needed anymore
    - self.clients map removed, muc data are now stored directly in client
    - getRoomEntityNick and getRoomNicksOfUsers are removed as they don't look sane.
        /!\ This break all room game plugins for the moment
    - use of uuid4 instead of uuid1 for getUniqueName, as host ID and current time are used for uuid1
2016-06-27 21:45:11 +02:00
Goffi
a7de473107 backend, frontends: message refactoring (huge commit):
/!\ several features are temporarily disabled, like notifications in frontends

next step in refactoring, with the following changes:
    - jp: updated jp message to follow changes in backend/bridge
    - jp: added --lang, --subject, --subject_lang, and --type options to jp message + fixed unicode handling for jid
    - quick_frontend (QuickApp, QuickChat):
        - follow backend changes
        - refactored chat, message are now handled in OrderedDict and uid are kept so they can be updated
        - Message and Occupant classes handle metadata, so frontend just have to display them
    - Primitivus (Chat):
        - follow backend/QuickFrontend changes
        - info & standard messages are handled in the same MessageWidget class
        - improved/simplified handling of messages, removed update() method
        - user joined/left messages are merged when next to each other
        - a separator is shown when message is received while widget is out of focus, so user can quickly see the new messages
        - affiliation/role are shown (in a basic way for now) in occupants panel
        - removed "/me" messages handling, as it will be done by a backend plugin
        - message language is displayed when available (only one language per message for now)
        - fixed :history and :search commands
    - core (constants): new constants for messages type, XML namespace, entity type
    - core: *Message methods renamed to follow new code sytle (e.g. sendMessageToBridge => messageSendToBridge)
    - core (messages handling): fixed handling of language
    - core (messages handling): mes_data['from'] and ['to'] are now jid.JID
    - core (core.xmpp): reorganised message methods, added getNick() method to client.roster
    - plugin text commands: fixed plugin and adapted to new messages behaviour. client is now used in arguments instead of profile
    - plugins: added information for cancellation reason in CancelError calls
    - plugin XEP-0045: various improvments, but this plugin still need work:
        - trigger is used to avoid message already handled by the plugin to be handled a second time
        - changed the way to handle history, the last message from DB is checked and we request only messages since this one, in seconds (thanks Poezio folks :))
        - subject reception is waited before sending the roomJoined signal, this way we are sure that everything including history is ready
        - cmd_* method now follow the new convention with client instead of profile
        - roomUserJoined and roomUserLeft messages are removed, the events are now handled with info message with a "ROOM_USER_JOINED" info subtype
    - probably other forgotten stuffs :p
2016-06-20 18:41:53 +02:00
Goffi
f12803fa65 backend, frontend: messages refactoring (huge commit, not finished):
/!\ database schema has been modified, do a backup before updating

    message have been refactored, here are the main changes:

    - languages are now handled
    - all messages have an uid (internal to SàT)
    - message updating is anticipated
    - subject is now first class
    - new naming scheme is used newMessage => messageNew, getHistory => historyGet, sendMessage => messageSend
    - minimal compatibility refactoring in quick_frontend/Primitivus, better refactoring should follow
    - threads handling
    - delayed messages are saved into history
    - info messages may also be saved in history (e.g. to keep track of people joining/leaving a room)
    - duplicate messages should be avoided
    - historyGet return messages in right order, no need to sort again
    - plugins have been updated to follow new features, some of them need to be reworked (e.g. OTR)
    - XEP-0203 (Delayed Delivery) is now fully handled in core, the plugin just handle disco and creation of a delay element
    - /!\ jp and Libervia are currently broken, as some features of Primitivus

    It has been put in one huge commit to avoid breaking messaging between changes.
    This is the main part of message refactoring, other commits will follow to take profit of the new features/behaviour.
2016-05-24 22:11:04 +02:00
Goffi
6bbcbaf522 use of /usr/bin/env instead of /usr/bin/python in shebang 2016-04-17 14:45:26 +02:00
Goffi
e56883c613 plugin text commands: fixed log in genericErrback which was raising an exception when something than StanzaError was received 2016-03-07 13:49:13 +01:00
Goffi
348be27934 copyright update 2016-01-03 16:28:30 +01:00
souliane
a6a967b2f0 complete the Exception's list when catching JID error:
- Twisted JID constructor raises not only jid.InvalidFormat but also RuntimeError and AttributeError
2015-12-15 13:30:47 +01:00
souliane
67ff77e5de massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions 2015-04-16 14:57:57 +02:00
Goffi
fbec02d396 2015 copyright dates update 2015-03-30 10:26:26 +02:00
Goffi
a820e07d8f plugin text commands: minor docstrings improvments 2015-03-19 14:38:02 +01:00
Goffi
9443b14c59 plugin text command, XEP-0045, XEP-0048, XEP-0249: removed feedBackWrongContext which is no more usefull with new _contextValid method 2015-03-19 14:30:08 +01:00
Goffi
b2bb3ed564 plugin text commands: added _contextValid method:
- _contextValid check if a method can be called in this context, according to docstring declaration
    - use it to parse results in /help command
    - use it avoid use of command in wrong context, and help message is sent in this case
2015-03-19 14:29:03 +01:00
Goffi
c4cd6fd5f3 plugin text commands: docstring parsing for commands, and better /help command:
- docstring are parsed according to http://wiki.goffi.org/wiki/Coding_style/en#Text_commands, a data dictionary is filled accordingly
    - /help command can now show detailed help for a specific command
2015-03-19 14:02:37 +01:00
Goffi
8ce5c1862b core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
/!\ not finished, everything is still instable !
    - bridge: DBus bridge has been modified to allow blocking call to be called in the same way as asynchronous calls
    - bridge: calls with a callback and no errback are now possible, default errback log the error
    - constants: removed hack to manage presence without OrderedDict, as an OrderedDict like class has been implemented in Libervia
    - core: getLastResource has been removed and replaced by getMainResource (there is a global better management of resources)
    - various style improvments: use of constants when possible, fixed variable overlaps, import of module instead of direct class import
    - frontends: printInfo and printMessage methods in (Quick)Chat are more generic (use of extra instead of timestamp)
    - frontends: bridge creation and option parsing (command line arguments) are now specified by the frontend in QuickApp __init__
    - frontends: ProfileManager manage a more complete plug sequence (some stuff formerly manage in contact_list have moved to ProfileManager)
    - quick_frontend (quick_widgets): QuickWidgetsManager is now iterable (all widgets are then returned), or can return an iterator on a specific class (return all widgets of this class) with getWidgets
    - frontends: tools.jid can now be used in Pyjamas, with some care
    - frontends (XMLUI): profile is now managed
    - core (memory): big improvment on entities cache management (and specially resource management)
    - core (params/exceptions): added PermissionError
    - various fixes and improvments, check diff for more details
2015-01-24 01:00:29 +01:00
Matteo Cypriani
71e29f5c44 misc: fixed some typos 2014-09-15 14:18:25 +02:00
Goffi
a20e3e2cb8 core: a new "info" type is used in newMessage for system messages (not comming from outside) 2014-09-05 19:29:30 +02:00
souliane
56ec86b8e5 plugin XEP-0045, text_commands: add some commands:
- handle generic failure in text_commands
    - fix command /leave and a logging message
    - add commands /kick /ban /affiliate
2014-06-23 15:42:56 +02:00
Goffi
87b3e413ee core (XMPP): sendMessage refactoring:
- better separation of message sending actions
    - use of more generic exceptions to hook the behaviour (SkipHistory and CancelError)
    - use of raise instead of return
    - use of failure.trap
2014-06-07 16:35:29 +02:00
Goffi
a3f460d391 plugin text commands: added /me command to avoid the need to escape the / 2014-05-15 19:51:53 +02:00
souliane
42b1b6c4ed plugins TEXT-COMMANDS, XEP-0045, XEP-0048, XEP-0249:
- give a feedback instead of sending the message when the command is invalid or used in a wrong context
    - add command /join for XEP-0249
2014-04-30 16:34:09 +02:00
Goffi
501bc92528 core: use of the new core.log module:
/!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
2014-04-19 19:19:19 +02:00
Goffi
90fc3d78e0 plugin text commands: commands are now sorted in /help 2014-03-24 15:18:53 +01:00
Goffi
b826dd7c10 plugin XEP-0045: added user information to /whois text command 2014-03-24 14:46:18 +01:00
Goffi
9ac686c0a9 plugin text-commands: fixed name conflicts management + plugin parrot: removed now done TODO 2014-03-24 13:49:37 +01:00
Goffi
8a52f6defa plugin text commands: refactoring, text now only contain main commands, and other plugin can add commands themselve:
- registerTextCommands can be called by a plugin in its __init__ method, it looks for methods starting with "cmd_" and register them as new commands
    - addWhoIsCb: add a callback to /whois command, the callback can complete whois informations
    - plugins parrot, XEP-0045 and XEP-0092 now manage their own commands
2014-03-24 10:57:15 +01:00
Goffi
93826f1ce8 core: sendMessageTrigger now manage pre and post treatments, which happen before or after XML generation 2014-03-22 15:34:05 +01:00
Goffi
bd3890a8f0 plugin text commands: refactoring:
- commands can now return a deferred
    - if commands return True, message is sent, else it is cancelled
    - the escape sequence is now '//' instead of '\/'
    - added software version to /whois command
2014-03-22 13:47:33 +01:00
Goffi
2ca6efd8cc dates update 2014-02-04 18:32:49 +01:00
Goffi
5a00dc9503 core: i18n refactoring:
- _() is no more installed in __builtin__
    - instead, there is a new sat.core.i18n module
    - added D_() method for deferred translation
    - languageSwitch method allow to dynamically change translation language
    - import gettext is tested against ImportError, and dummy methods are used when not available (mainly useful for Libervia)
2013-12-29 17:06:01 +01:00
Goffi
9d42c269db core: sendMessage's options parameter has been renamed to extra to be consistent with newMessage 2013-11-13 13:58:10 +01:00
Goffi
60f03a623e core: sendMessage triggers now use a treatments deferred;
- treaments deferred can be used by plugins to change XML elements before sending them, in a similar way as for newMessage
    - sendMessageXml trigger became useless, so it as been removed in favor of the new deferred
2013-11-13 13:57:36 +01:00
Goffi
1cd98e8dea fixed licences in docstrings (they are now in comments) 2013-03-08 00:36:22 +01:00
Goffi
f9ef9a4f4a plugin text commands: basic /whois command (just show jid so far) 2013-02-20 20:37:17 +01:00
Emmanuel Gil Peyrot
0dca274360 Fix pep8 support in src/plugins. 2013-01-18 17:55:35 +01:00
Emmanuel Gil Peyrot
88074cd284 Remove every old-style class. 2013-01-18 17:55:35 +01:00
Emmanuel Gil Peyrot
27b3592e16 Remove trailing whitespaces. 2013-01-18 17:55:34 +01:00
Goffi
def79e44cd dates update 2013-01-07 23:30:13 +01:00
Goffi
c2713681a3 plugin text commands: added /topic as a synonym of /title 2013-01-07 00:56:13 +01:00
Goffi
20815b3ec5 bridge: fixed D-Bus warning in frontend side of bridge 2012-11-01 19:52:59 +01:00
Goffi
225d3ac5f1 plugin text commands: added /parrot and /unparrot commands to use Parrot plugin
- /parrot command add parrot link between the current entity/room and the entity given as an argument (must be a valid jid)
    - similarly, /unparrot remove the 2 links between those entities.
    - Parrot is a new dependency of text commands
2012-10-21 19:46:08 +02:00
Goffi
9612fe6f75 plugin text commands: added _feedback method to send an answer to user 2012-10-21 13:37:15 +02:00
Goffi
72da42f762 reverted bad commit 2012-10-21 12:55:27 +02:00
Goffi
031bd3134f primitivus: fixed messages order in chat window 2012-10-21 12:03:29 +02:00
Goffi
8d34cacc1d plugin text commands: added /help command 2012-10-20 19:22:51 +02:00
Goffi
902045e174 plugin XEP-0045, plugin text commands: added '/title' command 2012-10-20 18:02:14 +02:00
Goffi
4225b694d0 plugin text commands: added /join command 2012-09-28 00:48:52 +02:00