summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2016-04-22Mark file-transfer notice as read when chat window is activatedTobias Markmann
Applied some foreach modernization in process. Test-Information: Tested by sending files between two Swift instances and verifying the new behavior works as expected. Tested on OS X 10.11.4 with Qt 5.4.2. Change-Id: Ie3f9c2126d946d9041b08be98a19cbfb468871f3
2016-04-14Fix bug of /me commands not being shown as actionsTobias Markmann
Test-Information: Added a test case that verifies this behavior. This test case succeeded before the refactoring in 74e5131 and now succeeds again. Tested Swift UI 1-to-1 and MUC messages with /me commands. Tested on OS X 10.11.4 with open-source clang. Change-Id: I270a0b4e2ddc595919646bddcc5e1f27074c9e1f
2016-04-05Migrate to Boost.Signals2 from Boost.SignalsTobias Markmann
Boost.Signals was deprecated and is not improved further. This patch removes Boost.Signals from 3rdParty and adds Boost.Signals2 and its dependencies. Also removed the Qt signals compatibility file Swiften/Base/boost_bsignals.h. Test-Information: Build and ran unit tests on OS X 10.11.4. Confirmed successful login using Swift client. Change-Id: Ie6e3b2d15aac2462cda95401582f5287a479fb54
2016-04-04Modernize code to use C++11 shared_ptr instead of Boost'sTobias Markmann
This change was done by applying the following 'gsed' replacement calls to all source files: 's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g' 's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g' 's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g' 's/boost::make_shared/std::make_shared/g' 's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g' 's/boost::shared_ptr/std::shared_ptr/g' 's/boost::weak_ptr/std::weak_ptr/g' 's/boost::enable_shared_from_this/std::enable_shared_from_this/g' The remaining issues have been fixed manually. Test-Information: Code builds on OS X 10.11.4 and unit tests pass. Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
2016-04-01Modernize code to use C++11 nullptr using clang-tidyTobias Markmann
Run 'clang-tidy -fix -checks=modernize-use-nullptr' on all source code files on OS X. This does not modernize platform specific code on Linux and Windows Test-Information: Code builds and unit tests pass on OS X 10.11.4. Change-Id: Ic43ffeb1b76c1a933a55af03db3c54977f5f60dd
2016-03-31Convert tabs to 4 spaces for all source filesTobias Markmann
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
2016-03-30Apply consistent #include grouping and sorting styleTobias Markmann
Changed "" style includes to <> style. Test-Information: Build with Clang 3.9.0 and ran all tests on OS X 10.11.4. Change-Id: Ic05e53f2e5dba39cc1307b116fc5f17b62ab9eb8
2016-03-29Refactored keyword highlightingTobias Markmann
This commit changes the ChatWindow/ChatView APIs to not pass highlights actions as additional parameters but instead they are now part of the ChatWindow::ChatMessage and its parts. This allows the controllers to do highlighting in one single place and play sound actions on the highlighted message in a single place. On a highlighted message only unique sounds are played and they are played in sequence of the rules that matched the message. Test-Information: Adjusted the existing unit tests accordingly. Added unit tests that check reduplication of highlight action sounds and that the sound actions are emitted correctly. Manually verified that highlight sound actions with and without duplicated sounds are audible on OS X 10.11.3. Change-Id: I68c88e0d285d79d87b2997ed29d92b140480b394
2016-02-15Disable file-transfers to MUC PM contactsswift-3.0rc3Tobias Markmann
Currently the file-transfers to MUC PM contacts fail because the from JID does not match the initiator JID. The initiator JID is always the real client JID at the moment. Disabling file-transfer for MUC PM contacts provides a better UX for now. Test-Information: Tested file-transfer to normal contacts still works. Tested file-transfers to MUC PMs do not start. Change-Id: If5f59eb313a25ca919393f497a57fd339eb17e3e
2016-02-15Fix file-transfer UI replace after presence change glitchTobias Markmann
Forgot to reset the lastWasPresence_ flag when file-transfer UI is added to a chat view. The flag is used to amend the existing presence change log in a chat view in case of consecutive presence changes. Test-Information: Transfer a file to a Swift user and go offline afterwards. Without this patch the file-transfer UI is replaced by a presence change message. With this patch a new presence change message is added instead. Change-Id: I54a5cfd398bd4ba79eb15a1b14b08db3377233a4
2016-02-02Change stanza body to boost::optional<std::string> typeTobias Markmann
Changed MUCController to only handle message stanzas as subject change if <subject/> is present and neither <body/> nor <thread/> is present in the message stanza. Test-Information: Added unit tests verifying behavior described in XEP-0045 section 8.1. Unit tests pass on OS X 10.11.2. Change-Id: I1d22272da1675176be131ab360b214a98f20533f
2016-02-01Fix MUC nickname change error in ChatControllerTobias Markmann
ChatControllers used to wrongly lookup the nickname of a MUC PM contact using the bare room JID after a nickname change. With this change, the new full JID, i.e. with the new nickname as resource part, is used for nickname lookup. Test-Information: Tested with multiple PM chats open in a room. Both PM contacts changing their nicknames. Now only the corresponding chat tab changes its title. Before both used to change their title on a change of a single occupants nickname. ./scons test=system passes on OS X 10.11.3. Change-Id: I1c274498bcd96edd3370f73cb824fc81d726682c
2016-01-22Add missing Timer related cleanup codeTobias Markmann
This commit adds explicit code to stop timers which are connected to objects that are about to be deleted from memory. Test-Information: ./scons test=system passes on OS X 10.11.3. Change-Id: I139314f3a223e3dc63b78b96be17d3ae53cd3de3
2016-01-19Reset impromptu support flag when logging offTobias Markmann
Test-Information: Added unit test verifying the expected behavior. It passes on OS X 10.11.2. Change-Id: I7531e313bf03dbea276f133db042ce26e6da4a53
2015-12-17Do not consult presence oracle for MUC PM presenceTobias Markmann
Test-Information: Added unit test verifying the behavior. Verified with multiple Swift instances in a MUC room that for MUC PMs only the same full JID presence counts. Change-Id: I08148221be34c3548f18da634586c828fd60feff
2015-12-17Remove superfluous member in ChatsManagerTobias Markmann
Added missing signal disconnects in UserSearchController. Test-Information: All unit tests pass. Change-Id: I13fba64d40f7999c3d2196ad2917ff22392f72b3
2015-11-06Making virtual calls in constructor of ChatControllers explicitTobias Markmann
Virtual calls in ctors/dtors are tricky as it is not clear what method is going to be called. By changing the code to call the explicit method it is obvious. This issue was raised by Clang Analyzer. This commit also adds missing SWIFTEN_OVERRIDE annotations. Test-Information: Still compiles, tests pass and Clang Analyzer warning so gone. Change-Id: I8096994277ad32933f992b9a11079c761d3ec619
2015-11-06Make methods non-virtual that are not overridden by subclassTobias Markmann
These cases have been uncovered by Clang Analyzer as they were called during some constructor. However, there is no reason for them being virtual. They are never overridden in a derived class. Test-Information: Unit tests still pass on OS X 10.10.5. Change-Id: I90b5396a0dba971d9150c35f9107733f7f4637cd
2015-10-30Change bare JID presence lookup code to ignore prioritiesTobias Markmann
Before presence handling code was handled by both, the ContactRosterItem in Swift and the PresenceOracle in Swiften. The ContactRosterItem also considered the presence priority for deciding what presence to show for a bare JID. With this code all full or bare JID presence requests are finally handled by the PresenceOracle. For bare JIDs it is looked up to a presence of one of the available resources of that JID regardless of the priorities. Test-Information: Adjusted tests according to above description and documentation in PresenceOracle. Change-Id: I972a4574f476cdf4d4b5593a035eb1c25ef2f8ba
2015-10-16Mark removed contacts as unavailable in SwiftTobias Markmann
When removing a contact, a XMPP client will not receive an explicit unavailable presence stanza for the contact from the server. Because of that Swift used to show removed contacts still with their old presence in the Chats tab or the chat view. With this patch, the PresenceOracle will flush all known presence of a contact as soon as the JID is removed from the roster. An unavailable presence will stored under the removed bare JID and is emitted via the PresenceOracle::onPresenceChange signal. Test-Information: Added a unit test verifying this behavior. Tested the behavior with two scenarios: a) Account A and B adding each other and accepting the subscription request. Starting a chat between A and B. After removing B in A's account, B used to be shown as available in the chat view and the Chats tab. With this patch B is shown as unavailable. b) Account A and B adding each other and accepting the subscription request. A removing B, and B removing A. After A adds B again, B used to be shown with the old presence even before B accepted the subscription request. This behavior is also fixed with this patch, not showing B as online until B accepted the subscription request. Change-Id: Iba97d3bedd0ac962ea00b25a0d2ed6106ed55a55
2015-10-16Require a node-part for JIDs entered in 'Add contact…'-dialogTobias Markmann
While it is possible to add domain only JIDs to a user's roster this is rarely the intention of a user. This patch adds the requirement of a node-part for the address entered in the dialog and presents a warning if the node-part is missing. Test-Information: Verified that a warning triangle is shown if there is no node-part in the user entered address. Change-Id: I38dd0b34ca7cb19b38bb7e1c457f7a8a9ef84028
2015-10-16Add additional unit tests for Chat <-> JID bindingTobias Markmann
The recent commit 582ca91 changed the behavior the binding between chat sessions and the full JID of a chat contact. This commit adds additional unit tests verifying the behavior of implemented in 582ca91. This means a chat session binds to the full JID of an incoming message only if the message has a non-empty body text or is a 'typing' chat state notification. It also tests the rebind to another resource if a 'typing'-CSN or a body message is received from that resource. Test-Information: All unit tests pass on OS X 10.10.5. Change-Id: Id3f25d8a3ff78c407ed4b2a97bd421dc4aa58688
2015-10-15Only bind full JID to ChatController on non-empty or typing messagesTobias Markmann
With this commit a ChatController is only bound to a full JID of a contact, if the incoming message of the contact has a non-empty body or is a 'typing' chat state notification. This avoids random binding to an arbitrary resource of a contact, that has multiple online resources and responds with delivery receipts. Test-Information: Tested with a conversation of a one resource account (A) to a two resource account (B). Sending two messages to B, the first used to go to both resources, then A would bind to the full JID and the second message would only go to one resource. With this fix all messages go to both resources, i.e. are send to the bare JID, until one resource of B replies. This binds the controller at A to the full JID of the reply of B. Change-Id: I8d9321a4226ab798e1196351ad087990d5dff8c3
2015-09-18Show potentially existing MUC bookmark in chat window bookmark dialogTobias Markmann
The MUC bookmark editor window opened from the chat window would always show a new bookmark. With this commit it will show the existing bookmark if it exists. Otherwise it will show a new bookmark. Test-Information: Tested this behavior by creating a bookmark, changing name and nickname to different values and verified that the bookmark dialog for this room, opened from its chat view, would show the existing bookmark. Change-Id: I6766253ce11be271016473dff1105369482e73df
2015-08-11Fix broken bookmarks context menu after reconnectTobias Markmann
Test-Information: Tested that the bookmarks context menu still works after an offline/online cycle. Change-Id: I9248b7405a6a09bc813c6590e0f2f9a4ed92acb3
2015-07-27Remember directory services used when searching for usersTobias Markmann
Test-Information: Tested by searching at some services and checked that they are present in the combo box after a Swift restart. Change-Id: Ia30d932f20447f44e458af3b32a38665872da025
2015-07-10Create notice events for incoming file-transfersTobias Markmann
Test-Information: Send a file from one Swift instance to another. The UX is similar to that of a MUC invite, clicking the notice will bring the relevant chat in front. Change-Id: Ief3cd7371ae01b2b38b6d1af36189df961eacef4
2015-07-07Remove partial remains of commented out codeTobias Markmann
Test-Information: Not applicable. Change-Id: I1620be8361c1b70b365011ac7f0ec6ac11dbe76f
2015-07-07Add ability to enter rooms when offlineTobias Markmann
Rooms in the recent chats list and bookmarks can be entered by double click if the user is offline. They are joined when the user goes online again. Test-Information: Tested by going offline via the presence menu and then entering rooms via recent chats and bookmarks. Change-Id: I8c3eadd29c3353c2cf5f04f53b71ef7ad67a5c05
2015-06-14Execute sound actions if requested and if text is highlightedTobias Markmann
HighlightRule did not consider keywords in its isMatch() routine. MUCController only triggered possible HighlightActions if it was a direct 1-to-1 MUC message or an impromptu chat message. Both issues are fixed. Additionally fixed the HighlightRuleTest. It had some wrong assertions related to rules being case insensitive by default and keywords match inside longer words by default. Test-Information: Tested with a highlight rule that highlights text and tested that sound actions are executed if the text is highlighted. Additionaly verified that other behaviour (own nick mentions, direct 1-to-1 messages) have their potential sound actions still executed. Change-Id: Ia922a1ff38c66f6458d28a18a8cdde10e821f83d
2015-04-10Introduce FeatureOracle class for contact feature support detectionTobias Markmann
This modifies the feature detection in the ChatController to try to use the common features of all available resources feature detection if no full JID has been bound to the chat yet. Test-Information: Tested with two Swift instances. Tested a) the initial chat start case and, b) the offline/online. In case a) Swift used to initally show a yellow warning about no support for message receipts. This warning is gone now. In case b), after a user gone offline and online again in a running chat, Swift used to show a warning about missing support for message receipts. This warning is gone now. Change-Id: I7a769fde8d14847b180503aeaa58280c572d81b3
2015-04-05Improve UX regarding room bookmark handlingTobias Markmann
Label the window for adding bookmarks as "Add Bookmark Details". Allow modification of bookmarks from the cog menu in the chat window and adjust the context menu item accordingly. Test-Information: Tested the bookmarks section of the "Chats" tab in the contact list and the UX scenario using the cog menu that it works as expected. Tested it on OS X 10.9.5 with Qt 5.4.1. Change-Id: I80daf339fc86506db3d863decae4bcd892e3ea88
2015-03-28Fix typo in ChatController regarding Message ReceiptsTobias Markmann
Test-Information: None. Change-Id: If02bc8bf250b129522bbeb841f699ccea9721422
2015-03-24Don't crash when the UI doesn't provide a user search windowKevin Smith
Change-Id: I9c8692e0c4f36877591385a7580cb8a2107bd68f
2015-02-17Fix terminology: 'join room' -> 'enter room'Tobias Markmann
Test-Information: None. Change-Id: I022a65c64e73e1ae70ee21673fa5cce7afbe51a6
2015-02-16Show a warning notice when trying to enter a blocked roomTobias Markmann
When the user tries to enter a blocked room, we now show a warning notice and describing how the room can be unblocked. Swift will not send the joining presence when trying to enter a blocked room. Test-Information: Tested on Mac OS X 10.9.5 against a popular open source server and its MUC and Blocking Command implementation. Change-Id: I875db056f21f97845c5a9a43167b0f2a16bdaa36
2015-02-11Do not try highlight words if no text and background colours are specifiedTobias Markmann
The tests have been adjusted so a colour is set in their highlight actions. Test-Information: Tested with a "own nick" highlight rule with a "No highlight" action and one with highlights colours set. The cases now work as expected. Added a unit test that checks that no highlighting happens when no colour is specified. Change-Id: Ied48d8c2e033531c1b0532348b9380e1bd884b44
2015-02-09Fix sender text that is used for matching highlight rulesTobias Markmann
Old behavior: MUC group messages are matched against the nickname as sender. MUC 1-to-1 messages and classic 1-to-1 messages are matched against the display name as sender. New behavior: MUC group messages are matched against the nickname as sender. MUC 1-to-1 messages are matched against the nickname as sender. Classic 1-to-1 messages are matched against the bare JID as sender. Test-Information: Tested on Mac OS X 10.9.5 that a chat rule matching a nickname string and a rule matching a full JID are highlighted correctly. Change-Id: Icaee2c946e34fceb6b1d40561674030740555de1
2015-02-05Correctly render MUC system messages as system messagesTobias Markmann
Messages received from a MUC bare JID in a MUC have been rendered as user messages in the past. They are now rendered as system messages. Test-Information: Tested with a MUC component that sends a bare message on login. Change-Id: I9a548ec9b81db8ba329182e08446d72c3518c7cb
2015-02-03Fix chat log system messages related to entering a roomTobias Markmann
In the past MUCController added a "trying to enter..." message and later tried to replace this with "entered room as..." message. However, any message received in between, like a system message about room topic, came in between since MUCController replaced the *last* message added to the log. The new code also adds message IDs to system messages. This way the correct message can be replaced on successful login, no matter how many messages came in between. Test-Information: Tested against a MUC component that send a system message before sending the join presence back to a user. Change-Id: I3bcb5d78de680494965d837b2ad3edb847ff7f99
2014-12-15Update Copyright in SwiftKevin Smith
Change-Id: Idb6ef5fa191b1465c0bf46c47e63b695de07fa0b
2014-10-31Enable unblocking contacts from cog menu.Tobias Markmann
Renamed ChatWindow::setInputEnabled to ChatWindow::setOnline. Moved some input return key disabling logic into QtChatWindow. Test-Information: Tested in Swift, blocking a contact and unblokcing it from cog menu. Return still does not do anything on blocked contacts or when offline. Change-Id: I42faffb8618598fcc7c0bd44148902ea7028258e
2014-10-30Prevent user from adding contacts twice to a roster.Tobias Markmann
This removes roster JIDs from the suggesting in the 'Add User'-dialog. In addition, an indication is added when a manually entered JID is invalid or already on the roster. Test-Information: Tested scenarios with recent JIDs and JIDs from the roster. Tested that 'Start Chat'-dialog suggestions still work. Change-Id: I1ff51637adb4224184b78a1af9090a04b1e18fff
2014-10-28Only handle impromptu MUC invites once.Tobias Markmann
Added missing return-statement after handling the conversion from 1-to-1 to MUC. This lead to an additional tab being opened. In addition the indentation of the relevant block was wrong and is fixed now. Test-Information: Before there was a reproducible scenario: test@A starts to chat with test2@A. toast@A is on test@A's roster, but not on test2@A's roster. test@A drops toast@A on the running chat between test@A and test2@A. test@A and test2@A end up with the chat converted into a MUC. toast@A automatically joins the MUC. test2@A additionally has a new tab. Now test2@A does not have the additional tab anymore. Only the MUC tab which previously was a 1-to-1 tab. Change-Id: I32045812952c840f0f9c6da3a9aecf5c63797b64
2014-10-23Fix code in response to clang warnings.Tobias Markmann
Removes some unused private members and restructure switch statement to handle all cases. Test-Information: Fixed code does not emit the clang warnings anymore. Change-Id: I06a9036b307014e2f882e3cee45a6881b24c3f70
2014-10-17Disable online only actions when offline.Tobias Markmann
Disabling action, menu items and drag 'n' drop which require an online connection when the user is offline. Test-Information: Checked by going offline and checking the relevant actions and menu items. Change-Id: Iacfa2c9f815d3b9bbad9ca4c2d0d04f95ce9a9e4
2014-10-17Implement support for displaying nickname changes.Tobias Markmann
This implements Swiften API for changing nicknames in MUC and correctly detecting nick name changes. In addition Swift now displays nickname changes as such and not as join/leave of a user. In addition, handling of nickname changes is integrated in ChatsManager and ChatControllers so that they are forwarded to PM chats of MUCs. Test-Information: Added unit tests for change of own nickname and nickname changes of others. Tested correct detection of nickname changes in a MUC with a Psi user changing its nickname and Swift correctly detecting and displaying it. Change-Id: I3287ba6ceeccd3be5cfb591acd6f88bffc9a43b2
2014-10-08Prevent multiple chat window alerts being shown with the same message.Richard Maudsley
Test-Information: Enable message delivery receipts, check that only a single alert is displayed for repeated messages. Change-Id: Ifb9f8bd74e592147745f95678f94c21563d301a5
2014-10-06Do not send chat state notifications to blocked contacts.Tobias Markmann
Test-Information: Started a chat session; then blocked the contact. Previously chat state notifications were send when typing. Now they are not send anymore. Change-Id: Id68f3faee4829e99cbfe1535f48346a8c27712d3
2014-10-03Suggest MUC occupants when typing in highlight editor JID boxRichard Maudsley
Test-Information: Join several MUCs and confirm that MUC occupants are suggested along with recent contacts. Confirm that clicking or pressing return adds the selected contact to the edit field. Check that QtSuggestingJIDInput in Start Chat dialog still functions as before, and that MUC users are not suggested here. Change-Id: Ieadc95d55c764e1fa48c949cca4d5e0aa5f19615