1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 23:07:44 +08:00
Commit Graph

296 Commits

Author SHA1 Message Date
Bartłomiej Dach
24d4f0372c Refactor link parsing regexes to use named groups
For the sake of readability, consistency and to make further changes
easier, introduce named groups (?<text>) and (?<url>) to all link
parsing regexes which have parts containing the desired link text
and (optionally) URL.

The introduction of the named groups additionally simplifies
handleMatches() and makes all calls to it consistent.
2019-09-04 00:06:52 +02:00
Bartłomiej Dach
a8f16503e2 Add backslash escaping to new link format
For users to be able to add square brackets inside of links using
the new format, the regular expression used for parsing those links
contained a balancing group, which can be used for matching pairs
of tokens (in this case, opening and closing brackets, in that order).
However, this means that users could not post links with unmatched
brackets inside of them (ie. ones that contain single brackets, or
a closing bracket and then an opening one). Allow for escaping opening
and closing brackets using the backslash character.

The change substitutes this old fragment of the regex in the display
text group:

    [^\[\]]*        // any character other than closing/opening bracket

for this one:

    (((?<=\\)[\[\]])|[^\[\]])*

The second pattern in the alternative remains the same; the first one
performs the escaping, as follows:

    (
        (?<=\\)     // positive lookbehind expression:
                    // this match will succeed, if the next expression
                    // is preceded by a single backslash
        [\[\]]      // either an opening or closing brace
    )

Since the entire display group is matched, unfortunately the lookbehind
expression does not actually strip the backslashes, so they are
manually stripped in handleMatches.

As demonstrated in the unit tests attached, this also allows balanced
brackets to be mixed with escaped ones.
2019-09-03 23:18:39 +02:00
Andrei Zavatski
015406f4d2 Fix link parser 2019-08-18 22:02:59 +03:00
Dan Balasescu
bb90a273ac
Merge branch 'master' into system-user-color 2019-08-08 19:02:24 +09:00
Dean Herbert
6d5a7041fd Move system user colour assignment to ensure consistency 2019-08-08 17:10:06 +09:00
Max Hübner
0bed3bfece formatting inspection 2 2019-08-08 09:02:09 +02:00
Max Hübner
bcd443a3aa remove /j 2019-08-08 08:56:52 +02:00
Max Hübner
ffb6794b4e formatting inspection 2019-08-06 16:11:13 +02:00
Max Hübner
2f5d23b354 add join command 2019-08-05 01:02:42 +02:00
Dean Herbert
4a25a84975 Fix DrawableChannel async flow 2019-06-20 23:01:39 +09:00
Dean Herbert
5bb8649f3b Remove unused property from chat message 2019-06-18 14:22:59 +09:00
Arphox
07e17518e9 Fix all "Maintainability" CodeFactor issues 2019-06-11 10:28:16 +02:00
LeNitrous
4e6d7137aa disallow current user from opening their own private channel 2019-06-03 17:25:19 +08:00
Dean Herbert
bc962bf8f0 Move TooltipText to OsuClickableContainer 2019-05-21 13:51:38 +09:00
Paul Teng
7adaa09263 Move tab channel class into tab item class 2019-05-12 06:31:11 -04:00
Paul Teng
d53fb9a5c8 Check against type instead of channel name 2019-05-12 06:11:16 -04:00
Paul Teng
6cf1ca288f
Do not try to join the Add-channel button 2019-05-11 19:13:48 -04:00
smoogipoo
d7c09e7dbd Merge remote-tracking branch 'origin/master' into fix-new-inspections
# Conflicts:
#	osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs
#	osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs
#	osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs
#	osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs
#	osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs
#	osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs
#	osu.Game/Graphics/OsuFont.cs
#	osu.Game/Online/API/Requests/Responses/APILegacyScoreInfo.cs
#	osu.Game/Overlays/Profile/Header/BadgeContainer.cs
#	osu.Game/Overlays/Profile/ProfileHeader.cs
#	osu.Game/Screens/Select/PlaySongSelect.cs
#	osu.Game/Skinning/LegacySkinDecoder.cs
2019-05-07 13:20:17 +09:00
smoogipoo
0bd35ab7bb Turn on warnings, resolve issues 2019-04-25 17:36:17 +09:00
Dean Herbert
612db31c38 Apply newline additions 2019-04-01 12:16:32 +09:00
Dean Herbert
26d53d06a9 Fix remaining issues 2019-02-28 13:31:40 +09:00
Dean Herbert
367bc53a06 Revert some more instances of 'e' variable names 2019-02-22 20:15:25 +09:00
smoogipoo
d8c55bc729 Adjust namespaces 2019-02-21 19:05:52 +09:00
smoogipoo
bca347427f Update with framework bindable changes 2019-02-21 18:56:34 +09:00
Dean Herbert
8617aaa2a7 Update licence header (and remove year) 2019-01-24 17:43:03 +09:00
Unknown
6eff79913b remove blank lines 2019-01-11 10:34:56 +01:00
Dean Herbert
f6018294b5 Update framework 2019-01-07 18:50:27 +09:00
smoogipoo
d4f5a8507c Exit from match screen on escape 2018-12-25 17:14:56 +09:00
Dean Herbert
396caae0a9 Remove redundant newline 2018-12-21 19:01:19 +09:00
Dean Herbert
81104f4803 Make standalone chat reuse more code from main chat overlay 2018-12-21 17:54:12 +09:00
smoogipoo
6a9b0a0ba3 Fix initial messages not being received 2018-12-21 14:02:36 +09:00
smoogipoo
6b6629e9fd Fix not posting to the correct channel 2018-12-21 14:02:29 +09:00
Dean Herbert
bc8b0485d8 Add textbox/posting support 2018-12-20 18:49:03 +09:00
Dean Herbert
65447d6f4a Add optional parameters to target messages at a specific channel 2018-12-20 17:01:08 +09:00
Dean Herbert
3a13899ce1 Add stand-alone chat component 2018-12-20 16:54:49 +09:00
Dean Herbert
ea4dce8454 Add a polling component model 2018-12-10 21:08:14 +09:00
Dean Herbert
2a2561e5c8 Update framework and otehr nuget packages 2018-12-07 19:39:54 +09:00
Dean Herbert
2f9de149dd Add constructor to create a PM channel from a User 2018-12-07 13:56:21 +09:00
smoogipoo
efdad3a3a7 Merge remote-tracking branch 'origin/master' into ChatManager_with_BindableCollection 2018-11-26 16:12:55 +09:00
smoogipoo
cadfe41f83 Merge remote-tracking branch 'origin/master' into external_link_warning 2018-11-23 15:19:52 +09:00
Dean Herbert
a144e97568 Fix crash on creating two new PM channels 2018-11-22 18:27:22 +09:00
smoogipoo
d1ec9fc294 Merge remote-tracking branch 'Joehuu/master' into fix-channel-presence 2018-11-22 13:04:32 +09:00
miterosan
4f41512265 Lowercase the references to joinedChannel and availableChannels 2018-11-21 23:21:27 +01:00
miterosan
21c9353fee Remove not used usings 2018-11-21 23:15:45 +01:00
miterosan
a14b6ac9df Replace ObservableCollection with BindableCollection 2018-11-21 23:15:44 +01:00
smoogipoo
39e9c61e24 OpenTK -> osuTK 2018-11-21 23:11:08 +01:00
Dean Herbert
2126cf0d9a Fix join process for PMs being incorrect 2018-11-21 20:44:41 +09:00
Dean Herbert
b31efb7bb9 Fix PM channel type 2018-11-21 20:34:36 +09:00
Dean Herbert
d677921680 Remove excess newline 2018-11-21 18:53:50 +09:00
Dean Herbert
7755242a43
Merge branch 'master' into osuTK 2018-11-21 18:53:11 +09:00
Dean Herbert
88f82eb722 Fix instabilities in channel join logic 2018-11-21 17:15:15 +09:00
Dean Herbert
4cde66240d Fix default channels not being joined 2018-11-21 17:15:15 +09:00
smoogipoo
ab2c969122 Add private channel types 2018-11-21 12:58:45 +09:00
smoogipoo
f27bd3ef3e OpenTK -> osuTK 2018-11-20 17:14:59 +09:00
Dean Herbert
23a446bab2 Add support for all channel types 2018-11-20 15:03:55 +09:00
Roman Kapustin
376e76e00d Resolve merge conflicts 2018-11-18 16:10:36 +03:00
Dean Herbert
9a9d5e60af More refactors 2018-11-14 13:59:02 +09:00
Dean Herbert
c4769f6802 Refactors 2018-11-14 13:19:51 +09:00
Dean Herbert
72ae22b0c4 Add support for creating new PM conversations 2018-11-13 17:24:11 +09:00
Dean Herbert
f241fcdba1 Add back support for new API and private messages 2018-11-13 15:20:59 +09:00
Dean Herbert
4b1282235a Merge remote-tracking branch 'upstream/master' into Private_Messages 2018-11-12 20:41:10 +09:00
Roman Kapustin
b4809f4417 External link warning code cleanup 2018-11-01 23:52:07 +03:00
Roman Kapustin
7401fabb5d Extract external link opening to the ExternalLinkOpener class 2018-10-23 23:03:00 +03:00
Dean Herbert
3cacc11af1 Fix outdated API variable 2018-09-28 19:33:30 +09:00
Dean Herbert
e1c187b641 Merge remote-tracking branch 'origin/update-chat-api' into update-framework 2018-09-28 18:23:09 +09:00
Dean Herbert
6a763334a1 Exit early as safety when no messages are received 2018-09-28 10:00:40 +09:00
Dean Herbert
1b77d9fd05 Merge branch 'update-chat-api' into update-framework 2018-09-26 19:50:23 +09:00
Dean Herbert
1fd2782dd4 Fix loading spinner not disappearing on empty channels 2018-09-26 19:15:02 +09:00
smoogipoo
a8f156584b Update framework with positional/non-positional changes 2018-09-26 14:01:15 +09:00
Dean Herbert
7cd547a760 Update chat to work with new API version 2018-09-25 20:53:24 +09:00
Dean Herbert
3c8c7a0459 Move ChannelManager to OsuGame
There's no reason for it to exist at OsuGameBase
2018-09-14 13:31:25 +09:00
Dean Herbert
4341d258af Make readonly instead 2018-09-13 14:03:21 +09:00
Dean Herbert
0be3ba946f Fix system user attempting to show in profile overlay 2018-09-13 13:40:46 +09:00
miterosan
cc640893c2
Merge branch 'master' into Private_Messages 2018-08-04 00:33:46 +02:00
Dean Herbert
b4ef3dd4dd Add LocalMessage 2018-08-03 20:03:43 +09:00
miterosan
8c0bcb8e3c Fix drawable crash and lload the inital messages of newly joined channels 2018-07-29 21:40:43 +02:00
Dean Herbert
7b653fab17 Pass in lastMessageId instead of self referencing 2018-07-24 18:01:28 +02:00
Dean Herbert
6937cf27a7 Tidy up channel join logic 2018-07-24 17:51:20 +02:00
Dean Herbert
090d197b21 Remove unnecessary using 2018-07-24 17:35:08 +02:00
Dean Herbert
da730269a9 Formatting and ctor usage for required parameters 2018-07-24 15:25:47 +02:00
miterosan
42df0c974f Rename UserChannel to private channel. 2018-07-24 05:17:57 +02:00
miterosan
e769c15d28 Provide XML doc in Channel.cs and ChannelManager.cs and ChatTabControl.cs 2018-07-24 05:14:33 +02:00
miterosan
16db81e9b5 Extract the message hadling logic into IncomingMessagesHandler 2018-07-24 04:54:11 +02:00
miterosan
9a6d92bb22 Rename fetchMsgReq to fetchMessageReq in ChannelManager.cs 2018-07-23 22:09:05 +02:00
Dean Herbert
1ab75529a1 Simplify user channel message population code 2018-07-23 21:15:52 +02:00
Dean Herbert
0aacde836a Move private channel constructor to own class 2018-07-23 20:46:44 +02:00
miterosan
8e93269885 Remove whitespace 2018-07-09 22:47:01 +02:00
miterosan
3140b2e15c Fix duplicate messages appearing 2018-07-09 22:14:21 +02:00
miterosan
290b6e5f1d Fix the crash in the visual testcase 2018-07-09 22:09:27 +02:00
miterosan
ec914a5095 Fix crash when the local echo is send to the wrong channel. 2018-07-09 21:00:39 +02:00
miterosan
f681ef41ac Rename MAX_HISTORY to MaxHistory, added some logging on failures, use a lamda in ChatOverlay instead of a method pointer. 2018-07-09 20:39:16 +02:00
miterosan
16d3815a59 Clean Channel up and reword two comments 2018-07-09 18:58:33 +02:00
miterosan
4b638db475 Reorder the properties and fields on Channel.
Make MAX_HISTORY because cause can not be public.
2018-07-09 18:52:28 +02:00
miterosan
263e68de91 Use a custom channel not found exception. 2018-07-09 18:45:11 +02:00
miterosan
29e8c70ed7 Only use one tabControl (channeltabcontrol). Fix that the Channel messages did not refresh. 2018-04-18 20:46:42 +02:00
miterosan
142e1b8587 update the line endings 2018-04-14 13:32:48 +02:00
miterosan
5bfb386226 Merge remote-tracking branch 'origin/master' into Private_Messages 2018-04-14 13:31:03 +02:00
miterosan
1b51da70af Create an abstraction for APIMessagesRequest 2018-04-14 13:23:16 +02:00
Dean Herbert
32a74f95a5 Normalize all the line endings 2018-04-13 18:26:38 +09:00
miterosan
e39f5a1adf Rename var chatmanager -> channelManager
Apply requested changes
2018-04-12 23:19:13 +02:00