Skip to content

Commit

Permalink
Core/Engines: migrate to MonoAddins infrastructure
Browse files Browse the repository at this point in the history
Only for the backend for now.
(TODO: Load frontends with mono-addins too.)
This integration work opens the door for more
add-in management love, such as loading/unloading
capabilities at runtime, installing/updating
add-ins from remote repositories (via Cydin[1]), etc.

[1] https://github.com/slluis/cydin
  • Loading branch information
knocte committed Oct 6, 2018
1 parent 45d5eb5 commit c7d0e96
Show file tree
Hide file tree
Showing 21 changed files with 219 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ install:
- sudo apt-get build-dep smuxi > /dev/null
- sudo apt-get install devscripts equivs > /dev/null
- sudo mk-build-deps --install debian/control > /dev/null
- sudo apt-get install mono-devel nunit-console moreutils gtk-sharp2-gapi libgtkspell-dev > /dev/null
- sudo apt-get install mono-devel nunit-console moreutils gtk-sharp2-gapi libgtkspell-dev libmono-addins-cil-dev > /dev/null

script:
- ./autogen.sh MCS=/usr/bin/dmcs
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ fi
AC_SUBST(XBUILD_FLAGS)

# Required Libraries
PKG_CHECK_MODULES(MONO_ADDINS, mono-addins >= 1.0)
AC_SUBST(MONO_ADDINS_LIBS)

PKG_CHECK_MODULES([LOG4NET], [log4net])

PKG_CHECK_EXISTS([nini-1.1], FOUND_NINI=yes, FOUND_NINI=no)
Expand Down
22 changes: 22 additions & 0 deletions src/Engine-Campfire/Engine-Campfire.addin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Addin
id="smuxi-engine-campfire"
version="1.1"
compatVersion="1.1"
copyright="© 2012 Carlos Martín Nieto. Licensed under the GPL license."
name="Campfire"
category="Engines"
description="Support for Campfire protocol."
author="Carlos Martín Nieto"
url="http://smuxi.im/"
defaultEnabled="true">

<Dependencies>
<!-- not depending on other addin, just the addinRoot -->
<Addin id="smuxi-engine" version="1.1"/>
</Dependencies>

<Extension path="/Smuxi/Server/Engine">
<Engine class="Smuxi.Engine.CampfireProtocolManager"/>
</Extension>
</Addin>
5 changes: 5 additions & 0 deletions src/Engine-Campfire/Engine-Campfire.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,9 @@
<Name>ServiceStack.Interfaces</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Engine-Campfire.addin.xml">
<LogicalName>Enging-Campfire.addin.xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Project>
7 changes: 5 additions & 2 deletions src/Engine-Campfire/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ SOURCES = \
Protocols/Campfire/CampfireEventStream.cs \
Protocols/Campfire/DTO.cs

RESOURCES = \
Engine-Campfire.addin.xml

REFERENCES = \
System \
System.Web \
Expand All @@ -36,5 +39,5 @@ include $(top_srcdir)/Makefile.include

all: $(ASSEMBLY_TARGET)

$(ASSEMBLY_TARGET) $(ASSEMBLY_TARGET).mdb: $(SOURCES) $(DLL_REFERENCES)
$(CSC) $(CSC_FLAGS) $(build_references_ref) -target:library -out:$(ASSEMBLY_TARGET) $(SOURCES_BUILD)
$(ASSEMBLY_TARGET) $(ASSEMBLY_TARGET).mdb: $(SOURCES) $(DLL_REFERENCES) $(build_resources)
$(CSC) $(CSC_FLAGS) $(build_references_ref) -target:library -out:$(ASSEMBLY_TARGET) $(SOURCES_BUILD) $(build_resources_embed)
22 changes: 22 additions & 0 deletions src/Engine-IRC/Engine-IRC.addin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Addin
id="smuxi-engine-irc"
version="1.1"
compatVersion="1.1"
copyright="© 2005-2015 Mirco Bauer. Licensed under the GPL license."
name="IRC"
category="Engines"
description="Support for IRC protocol."
author="Mirco Bauer"
url="http://smuxi.im/"
defaultEnabled="true">

<Dependencies>
<!-- not depending on other addin, just the addinRoot -->
<Addin id="smuxi-engine" version="1.1"/>
</Dependencies>

<Extension path="/Smuxi/Server/Engine">
<Engine class="Smuxi.Engine.IrcProtocolManager"/>
</Extension>
</Addin>
5 changes: 5 additions & 0 deletions src/Engine-IRC/Engine-IRC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,9 @@
<Reference Include="System.Core" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<EmbeddedResource Include="Engine-IRC.addin.xml">
<LogicalName>Engine-IRC.addin.xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion src/Engine-IRC/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ FILES = \

DATA_FILES =

RESOURCES =
RESOURCES = \
Engine-IRC.addin.xml

EXTRAS = \
smuxi-engine-irc.pc.in
Expand Down
22 changes: 22 additions & 0 deletions src/Engine-JabbR/Engine-JabbR.addin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Addin
id="smuxi-engine-jabbr"
version="1.1"
compatVersion="1.1"
copyright="© 2012-2014 Mirco Bauer. Licensed under the GPL license."
name="IRC"
category="Engines"
description="Support for JabbR protocol."
author="Mirco Bauer"
url="http://smuxi.im/"
defaultEnabled="true">

<Dependencies>
<!-- not depending on other addin, just the addinRoot -->
<Addin id="smuxi-engine" version="1.1"/>
</Dependencies>

<Extension path="/Smuxi/Server/Engine">
<Engine class="Smuxi.Engine.JabbrProtocolManager"/>
</Extension>
</Addin>
5 changes: 5 additions & 0 deletions src/Engine-JabbR/Engine-JabbR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@
</Reference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<EmbeddedResource Include="Engine-JabbR.addin.xml">
<LogicalName>Engine-JabbR.addin.xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Project>
7 changes: 5 additions & 2 deletions src/Engine-JabbR/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ SOURCES = \
JabbrMessageBuilder.cs \
JabbrProtocolManager.cs

RESOURCES = \
Engine-JabbR.addin.xml

REFERENCES = \
System \
System.Web \
Expand All @@ -33,5 +36,5 @@ include $(top_srcdir)/Makefile.include

all: $(ASSEMBLY_TARGET)

$(ASSEMBLY_TARGET) $(ASSEMBLY_TARGET).mdb: $(SOURCES) $(DLL_REFERENCES)
$(CSC) $(CSC_FLAGS) $(build_references_ref) -target:library -out:$(ASSEMBLY_TARGET) $(SOURCES_BUILD)
$(ASSEMBLY_TARGET) $(ASSEMBLY_TARGET).mdb: $(SOURCES) $(DLL_REFERENCES) $(build_resources)
$(CSC) $(CSC_FLAGS) $(build_references_ref) -target:library -out:$(ASSEMBLY_TARGET) $(SOURCES_BUILD) $(build_resources_embed)
22 changes: 22 additions & 0 deletions src/Engine-Twitter/Engine-Twitter.addin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Addin
id="smuxi-engine-twitter"
version="1.1"
compatVersion="1.1"
copyright="© 2009-2015 Mirco Bauer. Licensed under the GPL license."
name="Twitter"
category="Engines"
description="Support for Twitter protocol."
author="Mirco Bauer"
url="http://smuxi.im/"
defaultEnabled="true">

<Dependencies>
<!-- not depending on other addin, just the addinRoot -->
<Addin id="smuxi-engine" version="1.1"/>
</Dependencies>

<Extension path="/Smuxi/Server/Engine">
<Engine class="Smuxi.Engine.TwitterProtocolManager"/>
</Extension>
</Addin>
5 changes: 5 additions & 0 deletions src/Engine-Twitter/Engine-Twitter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,9 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<EmbeddedResource Include="Engine-Twitter.addin.xml">
<LogicalName>Engine-Twitter.addin.xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Project>
7 changes: 5 additions & 2 deletions src/Engine-Twitter/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ SOURCES = \
Protocols/Twitter/TwitterMessageBuilder.cs \
Protocols/Twitter/TwitterSearchStream.cs

RESOURCES = \
Engine-Twitter.addin.xml

REFERENCES = $(LOG4NET_LIBS) \
$(SMARTIRC4NET_LIBS) \
System.Web \
Expand All @@ -37,5 +40,5 @@ include $(top_srcdir)/Makefile.include

all: $(ASSEMBLY_TARGET)

$(ASSEMBLY_TARGET): $(SOURCES) $(DLL_REFERENCES)
$(MCS) $(CSC_FLAGS) $(build_references_ref) -target:library -out:$(ASSEMBLY_TARGET) $(SOURCES_BUILD)
$(ASSEMBLY_TARGET): $(SOURCES) $(DLL_REFERENCES) $(build_resources)
$(MCS) $(CSC_FLAGS) $(build_references_ref) -target:library -out:$(ASSEMBLY_TARGET) $(SOURCES_BUILD) $(build_resources_embed)
23 changes: 23 additions & 0 deletions src/Engine-XMPP/Engine-XMPP.addin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Addin
id="smuxi-engine-xmpp"
version="1.1"
compatVersion="1.1"
copyright="© 2005-2006 Mirco Bauer, © 2011 tuukka, © 2013-2014 Oliver Schneider. Licensed under the GPL license."
name="XMPP"
category="Engines"
description="Support for XMPP and XMPP-based protocols (e.g. Facebook)."
author="Mirco Bauer, Oliver Schneider"
url="http://smuxi.im/"
defaultEnabled="true">

<Dependencies>
<!-- not depending on other addin, just the addinRoot -->
<Addin id="smuxi-engine" version="1.1"/>
</Dependencies>

<Extension path="/Smuxi/Server/Engine">
<Engine class="Smuxi.Engine.XmppProtocolManager"/>
<Engine class="Smuxi.Engine.FacebookProtocolManager"/>
</Extension>
</Addin>
5 changes: 5 additions & 0 deletions src/Engine-XMPP/Engine-XMPP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,9 @@
<Reference Include="System.Core" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<EmbeddedResource Include="Engine-XMPP.addin.xml">
<LogicalName>Engine-XMPP.addin.xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Project>
8 changes: 6 additions & 2 deletions src/Engine-XMPP/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ SOURCES = \
Protocols/Xmpp/XmppProtocolManager.cs \
Config/XmppPersonModel.cs

RESOURCES = \
Engine-XMPP.addin.xml

REFERENCES = \
System \
System.Core \
Expand All @@ -35,5 +38,6 @@ include $(top_srcdir)/Makefile.include

all: $(ASSEMBLY_TARGET)

$(ASSEMBLY_TARGET) $(ASSEMBLY_TARGET).mdb: $(SOURCES) $(DLL_REFERENCES)
$(CSC) $(CSC_FLAGS) $(build_references_ref) -target:library -out:$(ASSEMBLY_TARGET) $(SOURCES_BUILD)
$(ASSEMBLY_TARGET) $(ASSEMBLY_TARGET).mdb: $(SOURCES) $(DLL_REFERENCES) $(build_resources)
$(CSC) $(CSC_FLAGS) $(build_references_ref) -target:library -out:$(ASSEMBLY_TARGET) $(SOURCES_BUILD) $(build_resources_embed)

25 changes: 25 additions & 0 deletions src/Engine/AddinHost.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Smuxi - Smart MUltipleXed Irc
//
// Copyright (c) 2016 Andrés G. Aragoneses
//
// Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

using Mono.Addins;

[assembly:AddinRoot("smuxi-engine", "1.1")]
[assembly:AddinDescription("This add-in root provides the engine extension point for add-in protocols to hook")]
[assembly:ExtensionPoint("/Smuxi/Server/Engine", NodeName="Engine")]
4 changes: 4 additions & 0 deletions src/Engine/Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="AddinHost.cs" />
<Compile Include="CommandModel.cs" />
<Compile Include="Engine.cs" />
<Compile Include="FrontendManager.cs" />
Expand Down Expand Up @@ -150,6 +151,9 @@
<Reference Include="System.Xml" />
<Reference Include="System.Web" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="Mono.Addins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
<Package>mono-addins</Package>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
Expand Down
2 changes: 2 additions & 0 deletions src/Engine/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ all: $(ASSEMBLY) $(PROGRAMFILES) $(LINUX_PKGCONFIG)
FILES = \
../AssemblyVersion.cs \
AssemblyInfo.cs \
AddinHost.cs \
CertificateValidator.cs \
CommandModel.cs \
Engine.cs \
Expand Down Expand Up @@ -134,6 +135,7 @@ REFERENCES = \
System.Xml \
Mono.Posix \
Mono.Data.Sqlite \
$(MONO_ADDINS_LIBS) \
$(NINI_LIBS) \
$(LOG4NET_LIBS) \
$(DB4O_LIBS) \
Expand Down
Loading

0 comments on commit c7d0e96

Please sign in to comment.