├── .editorconfig
├── .git-blame-ignore-revs
├── .github
├── dependabot.yml
└── workflows
│ ├── main.yml
│ └── release.yml
├── .gitignore
├── .idea
└── .idea.CyclopsChat
│ └── .idea
│ ├── dictionaries
│ └── fried.xml
│ └── inspectionProfiles
│ └── Project_Default.xml
├── .run
└── Cyclops.MainApplication.run.xml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── Cyclops.Configuration
├── ConnectionConfig.cs
└── Cyclops.Configuration.csproj
├── Cyclops.Console
├── Composition
│ └── Module.cs
├── ConsoleWindow.xaml
├── ConsoleWindow.xaml.cs
├── Cyclops.Console.csproj
└── ViewModel
│ └── ConsoleViewModel.cs
├── Cyclops.Core.Resource
├── Avatars
│ ├── AvatarsManager.cs
│ └── ImageUtils.cs
├── ChatLogger.cs
├── ChatObjectsValidator.cs
├── Composition
│ └── Module.cs
├── Conference.cs
├── ConferenceMember.cs
├── ConferenceUserMessage.cs
├── Cyclops.Core.Resource.csproj
├── FileLogger.cs
├── Helpers
│ └── CommonUtility.cs
├── InternalObservableCollection.cs
├── IqCommonHandler.cs
├── JabberNetExtensions
│ └── JabberCommonHelper.cs
├── Properties
│ └── AssemblyInfo.cs
├── Security
│ └── TripleDesStringEncryptor.cs
├── Smiles
│ ├── Smile.cs
│ ├── SmilePack.cs
│ ├── SmilePackMeta.cs
│ ├── SmilesManager.cs
│ └── note.txt
└── UserSession.cs
├── Cyclops.Core
├── Avatars
│ └── IAvatarsManager.cs
├── CaptchaSystemMessage.cs
├── Composition
│ └── Module.cs
├── CustomEventArgs
│ ├── AuthenticationEventArgs.cs
│ ├── AvatarChangedEventArgs.cs
│ ├── BannedEventArgs.cs
│ ├── CaptchaEventArgs.cs
│ ├── ConferenceJoinErrorKind.cs
│ ├── ConferenceJoinEventArgs.cs
│ ├── ConferenceMemberEventArgs.cs
│ ├── ConferencesListEventArgs.cs
│ ├── ConnectionErrorKind.cs
│ ├── DisconnectEventArgs.cs
│ ├── ErrorEventArgs.cs
│ ├── KickedEventArgs.cs
│ ├── NickChangeEventArgs.cs
│ ├── OperationResult.cs
│ ├── RoleChangedEventArgs.cs
│ └── SubjectChangedEventArgs.cs
├── Cyclops.Core.csproj
├── Helpers
│ ├── CommonExtensions.cs
│ ├── EnumerableExtensions.cs
│ ├── ReflectionHelper.cs
│ ├── ResourceHelper.cs
│ └── TaskEx.cs
├── IChatLogger.cs
├── IChatObjectsValidator.cs
├── IConference.cs
├── IConferenceMember.cs
├── IConferenceMessage.cs
├── IDebugWindow.cs
├── ILogger.cs
├── IObservableCollection.cs
├── ISessionHolder.cs
├── ISynchronizeInvokeHolder.cs
├── IUserSession.cs
├── Modularity
│ ├── Bootstrapper.cs
│ ├── IModule.cs
│ ├── ModuleBase.cs
│ └── ServiceLocatorImpl.cs
├── NotifyPropertyChangedBase.cs
├── PrivateMessage.cs
├── Properties
│ ├── AssemblyInfo.Shared.cs
│ └── AssemblyInfo.cs
├── Resources
│ ├── ErrorMessageResources.Designer.cs
│ └── ErrorMessageResources.resx
├── Role.cs
├── Security
│ └── IStringEncryptor.cs
├── Smiles
│ ├── ISmile.cs
│ ├── ISmilePack.cs
│ ├── ISmilePackMeta.cs
│ ├── ISmilesManager.cs
│ └── note.txt
└── SystemConferenceMessage.cs
├── Cyclops.MainApplication.Localization
├── Common.Designer.cs
├── Common.resx
├── Common.ru-RU.resx
├── Conference.Designer.cs
├── Conference.resx
├── Conference.ru-RU.resx
├── ConferenceList.Designer.cs
├── ConferenceList.resx
├── ConferenceList.ru-RU.resx
├── ContextMenus.Designer.cs
├── ContextMenus.resx
├── ContextMenus.ru-RU.resx
├── Cyclops.MainApplication.Localization.csproj
├── Language.cs
├── LocalizationManager.cs
├── LocalizationResourceDictionary.xaml
├── Login.Designer.cs
├── Login.resx
├── Login.ru-RU.resx
├── Main.Designer.cs
├── Main.resx
├── Properties
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── ResourceWrapper.cs
├── Settings.Designer.cs
├── Settings.resx
├── Settings.ru-RU.resx
├── Vcard.Designer.cs
├── Vcard.resx
└── Vcard.ru-RU.resx
├── Cyclops.MainApplication.Options
├── Controls
│ ├── NamedSeparator.xaml
│ ├── NamedSeparator.xaml.cs
│ ├── Selector.xaml
│ ├── Selector.xaml.cs
│ ├── SoundPlayer.cs
│ ├── SoundSelector.xaml
│ └── SoundSelector.xaml.cs
├── Cyclops.MainApplication.Options.csproj
├── Helpers
│ └── Serializer.cs
├── Model
│ ├── ApplicationSettings.Common.cs
│ ├── ApplicationSettings.Interface.cs
│ ├── ApplicationSettings.Sounds.cs
│ ├── ApplicationSettings.Status.cs
│ └── ApplicationSettings.cs
├── Properties
│ ├── DesignTimeResources.xaml
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── connect.png
│ ├── info.png
│ ├── keyboard_key.png
│ ├── sound.png
│ ├── stop.png
│ ├── user1_time.png
│ ├── uses.png
│ ├── web.png
│ └── window_preferences.png
├── ValueConverters
│ └── Invertor.cs
├── View
│ ├── CommonSettings.xaml
│ ├── CommonSettings.xaml.cs
│ ├── HotkeysSettings.xaml
│ ├── HotkeysSettings.xaml.cs
│ ├── InterfaceSettings.xaml
│ ├── InterfaceSettings.xaml.cs
│ ├── SettingsView.xaml
│ ├── SettingsView.xaml.cs
│ ├── SoundsSettings.xaml
│ ├── SoundsSettings.xaml.cs
│ ├── StatusSettings.xaml
│ └── StatusSettings.xaml.cs
└── ViewModel
│ └── SettingsViewModel.cs
├── Cyclops.MainApplication
├── App.xaml
├── App.xaml.cs
├── AppIcon.ico
├── ApplicationContext.cs
├── ChatObjectFactory.cs
├── Composition
│ ├── Module.cs
│ └── SharpXmppClientModule.cs
├── Configuration
│ ├── Profile.cs
│ └── ProfileManager.cs
├── Controls
│ ├── AnimatedImage.cs
│ ├── ApplicationSounds.cs
│ ├── ChatFlowDocument.cs
│ ├── ChatScrollViewer.cs
│ ├── ConferencesTabControl.cs
│ ├── InputBindingsManager.cs
│ ├── InputBox.cs
│ ├── SmilesTable.cs
│ └── ToolBarEx.cs
├── Cyclops.MainApplication.csproj
├── Data
│ ├── Avatars
│ │ └── default.png
│ ├── Profiles
│ │ ├── Application.config.xml
│ │ └── Profile.config.xml
│ ├── Smiles
│ │ └── kolobok.jisp
│ ├── Sounds
│ │ ├── 1.wav
│ │ ├── 2.wav
│ │ └── 3.wav
│ └── Themes
│ │ └── Default
│ │ ├── Brushes.xaml
│ │ ├── General.xaml
│ │ ├── OutputAreaStyles.xaml
│ │ └── SettingsViewStyles.xaml
├── Helpers
│ ├── ContextMenuServiceExtensions.cs
│ ├── GlassEffectHelper.cs
│ ├── ImageResizingUtility.cs
│ ├── MemoryUtility.cs
│ ├── StartupLinkUtil.cs
│ ├── SystemHelper.cs
│ └── UIHelper.cs
├── ImageUtils.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── MessageDecoration
│ ├── ChatCommands.cs
│ ├── Decorators
│ │ ├── CommonMessageDecorator.cs
│ │ ├── HyperlinkDecorator.cs
│ │ ├── IMessageDecorator.cs
│ │ ├── MessagePartType.cs
│ │ ├── NickDecorator.cs
│ │ ├── NickEventArgs.cs
│ │ ├── RunEx.cs
│ │ ├── SmilesDecorator.cs
│ │ ├── TimestampDecorator.cs
│ │ └── UrlEventArgs.cs
│ ├── DecoratorsRegistry.cs
│ ├── DecoratorsStyles.cs
│ └── MessagePresenter.cs
├── Notifications
│ ├── TaskbarNotifier.cs
│ └── TrayController.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── DesignTimeResources.xaml
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── DefaultBackground.jpg
│ ├── EmptyIcon.ico
│ ├── Moderator_icon.png
│ ├── clean.ico
│ ├── editicon.png
│ ├── email.png
│ ├── error.png
│ ├── favorite.png
│ ├── green-star-th.png
│ ├── icon_crown.gif
│ ├── icon_shutup.png
│ ├── image.png
│ ├── ligth-off.ico
│ ├── ligth-on.ico
│ ├── mail.png
│ ├── medal_silver_2.png
│ ├── noSound.png
│ ├── note_delete.ico
│ ├── remove.png
│ ├── search-web.png
│ ├── send.png
│ ├── smile.gif
│ ├── sound.png
│ ├── stop.png
│ ├── testavatar.png
│ ├── tools.png
│ ├── user group.ico
│ ├── user1.png
│ ├── user_man.png
│ ├── users.png
│ ├── users1.png
│ ├── users_c.png
│ ├── warning.png
│ └── web search.png
├── Splashscreen.png
├── SynchronizeInvokeImpl.cs
├── ValueConverters
│ ├── BraceConverter.cs
│ ├── FalseToCollapsedValueConverter.cs
│ ├── Invertor.cs
│ ├── IsNullToCollapsedValueConverter.cs
│ ├── RoleAndAffilationToImageConverter.cs
│ ├── StatusTypeToIntegerConverter.cs
│ ├── SubjectConverter.cs
│ └── SumConverter.cs
├── View
│ ├── ConferenceView.xaml
│ ├── ConferenceView.xaml.cs
│ ├── ConferencesList.xaml
│ ├── ConferencesList.xaml.cs
│ ├── ContextMenus.xaml
│ ├── Dialogs
│ │ ├── DialogManager.cs
│ │ ├── InputDialog.xaml
│ │ ├── InputDialog.xaml.cs
│ │ ├── NickAndStatusDialog.xaml
│ │ ├── NickAndStatusDialog.xaml.cs
│ │ ├── VcardDialog.xaml
│ │ └── VcardDialog.xaml.cs
│ ├── LoginView.xaml
│ ├── LoginView.xaml.cs
│ ├── MainView.xaml
│ ├── MainView.xaml.cs
│ ├── Popups
│ │ ├── ErrorNotification.xaml
│ │ ├── ErrorNotification.xaml.cs
│ │ ├── ErrorNotificationViewModel.cs
│ │ ├── NotificationManager.cs
│ │ ├── PrivateNotification.xaml
│ │ ├── PrivateNotification.xaml.cs
│ │ └── PrivateNotificationViewModel.cs
│ ├── PrivateView.xaml
│ ├── PrivateView.xaml.cs
│ ├── SmilesView.xaml
│ ├── SmilesView.xaml.cs
│ └── ViewController.cs
├── ViewModel
│ ├── ChatAreaViewModel.cs
│ ├── ConferenceViewModel.Commands.cs
│ ├── ConferenceViewModel.DesignTime.cs
│ ├── ConferenceViewModel.cs
│ ├── ConferencesListViewModel.cs
│ ├── ConferencesServiceItem.cs
│ ├── HyperlinkOperationsViewModel.cs
│ ├── IChatAreaView.cs
│ ├── IMainView.cs
│ ├── LoginViewModel.cs
│ ├── MainViewModel.Commands.cs
│ ├── MainViewModel.cs
│ ├── MessageViewModel.cs
│ ├── NickAndStatusViewModel.cs
│ ├── PrivateViewModel.cs
│ ├── SettingsViewModel.cs
│ ├── VcardViewModel.cs
│ └── ViewModelBaseEx.cs
└── app.config
├── Cyclops.TestFramework
├── Cyclops.TestFramework.csproj
├── MockPresences.cs
├── MockXmppClient.cs
└── XUnitLoggerAdapter.cs
├── Cyclops.Tests
├── Cyclops.Tests.csproj
├── JidTests.cs
├── SharpXmppDataExtractorTests.cs
├── SharpXmppRoomTests.cs
└── TimeIqTests.cs
├── Cyclops.Windows
├── Cyclops.Windows.csproj
├── LastInputDetector.cs
└── User32.cs
├── Cyclops.Xmpp.SharpXmpp
├── Client
│ ├── SharpXmppBookmarkManager.cs
│ ├── SharpXmppClient.cs
│ ├── SharpXmppConferenceManager.cs
│ └── SharpXmppIqQueryManager.cs
├── Cyclops.Xmpp.SharpXmpp.csproj
├── Data
│ ├── BookmarkedConferenceEx.cs
│ ├── DiscoNode.cs
│ ├── ExtendedUserDataEx.cs
│ ├── Rooms
│ │ ├── MucParticipant.cs
│ │ └── SharpXmppRoom.cs
│ └── SharpXmppDataExtractor.cs
├── Errors
│ └── MessageOnlyException.cs
├── Protocol
│ ├── ErrorEx.cs
│ ├── IqEx.cs
│ ├── JidEx.cs
│ ├── MessageEx.cs
│ ├── PresenceEx.cs
│ ├── PresenceTypeEx.cs
│ ├── PresenceTypes.cs
│ └── XElementEx.cs
└── Registration
│ └── SharpXmppRegistrationManager.cs
├── Cyclops.Xmpp
├── Client
│ ├── IBookmarkManager.cs
│ ├── IConferenceManager.cs
│ ├── IIqQueryManager.cs
│ └── IXmppClient.cs
├── Cyclops.Xmpp.csproj
├── Data
│ ├── CaptchaRequest.cs
│ ├── ClientInfo.cs
│ ├── IAdminItem.cs
│ ├── IBookmark.cs
│ ├── IExtendedUserData.cs
│ ├── IXmppDataExtractor.cs
│ ├── PhotoData.cs
│ ├── PresenceDetails.cs
│ ├── PresenceType.cs
│ ├── Rooms
│ │ ├── IMucParticipant.cs
│ │ ├── IRoom.cs
│ │ ├── IRoomItem.cs
│ │ ├── MucAffiliation.cs
│ │ ├── MucAffiliations.cs
│ │ ├── MucRole.cs
│ │ ├── MucRoles.cs
│ │ └── MucUserStatus.cs
│ ├── StatusType.cs
│ └── VCard.cs
├── Protocol
│ ├── Attributes.cs
│ ├── Elements.cs
│ ├── IDiscoNode.cs
│ ├── IError.cs
│ ├── IIq.cs
│ ├── IMessage.cs
│ ├── IPresence.cs
│ ├── IStanza.cs
│ ├── IqQueries
│ │ ├── ILastIq.cs
│ │ ├── ITimeIq.cs
│ │ └── IVersionIq.cs
│ ├── Jid.cs
│ ├── MessageType.cs
│ └── Namespaces.cs
└── Registration
│ ├── IRegistrationManager.cs
│ └── RegistrationResult.cs
├── CyclopsChat.sln
├── CyclopsChat.sln.DotSettings
├── Directory.Build.props
├── Docs
├── screenshot-1.png
└── screenshot-2.png
├── LICENSE.md
├── MAINTAINERSHIP.md
├── README.md
├── THIRD-PARTY-SOFTWARE.md
├── scripts
└── verify-encoding.ps1
└── third-party
├── BusyIndicators
└── LICENSE
├── CommonServiceLocator
└── LICENSE.txt
├── Dirkster.NumericUpDownLib
└── License.md
├── MvvmLightLibs
└── LICENSE.txt
├── SharpXMPP
└── LICENSE.md
├── Unity
└── LICENSE
└── dotnet
├── LICENSE.TXT
├── PATENTS.TXT
└── THIRD-PARTY-NOTICES.TXT
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 4
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 |
10 | [*.yml]
11 | indent_size = 2
12 |
--------------------------------------------------------------------------------
/.git-blame-ignore-revs:
--------------------------------------------------------------------------------
1 | # Code cleanup: fix UTF-8 BOM and line endings in all the files
2 | 1e91df3eaae39263f5fc7d91321b376202520acb
3 |
4 | # Code style: update namespaces in recently changed files
5 | dc125b41be5ddd79f3eabbb794a378b8c69dc544
6 |
7 | # Code cleanup: migrate to new-style namespace
8 | 92b7e9cb5159cdba7018869f2b59d98554c80de6
9 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2 | version: 2
3 | updates:
4 | - package-ecosystem: "github-actions"
5 | directory: "/"
6 | schedule:
7 | interval: "daily"
8 | - package-ecosystem: "nuget"
9 | directory: "/"
10 | schedule:
11 | interval: "daily"
12 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: Main
2 | on:
3 | push:
4 | branches:
5 | - master
6 | pull_request:
7 | branches:
8 | - master
9 | schedule:
10 | - cron: '0 0 * * 6'
11 |
12 | jobs:
13 | main:
14 | runs-on: windows-2019
15 | env:
16 | DOTNET_NOLOGO: 1
17 | DOTNET_CLI_TELEMETRY_OPTOUT: 1
18 | NUGET_PACKAGES: ${{ github.workspace }}/.github/nuget-packages
19 | steps:
20 | - name: Checkout
21 | uses: actions/checkout@v4
22 |
23 | - name: NuGet cache
24 | uses: actions/cache@v4
25 | with:
26 | path: ${{ env.NUGET_PACKAGES }}
27 | key: ${{ runner.os }}.nuget.${{ hashFiles('**/*.csproj') }}
28 | - name: Set up .NET SDK
29 | uses: actions/setup-dotnet@v4
30 | with:
31 | dotnet-version: 6.0.x
32 |
33 | - name: Build
34 | run: dotnet build --configuration Release
35 | - name: Test
36 | run: dotnet test --configuration Release
37 |
38 | verify:
39 | runs-on: 'ubuntu-22.04'
40 | steps:
41 | - name: 'Checkout'
42 | uses: actions/checkout@v4
43 | - name: 'Verify encoding'
44 | shell: pwsh
45 | run: ./scripts/verify-encoding.ps1
46 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /.idea/
2 |
3 | bin/
4 | obj/
5 |
6 | *.user
7 | .vs/
8 |
--------------------------------------------------------------------------------
/.idea/.idea.CyclopsChat/.idea/dictionaries/fried.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | jid
5 | storer
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/.idea.CyclopsChat/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/.run/Cyclops.MainApplication.run.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Contributor Guide
2 | =================
3 |
4 | Logging
5 | -------
6 | To enable XMPP protocol logging, go to `app.config` (if building from sources) or `Cyclops.MainApplication.dll.config` (if working with a prebuilt version), and set `VerboseLogging`'s value to `true`.
7 |
--------------------------------------------------------------------------------
/Cyclops.Configuration/ConnectionConfig.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 |
3 | namespace Cyclops.Configuration;
4 |
5 | ///
6 | /// Connection configuration
7 | ///
8 | public class ConnectionConfig
9 | {
10 | /// Server address.
11 | public string? Server { get; set; }
12 |
13 | /// Physical server address.
14 | public string? NetworkHost { get; set; }
15 |
16 | [Range(0, 65535)] public int Port { get; set; } = 5222;
17 |
18 | public string? User { get; set; }
19 |
20 | [Display(AutoGenerateField = false)]
21 | public string? EncodedPassword { get; set; }
22 |
23 | /*
24 | * TODO: Proxy
25 | */
26 |
27 | public override string ToString() =>
28 | $"Server: {Server}; NetworkHost: {NetworkHost}; User: {User}; Port: {Port}; Is password set: {!string.IsNullOrEmpty(EncodedPassword)}";
29 | }
30 |
--------------------------------------------------------------------------------
/Cyclops.Configuration/Cyclops.Configuration.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0
4 | enable
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Cyclops.Console/Composition/Module.cs:
--------------------------------------------------------------------------------
1 | using Cyclops.Core;
2 | using Cyclops.Core.Modularity;
3 | using Unity;
4 |
5 | namespace Cyclops.Console.Composition
6 | {
7 | public sealed class Module : ModuleBase
8 | {
9 | public override void Initialize(IUnityContainer container)
10 | {
11 | container
12 | .RegisterType();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Cyclops.Console/ConsoleWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Cyclops.Console/ConsoleWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using Cyclops.Console.ViewModel;
2 | using Cyclops.Core;
3 | using Cyclops.Core.Resource;
4 |
5 | namespace Cyclops.Console
6 | {
7 | public partial class ConsoleWindow : IDebugWindow
8 | {
9 | private new ConsoleViewModel? DataContext
10 | {
11 | get => (ConsoleViewModel)base.DataContext;
12 | set => base.DataContext = value;
13 | }
14 |
15 | public ConsoleWindow()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | public void ShowConsole(IUserSession session)
21 | {
22 | DataContext?.Cleanup();
23 |
24 | var client = ((UserSession)session).XmppClient;
25 | DataContext = new ConsoleViewModel(Dispatcher, client);
26 | Show();
27 | }
28 | }
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/Cyclops.Console/Cyclops.Console.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0-windows
4 | true
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | NU1701
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Cyclops.Core.Resource/Avatars/ImageUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Security.Cryptography;
3 |
4 | namespace Cyclops.Core.Resource;
5 |
6 | ///
7 | /// Set of extension methods for System.Drawing.Image
8 | ///
9 | internal static class ImageUtils
10 | {
11 | public static string CalculateSha1HashOfAnImage(byte[] image)
12 | {
13 | var cryptoTransformSha1 = new SHA1CryptoServiceProvider();
14 | string hash = BitConverter.ToString(cryptoTransformSha1.ComputeHash(image)).Replace("-", "").ToLower();
15 | return hash;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Cyclops.Core.Resource/ChatObjectsValidator.cs:
--------------------------------------------------------------------------------
1 | using Cyclops.Configuration;
2 |
3 | namespace Cyclops.Core.Resource
4 | {
5 | public class ChatObjectsValidator : IChatObjectsValidator
6 | {
7 | #region Implementation of IChatObjectsValidator
8 |
9 | public bool ValidateConfig(ConnectionConfig config)
10 | {
11 | //TODO:
12 | return true;
13 | }
14 |
15 | public bool ValidateName(string name)
16 | {
17 | if (string.IsNullOrEmpty(name))
18 | return false;
19 | if (name.Length > 100)
20 | return false;
21 |
22 | return true;
23 | }
24 |
25 | public bool ValidateHost(string host)
26 | {
27 | //TODO:
28 | return true;
29 | }
30 |
31 | #endregion
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Cyclops.Core.Resource/Composition/Module.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using Cyclops.Core.Modularity;
3 | using Cyclops.Core.Resource.Security;
4 | using Cyclops.Core.Resource.Smiles;
5 | using Cyclops.Core.Security;
6 | using Cyclops.Core.Smiles;
7 | using Unity;
8 |
9 | namespace Cyclops.Core.Resource.Composition
10 | {
11 | public sealed class Module : ModuleBase
12 | {
13 | public override void Initialize(IUnityContainer container)
14 | {
15 | container
16 | .RegisterType()
17 | .RegisterInstance(new FileLogger())
18 | .RegisterType()
19 | .RegisterType()
20 | .RegisterType()
21 | .RegisterType();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Cyclops.Core.Resource/Cyclops.Core.Resource.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0-windows
4 | false
5 | true
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Properties\AssemblyInfo.Shared.cs
15 |
16 |
17 |
18 |
19 | {61356ED8-D17B-4940-943D-812B8FCDA911}
20 | Cyclops.Core
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Cyclops.Core.Resource/Helpers/CommonUtility.cs:
--------------------------------------------------------------------------------
1 | using Cyclops.Xmpp.Data.Rooms;
2 |
3 | namespace Cyclops.Core.Resource
4 | {
5 | internal static class CommonUtility
6 | {
7 | internal static InternalObservableCollection AsInternalImpl(this IObservableCollection collection)
8 | {
9 | return collection as InternalObservableCollection;
10 | }
11 |
12 | internal static bool IsModer(this IMucParticipant participant)
13 | {
14 | return participant.Role == MucRole.Moderator ||
15 | participant.Affiliation is MucAffiliation.Admin or MucAffiliation.Owner;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Cyclops.Core.Resource/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyConfiguration("")]
5 | [assembly: AssemblyProduct("Cyclops.Core.Resource")]
6 | [assembly: Guid("7c75ea7e-8380-4d2b-82dc-9da4feb2a9d1")]
7 |
--------------------------------------------------------------------------------
/Cyclops.Core.Resource/Security/TripleDesStringEncryptor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Security.Cryptography;
4 | using System.Text;
5 | using Cyclops.Core.Security;
6 |
7 | namespace Cyclops.Core.Resource.Security
8 | {
9 | public class TripleDesStringEncryptor : IStringEncryptor
10 | {
11 | private readonly byte[] iv;
12 | private readonly byte[] key;
13 | private readonly TripleDESCryptoServiceProvider provider;
14 |
15 | public TripleDesStringEncryptor()
16 | {
17 | key = Encoding.ASCII.GetBytes("ASYAHAGCBDUUADIADKOPAAAW");
18 | iv = Encoding.ASCII.GetBytes("SSAZBGAW");
19 | provider = new TripleDESCryptoServiceProvider();
20 | }
21 |
22 | #region IStringEncryptor Members
23 |
24 | public string EncryptString(string plainText)
25 | {
26 | var plainBytes = Encoding.UTF8.GetBytes(plainText);
27 | return Convert.ToBase64String(Transform(plainBytes, provider.CreateEncryptor(key, iv)));
28 | }
29 |
30 | public string DecryptString(string encryptedText)
31 | {
32 | var encryptedBytes = Convert.FromBase64String(encryptedText);
33 | return Encoding.UTF8.GetString(Transform(encryptedBytes, provider.CreateDecryptor(key, iv)));
34 | }
35 |
36 | #endregion
37 |
38 | private static byte[] Transform(byte[] bytes, ICryptoTransform transform)
39 | {
40 | using (var stream = new MemoryStream())
41 | {
42 | using (var cryptoStream = new CryptoStream(stream, transform, CryptoStreamMode.Write))
43 | {
44 | cryptoStream.Write(bytes, 0, bytes.Length);
45 | cryptoStream.FlushFinalBlock();
46 |
47 | return stream.ToArray();
48 | }
49 | }
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Cyclops.Core.Resource/Smiles/Smile.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Xml.Serialization;
3 | using Cyclops.Core.Smiles;
4 |
5 | namespace Cyclops.Core.Resource.Smiles;
6 |
7 | public class Smile : ISmile
8 | {
9 | [XmlElement("text")]
10 | public string[] Masks { get; set; }
11 |
12 | [XmlElement("object")]
13 | public string File { get; set; }
14 |
15 | [XmlIgnore]
16 | public MemoryStream Stream { get; set; }
17 | }
18 |
--------------------------------------------------------------------------------
/Cyclops.Core.Resource/Smiles/SmilePack.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml;
3 | using System.Xml.Schema;
4 | using System.Xml.Serialization;
5 | using Cyclops.Core.Smiles;
6 |
7 | namespace Cyclops.Core.Resource.Smiles
8 | {
9 | [XmlRoot(ElementName="icondef")]
10 | public class SmilePack : ISmilePack
11 | {
12 | [XmlIgnore]
13 | public ISmilePackMeta Meta => MetaForDeserialization;
14 |
15 | [XmlElement("meta", typeof(SmilePackMeta))]
16 | public SmilePackMeta MetaForDeserialization { get; set; }
17 |
18 | [XmlIgnore]
19 | public ISmile[] Smiles => SmilesForDeserialization;
20 |
21 | [XmlElement("icon", typeof(Smile))]
22 | public Smile?[] SmilesForDeserialization { get; set; }
23 |
24 | //NOTE: XmlSerializer can't deserialize Interface properties :( (tried to use XmlInclude and etc)
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Cyclops.Core.Resource/Smiles/SmilePackMeta.cs:
--------------------------------------------------------------------------------
1 | using System.Xml.Serialization;
2 | using Cyclops.Core.Smiles;
3 |
4 | namespace Cyclops.Core.Resource.Smiles
5 | {
6 | public class SmilePackMeta : ISmilePackMeta
7 | {
8 | [XmlElement("name")]
9 | public string Name { get; set; }
10 |
11 | [XmlElement("version")]
12 | public string Version { get; set; }
13 |
14 | [XmlElement("creation")]
15 | public string Creation { get; set; }
16 |
17 | [XmlElement("description")]
18 | public string Description { get; set; }
19 |
20 | [XmlElement("home")]
21 | public string Home { get; set; }
22 |
23 | [XmlElement("author")]
24 | public string Author { get; set; }
25 | }
26 | }
--------------------------------------------------------------------------------
/Cyclops.Core.Resource/Smiles/note.txt:
--------------------------------------------------------------------------------
1 | structure is same as JISP
--------------------------------------------------------------------------------
/Cyclops.Core/Avatars/IAvatarsManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Cyclops.Core.CustomEventArgs;
4 | using Cyclops.Xmpp.Protocol;
5 |
6 | namespace Cyclops.Core.Avatars;
7 |
8 | public interface IAvatarsManager : ISessionHolder
9 | {
10 | bool DoesCacheContain(string hash);
11 | byte[] GetFromCache(string hash);
12 | Task SendAvatarRequest(Jid id);
13 | event EventHandler AvatarChange;
14 | }
15 |
--------------------------------------------------------------------------------
/Cyclops.Core/CaptchaSystemMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Cyclops.Core;
2 |
3 | public class CaptchaSystemMessage : SystemConferenceMessage
4 | {
5 | public CaptchaSystemMessage()
6 | {
7 | IsErrorMessage = true;
8 | }
9 |
10 | public byte[] Bitmap { get; set; }
11 | }
12 |
--------------------------------------------------------------------------------
/Cyclops.Core/Composition/Module.cs:
--------------------------------------------------------------------------------
1 | using Cyclops.Core.Modularity;
2 | using Unity;
3 |
4 | namespace Cyclops.Core.Composition
5 | {
6 | public sealed class Module : ModuleBase
7 | {
8 | public override void Initialize(IUnityContainer container)
9 | {
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/AuthenticationEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Cyclops.Core.CustomEventArgs
2 | {
3 | ///
4 | /// Authentication event arguments
5 | ///
6 | public class AuthenticationEventArgs : OperationResult
7 | {
8 | public AuthenticationEventArgs()
9 | {
10 | }
11 |
12 | public AuthenticationEventArgs(ConnectionErrorKind errorKind, string errorMessage) :
13 | base(errorKind, errorMessage)
14 | {
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/AvatarChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Cyclops.Xmpp.Protocol;
3 |
4 | namespace Cyclops.Core.CustomEventArgs;
5 |
6 | public class AvatarChangedEventArgs : EventArgs
7 | {
8 | public Jid UserId { get; private set; }
9 | public byte[] BitmapImage { get; private set; }
10 |
11 | public AvatarChangedEventArgs(Jid userId, byte[] bitmapImage)
12 | {
13 | UserId = userId;
14 | BitmapImage = bitmapImage;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/BannedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Cyclops.Xmpp.Protocol;
3 |
4 | namespace Cyclops.Core.CustomEventArgs
5 | {
6 | public class BannedEventArgs : EventArgs
7 | {
8 | public BannedEventArgs(Jid? author, string reason)
9 | {
10 | Author = author;
11 | Reason = reason;
12 | }
13 |
14 | public Jid? Author { get; private set; }
15 | public string Reason { get; private set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/CaptchaEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Cyclops.Core.CustomEventArgs;
4 |
5 | public class CaptchaEventArgs : EventArgs
6 | {
7 | public byte[] BitmapImage { get; private set; }
8 |
9 | public CaptchaEventArgs(byte[] bitmapImage)
10 | {
11 | this.BitmapImage = bitmapImage;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/ConferenceJoinErrorKind.cs:
--------------------------------------------------------------------------------
1 | namespace Cyclops.Core
2 | {
3 | public enum ConferenceJoinErrorKind
4 | {
5 | None,
6 | Banned,
7 | NickConflict,
8 | PasswordRequired,
9 | WrongPassword,
10 | //CapthcaRequired
11 | }
12 | }
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/ConferenceJoinEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Cyclops.Xmpp.Protocol;
2 |
3 | namespace Cyclops.Core.CustomEventArgs
4 | {
5 | ///
6 | /// Disconnect event args
7 | ///
8 | public class ConferenceJoinEventArgs : OperationResult
9 | {
10 | public IPresence? Presence { get; }
11 |
12 | public ConferenceJoinEventArgs()
13 | { }
14 |
15 | public ConferenceJoinEventArgs(
16 | ConferenceJoinErrorKind errorKind,
17 | string errorMessage,
18 | IPresence? presence = null)
19 | : base(errorKind, errorMessage)
20 | => Presence = presence;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/ConferenceMemberEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Cyclops.Core.CustomEventArgs
7 | {
8 | public class ConferenceMemberEventArgs : EventArgs
9 | {
10 | public ConferenceMemberEventArgs(IConferenceMember member)
11 | {
12 | Member = member;
13 | }
14 |
15 | public IConferenceMember Member { get; private set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/ConferencesListEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Cyclops.Xmpp.Protocol;
4 |
5 | namespace Cyclops.Core.CustomEventArgs
6 | {
7 | public class ConferencesListEventArgs : EventArgs
8 | {
9 | public ConferencesListEventArgs()
10 | {
11 | Success = false;
12 | }
13 |
14 | public ConferencesListEventArgs(List> result)
15 | {
16 | Result = result;
17 | Success = true;
18 | }
19 |
20 | public List> Result { get; private set; }
21 | public bool Success { get; private set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/ConnectionErrorKind.cs:
--------------------------------------------------------------------------------
1 | namespace Cyclops.Core
2 | {
3 | public enum ConnectionErrorKind
4 | {
5 | NoError = -1,
6 | InvalidPasswordOrUserName = 0,
7 | InvalidConfig,
8 | ConnectionError,
9 | RequestedByUser,
10 | UnknownError
11 | }
12 | }
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/DisconnectEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Cyclops.Core.CustomEventArgs
2 | {
3 | ///
4 | /// Disconnect event args
5 | ///
6 | public class DisconnectEventArgs : OperationResult
7 | {
8 | public DisconnectEventArgs()
9 | {
10 | ErrorKind = ConnectionErrorKind.RequestedByUser;
11 | }
12 |
13 | public DisconnectEventArgs(ConnectionErrorKind errorKind, string errorMessage) :
14 | base(errorKind, errorMessage)
15 | {
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/ErrorEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Cyclops.Xmpp.Protocol;
3 |
4 | namespace Cyclops.Core.CustomEventArgs
5 | {
6 | public class ErrorEventArgs : EventArgs
7 | {
8 | public ErrorEventArgs(Jid? from, string msg)
9 | {
10 | From = from;
11 | Message = msg;
12 | }
13 |
14 | public Jid? From { get; private set; }
15 | public string Message { get; private set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/KickedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Cyclops.Xmpp.Protocol;
3 |
4 | namespace Cyclops.Core.CustomEventArgs
5 | {
6 | public class KickedEventArgs : EventArgs
7 | {
8 | public KickedEventArgs(Jid? author, string? reason)
9 | {
10 | Author = author;
11 | Reason = reason;
12 | }
13 |
14 | public Jid? Author { get; }
15 | public string? Reason { get; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/NickChangeEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Cyclops.Core.CustomEventArgs
7 | {
8 | public class NickChangeEventArgs : EventArgs
9 | {
10 | public string OldNick { get; private set; }
11 | public string NewNick { get; private set; }
12 |
13 | public NickChangeEventArgs(string oldNick, string newNick)
14 | {
15 | OldNick = oldNick;
16 | NewNick = newNick;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/OperationResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Cyclops.Core.CustomEventArgs
4 | {
5 | ///
6 | /// Generic base type for EventArgs, that represents operation result
7 | ///
8 | /// Enum type
9 | public class OperationResult : EventArgs where TErrorKindEnum : struct
10 | //can't use 'enum' in the constraint :-(
11 | {
12 | ///
13 | ///
14 | public OperationResult()
15 | {
16 | ErrorMessage = string.Empty;
17 | Success = true;
18 | ErrorKind = default(TErrorKindEnum);
19 | }
20 |
21 | ///
22 | ///
23 | public OperationResult(TErrorKindEnum errorKind, string errorMessage)
24 | {
25 | Success = false;
26 | ErrorKind = errorKind;
27 | ErrorMessage = errorMessage;
28 | }
29 |
30 | ///
31 | /// Error message
32 | ///
33 | public string ErrorMessage { get; protected set; }
34 |
35 | ///
36 | /// Operation result, True if success
37 | ///
38 | public bool Success { get; protected set; }
39 |
40 | ///
41 | /// Error kind
42 | ///
43 | public TErrorKindEnum ErrorKind { get; protected set; }
44 |
45 | public override string ToString()
46 | {
47 | if (Success)
48 | return string.Format("Success");
49 | return string.Format("Fail (ErrorKind={0}, ErrorMessage={1}", ErrorKind, ErrorMessage);
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/RoleChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Cyclops.Core.CustomEventArgs
4 | {
5 | public class RoleChangedEventArgs : EventArgs
6 | {
7 | public string By { get; set; }
8 | public string? To { get; set; }
9 | public Role Role { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Cyclops.Core/CustomEventArgs/SubjectChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Cyclops.Core.CustomEventArgs
4 | {
5 | public class SubjectChangedEventArgs : EventArgs
6 | {
7 | public string Author { get; private set; }
8 | public string NewSubject { get; private set; }
9 |
10 | public SubjectChangedEventArgs(string author, string subject)
11 | {
12 | Author = author;
13 | NewSubject = subject;
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/Cyclops.Core/Cyclops.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Cyclops.Core/Helpers/ReflectionHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 |
4 | namespace Cyclops.Core.Helpers
5 | {
6 | ///
7 | ///
8 | public static class ReflectionHelper
9 | {
10 | ///
11 | /// Creates a shallow copy of an object
12 | ///
13 | public static TNew ShallowCopyTo(TOld old) where TNew : new()
14 | {
15 | var result = new TNew();
16 | Type oldType = typeof (TOld);
17 | Type newType = typeof (TNew);
18 |
19 | foreach (PropertyInfo property in old.GetType().GetProperties())
20 | {
21 | object value = oldType.GetProperty(property.Name).GetValue(old, null);
22 |
23 | PropertyInfo propertyOfNew = newType.GetProperty(property.Name);
24 | if (propertyOfNew != null)
25 | propertyOfNew.SetValue(result, value, null);
26 | }
27 | return result;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Cyclops.Core/Helpers/ResourceHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Reflection;
4 |
5 | namespace Cyclops.Core.Helpers
6 | {
7 | public static class ResourceHelper
8 | {
9 | ///
10 | /// Reads a content from resource file in specific assembly
11 | ///
12 | public static string ReadFromResource(string path, Assembly assembly = null)
13 | {
14 | if (assembly == null)
15 | assembly = Assembly.GetExecutingAssembly();
16 | Stream stream = assembly.GetManifestResourceStream(path);
17 | if (stream == null)
18 | throw new ArgumentException("Cannot find resource by path in " + assembly);
19 | using (var sr = new StreamReader(stream))
20 | return sr.ReadToEnd();
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/Cyclops.Core/Helpers/TaskEx.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Cyclops.Core.Helpers;
4 |
5 | public static class TaskEx
6 | {
7 | public static void NoAwait(this Task task, ILogger logger)
8 | {
9 | task.ContinueWith(t =>
10 | {
11 | if (t.IsFaulted)
12 | logger.LogError("Task faulted with an exception", t.Exception!);
13 | });
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Cyclops.Core/IChatLogger.cs:
--------------------------------------------------------------------------------
1 | using Cyclops.Xmpp.Protocol;
2 |
3 | namespace Cyclops.Core
4 | {
5 | public interface IChatLogger
6 | {
7 | void AddRecord(Jid? id, string message, bool isPrivate = false);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Cyclops.Core/IChatObjectsValidator.cs:
--------------------------------------------------------------------------------
1 | using Cyclops.Configuration;
2 |
3 | namespace Cyclops.Core
4 | {
5 | public interface IChatObjectsValidator
6 | {
7 | bool ValidateConfig(ConnectionConfig config);
8 | bool ValidateName(string name);
9 | bool ValidateHost(string host);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Cyclops.Core/IConferenceMember.cs:
--------------------------------------------------------------------------------
1 | using Cyclops.Xmpp.Data;
2 | using Cyclops.Xmpp.Protocol;
3 |
4 | namespace Cyclops.Core;
5 |
6 | public interface IConferenceMember : ISessionHolder
7 | {
8 | string Nick { get; }
9 | bool IsModer { get; }
10 | bool IsMe { get; }
11 | string StatusText { get; }
12 | string StatusType { get; }
13 | bool IsSubscribed { get; set; }
14 |
15 | Role Role { get; }
16 | ClientInfo ClientInfo { get; }
17 | byte[] AvatarUrl { get; }
18 |
19 | Jid ConferenceUserId { get; }
20 | Jid? RealUserId { get; }
21 | }
22 |
--------------------------------------------------------------------------------
/Cyclops.Core/IConferenceMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Cyclops.Xmpp.Protocol;
3 |
4 | namespace Cyclops.Core
5 | {
6 | public interface IConferenceMessage : ISessionHolder
7 | {
8 | Jid AuthorId { get; }
9 | bool IsAuthorModer { get; }
10 | string AuthorNick { get; }
11 | string Body { get; }
12 | DateTime Timestamp { get; }
13 | bool IsCustom { get; }
14 | bool IsSelfMessage { get; }
15 | bool IsFromHistory { get; }
16 |
17 | IConference Conference { get; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Cyclops.Core/IDebugWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Cyclops.Core
7 | {
8 | public interface IDebugWindow
9 | {
10 | void ShowConsole(IUserSession session);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Cyclops.Core/ILogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Cyclops.Core
4 | {
5 | public interface ILogger
6 | {
7 | bool VerboseLogging { set; }
8 |
9 | void LogError(string message, Exception? exception);
10 | void LogInfo(string message, params object[] args);
11 | void LogVerbose(string message, params object[] args);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Cyclops.Core/IObservableCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.Specialized;
4 |
5 | namespace Cyclops.Core
6 | {
7 | public interface IObservableCollection : IEnumerable, INotifyCollectionChanged
8 | {
9 | }
10 | }
--------------------------------------------------------------------------------
/Cyclops.Core/ISessionHolder.cs:
--------------------------------------------------------------------------------
1 | namespace Cyclops.Core
2 | {
3 | public interface ISessionHolder
4 | {
5 | IUserSession Session { get; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Cyclops.Core/ISynchronizeInvokeHolder.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace Cyclops.Core
4 | {
5 | public interface ISynchronizeInvokeHolder
6 | {
7 | ISynchronizeInvoke Invoker { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Cyclops.Core/IUserSession.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Cyclops.Configuration;
4 | using Cyclops.Core.CustomEventArgs;
5 | using Cyclops.Xmpp.Data;
6 | using Cyclops.Xmpp.Protocol;
7 |
8 | namespace Cyclops.Core;
9 |
10 | public interface IUserSession : IDisposable
11 | {
12 | bool IsAuthenticating { get; }
13 | bool IsAuthenticated { get; }
14 | Jid CurrentUserId { get; }
15 | Jid ConferenceServiceId { get; }
16 | ConnectionConfig ConnectionConfig { get; }
17 | IObservableCollection Conferences { get; }
18 | IObservableCollection PrivateMessages { get; }
19 | bool AutoReconnect { get; set; }
20 | string Status { get; set; }
21 | StatusType StatusType { get; set; }
22 |
23 | void SendPresence(PresenceDetails presenceDetails);
24 | void SendIq(IIq iq);
25 |
26 | void ChangeStatus(StatusType type, string status);
27 | void OpenConference(Jid id);
28 | void AuthenticateAsync(ConnectionConfig config);
29 | void Close();
30 | void Reconnect();
31 | void SendPrivate(Jid target, string body);
32 | void RefreshConferenceList(string? conferenceService);
33 | void RaiseBookmarksReceived();
34 | void StartPrivate(Jid conferenceUserId);
35 |
36 | Task GetClientInfo(Jid jid);
37 | Task GetVCard(Jid target);
38 | Task UpdateVCard(VCard vCard);
39 |
40 | event EventHandler ConferencesListReceived;
41 | event EventHandler Authenticated;
42 | event EventHandler ConnectionDropped;
43 | event EventHandler Presence;
44 | event EventHandler PublicMessage;
45 | event EventHandler ErrorMessageRecieved;
46 | void RemoveFromBookmarks(Jid conferenceId);
47 | void AddToBookmarks(Jid conferenceId);
48 | }
49 |
--------------------------------------------------------------------------------
/Cyclops.Core/Modularity/Bootstrapper.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using CommonServiceLocator;
3 | using Unity;
4 | using Unity.Lifetime;
5 |
6 | namespace Cyclops.Core.Modularity
7 | {
8 | public static class Bootstrapper
9 | {
10 | public static IServiceLocator Run(IEnumerable modules, bool verboseLogging)
11 | {
12 | var unity = new UnityContainer();
13 | var locator = new ServiceLocatorImpl(unity);
14 |
15 | ServiceLocator.SetLocatorProvider(() => locator);
16 |
17 | unity.RegisterInstance(locator, new ContainerControlledLifetimeManager());
18 |
19 | IEnumerable modulesRaw = GetAllModulesRaw(modules);
20 | modulesRaw.ForEach(module => module.Initialize(unity));
21 |
22 | locator.GetInstance().VerboseLogging = verboseLogging;
23 |
24 | return locator;
25 | }
26 |
27 | private static IEnumerable GetAllModulesRaw(IEnumerable modules)
28 | {
29 | var modulesRaw = new List();
30 | GetAllModulesRaw(modules, modulesRaw);
31 | return modulesRaw;
32 | }
33 |
34 | private static void GetAllModulesRaw(IEnumerable modules, IList modulesRaw)
35 | {
36 | modules.ForEach(
37 | module =>
38 | {
39 | if (!modulesRaw.Contains(module))
40 | modulesRaw.Add(module);
41 | GetAllModulesRaw(module.Children, modulesRaw);
42 | });
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Cyclops.Core/Modularity/IModule.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Unity;
3 |
4 | namespace Cyclops.Core.Modularity
5 | {
6 | public interface IModule
7 | {
8 | IEnumerable Children { get; }
9 |
10 | void Initialize(IUnityContainer container);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Cyclops.Core/Modularity/ModuleBase.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using Unity;
4 |
5 | namespace Cyclops.Core.Modularity
6 | {
7 | public abstract class ModuleBase : IModule
8 | {
9 | #region IModule Members
10 |
11 | public virtual IEnumerable Children => Enumerable.Empty();
12 |
13 | public virtual void Initialize(IUnityContainer container)
14 | {
15 | }
16 |
17 | #endregion
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Cyclops.Core/Modularity/ServiceLocatorImpl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using CommonServiceLocator;
4 | using Unity;
5 |
6 | namespace Cyclops.Core.Modularity
7 | {
8 | internal sealed class ServiceLocatorImpl : ServiceLocatorImplBase
9 | {
10 | private readonly IUnityContainer unity;
11 |
12 | public ServiceLocatorImpl(IUnityContainer unity)
13 | {
14 | this.unity = unity;
15 | }
16 |
17 | protected override object DoGetInstance(Type serviceType, string key)
18 | {
19 | return unity.Resolve(serviceType, key);
20 | }
21 |
22 | protected override IEnumerable