IRC3 with more Lua features#1087
IRC3 with more Lua features#1087itsTheFae merged 64 commits intoMudlet:developmentfrom itsTheFae:feature-Irc3-WithMoreLua
Conversation
This retains the primary functions of the old IRC client but adds many more new IRC commands by default. The UI is slightly more organized and interactive now.
Input History stores a total of 8 previously entered commands the user can cycle through using the Up Arrow key. The previously include /msg command has been added again. Colors of some messages have been updated for (relatively) easier distinction of message lines.
This changes the way IRC windows are managed by mapping IRC to a host profile. If no profile is loaded the IRC Client does not open. When a Client gets messages it only posts those messages to its profile rather than to all profiles. IRC Client windows are closed when their profile is closed.
Adds a new tab for IRC related settings in Profile Preferences, settings UI. Adds a new method Host::readProfileData(item); similar to its write* method. Static methods are used to read and write IRC settings. Removes references to mIrcNick in Host.h and mudlet.h which weren't used.
All client commands are available to the sendIrc() function. Added new function ircGetConnectedHost() to get the hostname of the server the client is connected to after the server tells the client its name.
I have no idea what i'm doing wrong and don't understand how to do it right. Including these changes in hopes that it lightens the work load on someone else anyways.
Things needed to fix CMake builds: - communi CMake builds needed `include_directories` explicitly specified - more MOC calls in communi - more explicit dependencies to MOC files in communi - ircmessageformatter must be compiled into mudlet
Merged CMake fixes.
Somehow the new default is to put in even more empty fields into the file :|
Making use of the C++11 raw string literals feature to have more readable code.
* Fixed the welcome message to show again It didn't before because default_host profile directory was getting created on the disk before the check. * Made it so a random profile gets selected for a first-time launch * Modernized mudlet::startAutoLogin function * Renamed poorly-named method to open connections dialog It also was confusing with Host::connectToServer doing the actual connecting * Made the connection dialog open if no profiles are on autoload * Removed superseded status bar notification The connection dialog now opens automatically. * Improved first-launch Mudlet size and positioning Mudlet is now centered and has a decent size for the most common resolutions * Fix connection dialog to get a decent size by default * Updated the welcome text It was pretty ancient and referenced outdated button names. Also cut down on the wording so a new user isn't hit with a wall of text. * Moved icon over to left so the screen isn't so busy * Undid hardcoded fonts and sizes in connection dialog User-selected desktop fonts and sizes should be used instead. * Fixed connection dialog to actually select the last played profile There was a bug where it would ignore predefined profiles in the calculation. Also use the last modified, not read date - a lot of things like virus scanners could read the directory whereas far fewer things will write to it. * Moved 'loaded profile' warning to be below profiles This prevents the whole thing from jumping around. * Added a margin to the right for aesthetic reasons * Revised to use getDescription as a method * Got tooltips to show on profile icons
Enables: tempKey(mudlet.key.F8, [[echo'hi']]) tempKey(mudlet.keymodifier.Control, mudlet.key.F8, [[echo'hello']]) killKey(keyID)
#1024) * Removed a bool for waiting on compression, removed a lot of un-needed code for MCCP, also tested farely well. -MH
…1069) * BugFix: multiple issues with TKey creation from lua script commands Bug fixes for issue(s) raised in: #1068 * in TLuaInterpreter::permKey(...) corrected luaL_typename(...) calls to refer to correct argument instead of hard-coded 1. * in TLuaInterpreter::permKey(...) and tempKey(...) corrected tests for strings for optional third and required fourth to be the number ones as that is what we want them to be interpreted as; edited the type error message to match; revised the error message to the keyModifier argument to refere to it as optional as it is! * in TLuaInterpreter::tempKey(...) forced the error message generation to no longer be subject to potential translation efforts following the decision already implemented elsewhere in the class NOT to I18n these texts. * in TLuaInterpreter::permKey(...) and tempKey(...) added missing argument number from error messages for cases where the number is a run-time variable rather than a compile time constant. * in TLuaInterpreter::permKey(...) corrected the swap of keyModifier and keyCode in the call to TLuaIntepreter::startPermKey(...) * in TLuaInterpreter::tempKey(...) refactored the luaScript variable to be a QString all the way through and to explicitly retrieve it from the Lua sub-system as UTF-8 text with a QString::fromUtf8(...) call whereas the previous std::string::c_str() as an argument to a plain QString() constructor will fail in the future if/when the QT_NO_CAST_FROM_ASCII macro is #define-d. * Fix nil not being recognised as missing optional
* Added mudletOlderThan Makes it easy to write if mudletOlderThan(3,2) then return end
|
I don't think it's a Qt 5.6 issue because clang builds with the same 5.6 right there just fine. The only other variable then is the GCC version, which is outdated in Travis - @itsTheFae would be using a newer one. So I suspect this issue would be resolved by #1098 as soon as it is approved by anybody... |
src/dlgIRC.cpp
Outdated
| setupUi(this); | ||
| setWindowTitle(tr("%1 - Mudlet IRC Client").arg(mpHost->getName())); | ||
| setWindowIcon(QIcon(QStringLiteral(":/icons/mudlet_irc.png"))); | ||
| setWindowIcon(QIcon(QLatin1String(":/icons/mudlet_irc.png"))); |
There was a problem hiding this comment.
QIcon doesn't have a QLatin1String overload - only QIcon(const QString &fileName) - and so QStringLiteral should be used instead because that creates a QString at compile-time.
Did you get the idea from https://github.com/Mudlet/Mudlet/blob/development/CONTRIBUTING.md#use-qlatin1string-over-qstringliteral-if-possible ? That's what it is trying to say but perhaps it is unclear.
There was a problem hiding this comment.
Basically, only use QLatin1String if the function actually takes it and you don't need utf8 - like int QXmlAttributes::index(QLatin1String qName) con actually does.
There was a problem hiding this comment.
Yea I did. It didn't seem to print out any errors or warnings so I thought it worked. haha.
There was a problem hiding this comment.
It'll work because it'll create a new QString() at runtime instead, basically defeating the efficiency.
vadi2
left a comment
There was a problem hiding this comment.
💯 awesome work on this. Just need to fix-up the cases of QLatin1String() supplied to functions that don't take them.
There was a problem hiding this comment.
Other than the Seg Fault without that tweak I suggest, this is looking good - it and the IRC server handles the corner case where you cancel out of the initial connections dialog without starting a session and then fire up the IRC on the default host before connecting on a profile which has the same IRC NickName - and when you have two profiles with the same NickName (which IRC cannot allow) - the second one gets a numeric suffix appended but it looked like it was a Server Nick "collision" resolution as the rename was not stored locally as a new Nick after that happened!
So, as long as we have not got something causing Seg Faults on even an occasional basis, this could be there.
| { | ||
| QPointer<dlgIRC> dlg = new dlgIRC(pHost); | ||
| dlg->setDefaultHostClient(isDefaultHost); | ||
| mpIrcClientMap[pHost] = dlg; |
There was a problem hiding this comment.
🤔 I am not SURE but I have a suspicion that you might need:
mpIrcClientMap[pHost] = dlg.data();
here - I cannot remember the exact details why - which is frustrating - but I has a crash in this area when I tried to to fire up a second IRC session for a second profile... but didn't when I added the .data() however one run is not conclusive proof... and I'd welcome others testing they can start a separate IRC session on separate Host instances (i.e. in a multi-playing situation).
There was a problem hiding this comment.
I forgot to update the calls in TLuaInterpreter.cpp which was likely the culprit of the crash.
There was a problem hiding this comment.
Ah - that does seem to have cured it - mayhaps I had the wrong end of the stick with using QPointer::data() as it seems Okay now with out it... 🙂
SlySven
left a comment
There was a problem hiding this comment.
The 3rdparty/communi/src/core/core.pri and 3rdparty/communi/src/core/core.pri files need correction.
3rdparty/communi/src/util/util.pri
Outdated
| PUB_HEADERS += $$INCDIR/ircutil.h | ||
|
|
||
| PRIV_HEADERS = $$INCDIR/irccommandparser_p.h | ||
| PRIV_HEADERS = $$INCDIR/irccommandqueue_p.h |
There was a problem hiding this comment.
🐞 the missing '+' from before the = seems to be causing Makefile issues about duplicate "recipes" as qmake tries to generate things from the files that get "lost" when an assignment is done instead of a concatenation:
04:44:40: Running steps for project src...
04:44:40: Configuration unchanged, skipping qmake step.
04:44:40: Starting: "/usr/bin/make" -k -j 5
/opt/Qt/5.9/gcc_64/bin/qmake -o Makefile ../src/src.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
Project MESSAGE: mudlet will be installed to /usr/local/bin...
Project MESSAGE: Lua files will be installed to /usr/local/share/mudlet/lua...
Project MESSAGE: Geyser lua files will be installed to /usr/local/share/mudlet/lua/geyser...
Makefile:2339: warning: overriding recipe for target 'moc_irc.cpp'
Makefile:1898: warning: ignoring old recipe for target 'moc_irc.cpp'
Makefile:2392: warning: overriding recipe for target 'moc_irccommand.cpp'
Makefile:1951: warning: ignoring old recipe for target 'moc_irccommand.cpp'
Makefile:2469: warning: overriding recipe for target 'moc_ircconnection.cpp'
Makefile:2028: warning: ignoring old recipe for target 'moc_ircconnection.cpp'
Makefile:2539: warning: overriding recipe for target 'moc_ircmessage.cpp'
Makefile:2098: warning: ignoring old recipe for target 'moc_ircmessage.cpp'
Makefile:2592: warning: overriding recipe for target 'moc_ircnetwork.cpp'
Makefile:2151: warning: ignoring old recipe for target 'moc_ircnetwork.cpp'
Makefile:2671: warning: overriding recipe for target 'moc_ircprotocol.cpp'
Makefile:2230: warning: ignoring old recipe for target 'moc_ircprotocol.cpp'
make: Nothing to be done for 'first'.
04:44:44: The process "/usr/bin/make" exited normally.
04:44:44: Elapsed time: 00:04.
These error messages seem to originate in 3rdparty/communi/src/core/core.pri although that has not been modified in this PR but has the same issue - I've tracked those back to be73caa "Upgrade IRC library to: Communi 3.5.0 (#942)" which creates the other problem file.
There was a problem hiding this comment.
These files like the directory implies are part of the upstream communi library - any changes to them should be filed with upstream as well, otherwise we'd have to maintain out local patches to them.
|
The first C.I. build out of the six failed but I think it was just a system issue - I have kicked that build back in to life - hopefully it will succeed now! |
|
Thanks for all the testing and feedback on this! :D |
Changes IRC client to run with settings given per-profile, making the IRC client more visible and configurable within Lua. This adds configuration options to the settings window in the "Special Options" tab for configuring an IRC client on the host profile which opens the settings window. See the PR summary comment for details on available Lua functions and IRC Client commands.
* Removed duplicate clear event handlers call * Revert back to dev version. 3.3 here we go! * Adds saveWindowLayout() call to AutoSaveOnExit processing. * Edbee editor implementation (#985) * Added a frame to edbee so it looks nicer * Got utf8 module to load (#1074) (update packaging!) * Modified tooltip for Save and Save Profile to clearly indicate their keyboard shortcuts * Added: shortcut for delete action in editor (#1084) * shortcut added for delete action * Removed redundant edbee config related code (#1091) * Delete TScriptEditorManager.h * Delete TScriptEditorManager.cpp * BugFix: import some fixes by "Zolder" from Mudlet (Realms of Legends) fork import: some Zoilder fixes from the MudletRL fork: * in TBuffer::translateToPlainText(...): make some MXP related code execute only if Host::mFORCE_MXP_NEGOTIATION_OFF is NOT set as well as another condition. * in TBuffer::wrap(...): change a for(...) {...} loop termination condition be a "<" rather than a "<=" test - which sounds like an "off-by-one" error fix-up. * In TTextEdit:updateScreenView(): revise code that seems to prevent the width of a "main" console being set too small and NOT written to the "parent" Host::mScreenWidth variable - the original modification removed such a restriction completely, but I have just lowered the minimum from 100 to 40 and ensured it is always stored both in the local "main" console and to the parent record in the Host class for that console. * In TTextEdit::drawForeground(...): revise the behaviour *I think* when at the point where a console "split" becomes unnecessary... Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Cut down on the length of some variable names (#1086) * Clarified use of QLatin1String * Adding GCC 5 for C++14 requirement (#1098) * Fixed "reset map colors" button to work (#1049) * Fixed "reset map colors" button to work That's a 5 year old bug out of the way! * Change travis configuration to use installed gcc-5 (#1108) * Change travis configuration to use installed gcc-5 * Fixes #1104 (#1109) Thanks to Rick for his prompt response on this * Fixed typo in GeyserLabel.lua Per #1112 * Fix locale to C Enforce uniform locale so scripts don't get tripped up on number representation differences (. vs ,) * IRC client update of UI and logic (#1072) * Add Communi Model & Util libs * Full refactor of IRC Client code & UI This retains the primary functions of the old IRC client but adds many more new IRC commands by default. The UI is slightly more organized and interactive now. * Adds QPointer to IRC Dialog pointer variable. * Update Lua `sendIrc()` slightly. * Added /msg command, Input History, and updated display colors. Input History stores a total of 8 previously entered commands the user can cycle through using the Up Arrow key. The previously include /msg command has been added again. Colors of some messages have been updated for (relatively) easier distinction of message lines. * Updated channel handling. * Fix CMake builds Things needed to fix CMake builds: - communi CMake builds needed `include_directories` explicitly specified - more MOC calls in communi - more explicit dependencies to MOC files in communi - ircmessageformatter must be compiled into mudlet * IRC3 with more Lua features (#1087) Changes IRC client to run with settings given per-profile, making the IRC client more visible and configurable within Lua. This adds configuration options to the settings window in the "Special Options" tab for configuring an IRC client on the host profile which opens the settings window. See the PR summary comment for details on available Lua functions and IRC Client commands. * Add a Code of Conduct (#1110) * Create CODE_OF_CONDUCT.md * Fix for the QMake warnings caused by the IRC library includes. * Finished formatting all filed & added braces (#1115) * Finished formatting all filed & added braces * Re-enabled map load on profile load (#1118) * Re-enabled map load on profile load - disabling it broke scripts that relied on map data w/o the map open * updated assignments. * Event-based gamepad functionality (#1106) * Add theme switching to code editor (#1095) * Fix more Toolbar & Button bugs (#1080) (#1090) * Fix bugs with Buttons & Toolbars. - Fixed change detection for location, orienation, and CSS data. - Buttons are not rendered unless they are part of a group, Toolbar/Menu. - ToolBars whos locations are changed now hide their previous TToolBar or TEasyButtonBar instance as needed. * Fix Buttons being left behind when parent toolbar is deleted. Also allows TAction to use QPointer<T> * Update old sourceforge page links (#1132) (#1134) * Fixed blank command separator to not separate as people expect * Replaced isTempKey, isTempAlias, etc with isTemporary (#1102) * also pushed isFolder() and setIsFolder() to the parent Tree class * Give meaning to encodings (#1107) * Delete dev_README Deleted outdated dev_README file. It also didn't seem to be used all that often, else people would have raised the fact that it's outdated... * Update travis to use Qt 5.9 for compiling (#1141) * Re-add single QT 5.6 build job Since we want to keep sure that the minimal Qt version is still compilable (currently we need at least 5.6), we add a single job for that version. * Refactor: rename QMake project/sub-project files (#1103) * refactor: rename QMake project/sub-project files It is down right confusing having several project files in the Qt IDE which are all labelled "src" - this commit renames the main project file from "src.pro" to "mudlet.pro" and also renames: * the lua_yajl module from src.pri to lua_yajl.pri * the luazip module from src.pri to luazip.pri it also: * adds a new communi.pri file (see below) I also took the liberty of renaming the project resource file from: * mudlet_alpha.qrc to mudlet.qrc (we are well past the alpha stage now!) and sorting a couple of items into the right order. By creating a local project file 3rdparty/communi/communi.pri it is possible to group the three separate but related communi libraries into one - as it happens the effective content of the new file is identical to that of the communi libraries own libcommuni/src/src.pri but it has some notes on how the portion of the upstream library that we are using was picked out of there; how to identify the effect version and how to (hopefully) recreate things if upstream gets revised in the future! By not using the upstream "src.pri"/"src.pro" files we avoid the confusion of having a generic "src" project in the Mudlet project as a whole and it is clearly identify-able as a file from the Mudlet project rather than the sub-project that it pulls into the whole thing... There is an minor nuisance side-effect in that having the main project src.pro file open in a Qt Creator IDE or stored in a session will get confused when this commit takes effect as the file will disappear from the repository - it will be necessary to close the project and open the new src/mudlet.pro project file (and possibly re-enter the build steps) - OTOH the main project will now be identified as "mudlet" in Creator rather than the previous "src". 😄 Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Removed accidental debug echo left in (#1151) * initialize int nIrcPort with dlgIRC::DefaultHostPort value. (#1153) * Removes false from sendIrc() return, ignores command filtering status (#1154) * Removes false from sendIrc() return, ignores command filtering status (not used). * Remove punctuation from lua messages * Improved layout of IRC preferences (#1152) * Fix get map events (#1120) * Adapt addMapEvent error messages to current standard * Fix getMapEvents() The function now returns a proper indexed table of objects that each describe a map event. * Add missing call to set Editor as editable. (#1159) * Fixed tab indent to be two spaces again * Fixed getComputerEncoding in case no key found It'll now return the original value passed - it's way better than returning the wrong value. * Add linux ci deployment (#1128) * Modify files needed for CI deployment of linux builds * Syntax fix in .travis.yml * tar the CI AppImages as well * Add lua sqlite runtime dependency * Unset LD variable for linuxdeployqt * Bugfix: unset LD_LIBRARY_PATH in every codepath * Test: install appmenu-qt5 for global menus * Revert 781ef97 (Install appmenu-qt5) The issue was that the first AppImage used Qt 5.6.2 instead of Qt 5.9 (which is how 3.2 was built and how it is build now after merging development in) * Remove manager again (#1163) * Improved map load output to be condensed down if it's all successful (#1117) OK! Would be happy to see that in as well for maps that take a while to load (>1s). * Re-enable search highlighting (#1096) * Remove mainwindow statusbar (#1162) * Replaced statustips with tooltips in the mapper menu * Removed statusbar * Tagging 3.3.0 * Initial QTextToSpeech additions * Further TTS additions and bugfixes * Wrapping TTS functions in #ifdefs for QT_TTS_LIB * Missing #ifdefs * More misplaced #ifdef lines for TTS functions * More QT_TTS_LIB ifs * Adding QTextToSpeech to cmake lists * Various TTS updates * Adding GetState to TLuaInterpreter.h * Minor fixes * Tts temporary fixes * Exchanging toLatin1 with toUtf8 * Fix cmake TTS module includesion * Install Qt 5.9 TTS module on linux * Use Qt provided definition for enabled modules We don't need (and possibly don't want) to provide our own definition for when a module is enabled. Let's use the Qt provided definition instead. * Output confirmation messages of enabled Qt modules * Use upper case "Gamepad" in output * ttsClearQueue crash fix * Fix for global speech events * Whitespace replacement * Various minor fixes * More minor fixes. * Cleanup: make CMakeList.txt have uniform indenting and adjust CMake message The minimum versions of the Qt TextToSpeech and Gamepad reported in the CMake project files needed tweaking. I have also tried to regularise the indentation in the Mudlet CMake project files to standardise on 2 spaces. Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Reformat: clean up code-loyout of new TTS TLuaInterpreter code Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * BugFix: fixup a switch() in (int) TLuaInterpreter::ttsGetState(lua_State*) This switch was missing "break;" on all the cases and must have been defective without them - for all but the last case extra strings would have been pushed onto the lua stack but as the return value was 1 they may have been discarded... Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Enable Qt 5.9 Windows builds for testing * Deploy Qt 5.9 builds for testing * Fixing double-events for queueing purposes * Added missing symbol * Added missing symbol * Updating tts events to globals and adding voice * Create TTSValues.lua * Adding TTSValues to LuaGlobal * Adding TTSValues to Mudlet project * Update CMakeLists.txt * Update TTSValues.lua * Update Qt to 5.10 for trusty This is needed to hopefully have some TTS backend plugins in Linux * Queueing and crash fixes * Renaming tts funcs * Renaming internal functions * Adding functions for retrieving settings * Fixing typo * Making ttsGetState public * Improve error messages for ttsGetCurrentLine() It can be incredibly frustrating to just get a boolean back as an error message when you don't know what is going on * Update error message to be consistent with the new style * Aligned error messages to be consistent with the new style * Fix ttsClearQueue to return nil+error, not actually error on invalid index * Minor code formatting * Floats to doubles * Update documentation links
This PR adds further improvements to the IRC client updates made in PR #1072.
These additions focus primarily on enabling configuration of the IRC Client connection details and expanding the Lua API to better interface with the IRC client.
Lua Changes
true+statusif message could be sent or was successfully processed by the client, ornil+errorif the client is not ready for sending, andfalse+statusif the client filtered the message or failed to send it for some reason. target should be a Nick or Channel name and if omitted will default to the first available channel in the list of joined channels. message can be empty but empty messages will not be sent to the server. If the IRC client hasn't started yet, this function will initiate the IRC client and begin a connection.message strings may contain IRC client commands which start with
/and can use all commands which are available through the client window.New Lua Functions
true+hostwherehostis a string containing the host name of the IRC server, as given to the client by the server while starting the IRC connection. If the client has not yet started or finished connecting this will returnfalseand an empty string.restartIrc()restartIrc()restartIrc()Available IRC Commands
Custom Client Commands
ircRestart()in Lua.