trigg / Rebuttal

GNU General Public License v3.0
3 stars 2 forks source link

Server plugin event system #86

Closed trigg closed 3 years ago

trigg commented 3 years ago

A rudimentary event system needs to be included for server plugins.

events so far: serverstart ()-> Just befpre port is opened and server starts serverstop ()-> After main loop ends. No guarantee this will be reached on every run. connectionnew ()-> New user connected, before authentication connectionclose ()-> Connection to user has closed. Authenticated or not userfailedauth ()-> new connection gave incorrect authentication information userauth (name, uuid)-> User has successfully authenticated userquit (name, uuid)-> User has disconnected. userjoinroom (name, uuid, roomname, roomuuid)-> User has joined a voice & video room userleaveroom (name, uuid, roomname, roomuuid)-> User has left a voice & video room usercreate (name, uuid)-> User created on server userdelete (name, uuid)-> User deleted from server userchangename (oldname, newname, uuid)-> User name changed usercontextmenucallback (name, uuid, callbackid)-> User has chosen a GUI context menu item. messagesend (name, uuid, roomname, roomuuid, message)-> User sent a message messagecreate (roomname, roomuuid, message)-> A new message has been made to a text room. Differs from above as plugins inserting non-user based messages will only trigger this not 'messagesend'. messagechange (roomname, roomuuid, oldmessage, newmessage)-> Message contents changed. Note that message deletion is just a change. pluginprep (pluginname, reference) -> called just before each plugin is start()ed pluginstart (pluginname, reference) -> called just after each plugin is start()ed

Known events should be kept in a list on server, Plugins are allowed to register new events to use internally or in unison with other plugins and any attempt at listening for an event that doesn't exist MUST be dealt with explicitly or throw an error.

Feel free to suggest other events!