IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Howto: remove web limitations from plugin SDK, for all languages, the easy way
timothy
post Jun 27 2006, 08:29 PM
Post #1



Group Icon

Group: Timothy
Posts: 771
Joined: 1-September 04
From: Netherlands
Member No.: 3



Kudos to Strandberg from the MSDN forum for pointing out strong naming and gac.

The messenger plug-in SDK is a tad useless because it doesn’t allows you to read/write to files, make web calls, create proper forms, or actually do anything but sending pre-made messages. This is caused by the fact that its running with the web limitation by default.

So here's the easy way to register your plug-in and allow it to use everything C#/VB.net/J#/etc has to offer, like:

System.IO;
System.Xml;
System.Interop;


Step one. Sign your DLL file, this allows your plugin to be identified propperly by the system. (also see jpg attachment)

1 - Select from the project menu the option "<myplugin> properties".
2 - Choose the tab Signing.
3 - Check Sign the assembly
4 - From the dropdown choose <new>
5 - Enter your key name (ie your plug-in name) and a password
6 - Now your plug-in will be signed every time you recompile it

Step two. Register your plug-in with GAC. This will place your plug-in in a cache so if you change something you'd need to un-register it first and reregister it.

Step two A. Register it manually:

Open a explorer and goto C:\windows\assembly. Here you will find your GAC cache, drag drop your signed plugin here and it will be added to the list. If you recompile your plugin, you will need to remove the old cache first, then drag drop the new file.

Step two B. Register it (semi) automatic:

Place the following lines in a bat file in your dll folder, and run it everytime you recompile it:
CODE

echo off
cls
echo ----------------
"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /u <pluginspace>
echo ----------------
"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /i <pluginspace>.dll
echo ----------------
pause


*) Replace <pluginspace> with the assembly's name space, you can find this in the dll's name. So if you have a plug-in called MyPlugin.dll the <pluginspace> would be MyPlugin.

**) Make sure the path to the .net 2.0 SDK is the same, otherwise try to locate gacutil.exe on your own computer.
Attached File(s)
Attached File  sign.jpg ( 99.86K ) Number of downloads: 882
 
Go to the top of the page
 
+Quote Post
deAd
post Jun 27 2006, 08:42 PM
Post #2


Hi.
*******

Group: Members
Posts: 996
Joined: 10-October 05
Member No.: 13,337



So then when you want to distribute it, what do you do? Send these instructions to the user?

Good work though =)
Go to the top of the page
 
+Quote Post
timothy
post Jun 27 2006, 09:21 PM
Post #3



Group Icon

Group: Timothy
Posts: 771
Joined: 1-September 04
From: Netherlands
Member No.: 3



1) make a installer register it
2) instruct users to drag drop it
3) something something I dont know msn_tongue.gif

Here's the source of a little RSS bot I've just made, you need to compile it as stated above under the name blobz.messRSS.dll. It will send the latest mess headlines when somebody types *mess css* in the convo.

CODE

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Microsoft.Messenger;

namespace blobz
{
   class messRSS : Microsoft.Messenger.IMessengerAddIn
   {
       public Microsoft.Messenger.MessengerClient messenger = new Microsoft.Messenger.MessengerClient();
       public XmlDocument rss = new XmlDocument();
       //
       public void Initialize(MessengerClient e)
       {

           rss.Load("http://mess.be/news.xml");
           //
           // Create object
           //
           messenger = e;
           //
           // Hello Information (shown in add-in menu)
           //
           messenger.AddInProperties.Creator = "Timothy";
           messenger.AddInProperties.Description = "Mess RSS";
           messenger.AddInProperties.FriendlyName = "Mess RSS";
           messenger.AddInProperties.Url = new System.Uri("http://www.blobz.net");
           //
           // Initialize events
           //
           messenger.IncomingTextMessage += new EventHandler<IncomingTextMessageEventArgs>(messenger_IncomingTextMessage);
       }

       void messenger_IncomingTextMessage(object sender, IncomingTextMessageEventArgs e)
       {
           Microsoft.Messenger.User from = (Microsoft.Messenger.User)e.UserFrom;
           if (e.TextMessage == "*mess rss*")
           {
               string output = "";
               System.Xml.XmlNodeList temp = rss.GetElementsByTagName("title");
               for (int i = 0; i < temp.Count; i++)
               {
                   output += temp[i].InnerText.ToString() + "\r\n";
               }
               messenger.SendTextMessage(output, from);
           }
       }
   }
}
Go to the top of the page
 
+Quote Post
Lambert
post Jun 28 2006, 04:02 AM
Post #4


Mess.beanie
*

Group: Members
Posts: 10
Joined: 27-June 06
Member No.: 19,622



Timothy, you are my hero.
Go to the top of the page
 
+Quote Post
Stigmata
post Jun 28 2006, 09:18 AM
Post #5


Mess.betterthanyours
Group Icon

Group: Supervisor
Posts: 1,951
Joined: 5-September 04
From: Uk
Member No.: 79



converted to vb.net

throws an error on this line:
rss.Load("http://mess.be/news.xml")

QUOTE
---------------------------
Windows Live Messenger
---------------------------
The add-in "Testbot.dll" could not be turned on.  80004003
---------------------------
OK  Help 
---------------------------


changed the url and everything msn_sad.gif
Go to the top of the page
 
+Quote Post
FusionBoy
post Jun 28 2006, 09:22 AM
Post #6


Mess.beanie
*

Group: Members
Posts: 20
Joined: 25-July 05
Member No.: 10,899



For that the client running theme, you can probably include that in an installation maybe? msn_tongue.gif
Go to the top of the page
 
+Quote Post
timothy
post Jun 28 2006, 10:38 AM
Post #7



Group Icon

Group: Timothy
Posts: 771
Joined: 1-September 04
From: Netherlands
Member No.: 3



80004003 is a general code error, could be anywhere in your dll,
Go to the top of the page
 
+Quote Post
Lambert
post Jun 28 2006, 11:22 AM
Post #8


Mess.beanie
*

Group: Members
Posts: 10
Joined: 27-June 06
Member No.: 19,622



Im getting an error when I try to load Mario's add-in, it used to work fine.

I wonder what microsoft changed?
Go to the top of the page
 
+Quote Post
timothy
post Jun 28 2006, 11:25 AM
Post #9



Group Icon

Group: Timothy
Posts: 771
Joined: 1-September 04
From: Netherlands
Member No.: 3



If you wish to deploy your plugin you will need to make a installer, this can easily be done with VS2005 pro, creating a setup project:
Attached File(s)
Attached File  installer.jpg ( 194.34K ) Number of downloads: 474
 
Go to the top of the page
 
+Quote Post
Lambert
post Jun 28 2006, 11:32 AM
Post #10


Mess.beanie
*

Group: Members
Posts: 10
Joined: 27-June 06
Member No.: 19,622



Plugins that used to work aren't working anymore, Ive noticed several people reporting this problem, apparently Microsoft have disabled the feature from the server.. Which is plausible I suppose.
Go to the top of the page
 
+Quote Post
timothy
post Jun 28 2006, 11:35 AM
Post #11



Group Icon

Group: Timothy
Posts: 771
Joined: 1-September 04
From: Netherlands
Member No.: 3



Still works here msn_happy.gif
Go to the top of the page
 
+Quote Post
timothy
post Jun 28 2006, 12:01 PM
Post #12



Group Icon

Group: Timothy
Posts: 771
Joined: 1-September 04
From: Netherlands
Member No.: 3



CODE

Imports System
Imports System.Xml
Imports Microsoft.Messenger

Public Class messRSSvb
   Implements IMessengerAddIn
   Public WithEvents Mess As MessengerClient
   Public rss As New XmlDocument
   Public noodles As Xml.XmlNodeList
   Public output As String
   '
   Public Sub Initialize(ByVal messenger As Microsoft.Messenger.MessengerClient) Implements Microsoft.Messenger.IMessengerAddIn.Initialize
       Mess = messenger
       '
       rss.Load("http://www.mess.be/news.xml")
       '
       messenger.AddInProperties.Creator = "Timothy"
       messenger.AddInProperties.Description = "messRSS vb"
       messenger.AddInProperties.FriendlyName = "messRSS vb"
   End Sub

   Private Sub Mess_IncomingTextMessage(ByVal sender As Object, ByVal e As Microsoft.Messenger.IncomingTextMessageEventArgs) Handles Mess.IncomingTextMessage
       If e.TextMessage = "*mess rss*" Then
           output = ""
           noodles = rss.GetElementsByTagName("title")
           Dim i As Integer
           For i = 0 To noodles.Count - 1
               output = output & vbCrLf & noodles(i).InnerText
           Next i
           Mess.SendTextMessage(output, e.UserFrom)
       End If
   End Sub
End Class


How I hate VB.net, but this is the RSS bot for VB.net
Go to the top of the page
 
+Quote Post
Lambert
post Jun 28 2006, 12:47 PM
Post #13


Mess.beanie
*

Group: Members
Posts: 10
Joined: 27-June 06
Member No.: 19,622



Thanks, I used your vb code to create my own plugin, theres just one problem.. Everything works great until I try to add the plugin into msgr -- I get the error -

---------------------------
Windows Live Messenger
---------------------------
The add-in MesslabsAddin.dll can't load. Make sure that the name of the add-in class matches the file name of the add-in assembly.
---------------------------
OK Help
---------------------------

I used the same name for everything - form, project, signing etc.. As you can see in the screenshot I uploaded.

This post has been edited by Lambert: Jun 28 2006, 12:48 PM
Attached File(s)
Attached File  Untitled_1_copy.gif ( 74.73K ) Number of downloads: 281
 
Go to the top of the page
 
+Quote Post
timothy
post Jun 28 2006, 04:23 PM
Post #14



Group Icon

Group: Timothy
Posts: 771
Joined: 1-September 04
From: Netherlands
Member No.: 3



check the Root namespace.

Plugins are named like this:

rootnamespace.assemblyname.dll

So if you have a plugin called Myplugin.dll , the rootnamespace needs to be blank, otherwise you need to change the assembly name to myrootnamespace.mypluginname.dll
Go to the top of the page
 
+Quote Post
thomasa88
post Jun 28 2006, 09:10 PM
Post #15


Mess.bean
*

Group: Members
Posts: 1
Joined: 22-February 06
Member No.: 17,275



Anyone knows where to get FusionInstall.cs for .net 2? Ive heard it should be in the sdk but i cannot find it :/

Fusioninstall.cs uses some undocumented thingies so you can register something to GAC programmatically
Go to the top of the page
 
+Quote Post
Lambert
post Jun 29 2006, 01:11 AM
Post #16


Mess.beanie
*

Group: Members
Posts: 10
Joined: 27-June 06
Member No.: 19,622



Thanks tim, works like a charm msn_wink.gif

Edit: Is there any way to "Turn on" a plugin without having to set your status to Away ?

This post has been edited by Lambert: Jun 29 2006, 01:38 AM
Go to the top of the page
 
+Quote Post
Lambert
post Jun 29 2006, 01:44 AM
Post #17


Mess.beanie
*

Group: Members
Posts: 10
Joined: 27-June 06
Member No.: 19,622



QUOTE(Lambert @ Jun 29 2006, 01:11 AM)
Thanks tim, works like a charm msn_wink.gif

Edit: Is there any way to "Turn on" a plugin without having to set your status to Away ?
[right][snapback]138747[/snapback][/right]



also note: if your not logged into an administrator account you will have problems with internet stuff
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 20th February 2018 - 07:39 PM
© 2004-2008 Seb Skuse, mess.be.
MessForum v6.1.4 - created for, and for use only by mess.be.