Not displaying links correctly in messages sent by the AddIn

Hi!

My question may seem trivial, but It kind of bugs me. I am making an AddIn that translates the tag WIKI<Something> in a link to the Wikipedia's page for Something. I tried it out, it worked ok, but when I sent a message to some friends, they complained because the URL was displayed as simple text. However, with normal messages, that is sent by me directly, the URL are normally hihlighted as URL's. My code is below:

using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Microsoft.Messenger;
using System.IO.IsolatedStorage;

public class WikiAddIn : IMessengerAddIn
{
private MessengerClient mclient;
private String language;
IsolatedStorageFile isol;
void IMessengerAddIn.Initialize(MessengerClient mc)
{
mclient = mc;
mclient.AddInProperties.Creator = "Javier Jair Trejo Garcia";
mclient.AddInProperties.Description = "AddIn para referenciar la wikipedia";
mclient.AddInProperties.FriendlyName = "WikiAddIn";
language = "en";
mclient.OutgoingTextMessage += new EventHandler<OutgoingTextMessageEventArgs>(onOutgoingMessage);
isol = IsolatedStorageFile.GetUserStoreForDomain();
}

public void onOutgoingMessage(object sender, OutgoingTextMessageEventArgs ev)
{
if (ev.TextMessage.StartsWith("/"))
{
String message = ev.TextMessage.Substring(1);
if (message.StartsWith("LANG=")){
language = message.Substring(5);
ev.Cancel = true;
}

if (message.Contains("WIKI<")){
Regex x = new Regex("( <=WIKI<)[^>]+");
MatchCollection mac = x.Matches(message);
foreach (Match m in mac)
{
message = message.Replace("WIKI<" + m.ToString() + ">", m.ToString()+"( http://" + language + ".wikipedia.org/wiki/" + m.ToString().Replace(" ", "_")+" )");
}
}
ev.Cancel = true;
mclient.SendTextMessage(message, ev.UserTo);
}
}
}

Do you have any idea why this is happening Also, do you know how can I display a simple link inside Messenger (like <a href="http://something.com"> Something </a>)

Any Help woudl be highly apreciated.




Answer this question

Not displaying links correctly in messages sent by the AddIn

  • refaeldakar

    Well, yes, my friends are in fact using Windows Live Messenger 8 :(

    I kew about the imposibility of the kind of links I need, but just tought I ought to ask :)

    As for the links not displaying correctly, I really don't know what to do, I tought they should be translated automatically. As a matter of fact, they do on my side (i.e. in my window they do show like links), but not on the other's.


  • SimonaM

    I added you to my msn contacts, let's see if we can test to figure out what's wrong...
  • williamguy

    Sorry I am late to the game answering this one. The problem here is that we dump the links transmitted and do not underlne it on the receiving client when it is ssent through an automated fashion. This was done due to viruses transmitted this way. I used to be the security PM here too so I know about this one.
    I think this is good feedback that you would like to have this type of Addin created as it gives us reason to oppen it up in the future. Keep the addins comming and keep the fedback comming. I will add you to my buddy list so I can try out your addin too

    James



  • VoiceOfExperience

    Mmmm, my msn is Jaitrega@hotmail.com, not Jairtrejo@gmail.com, I guess you might get confused because of my profile :S
  • El locolito

    That's weird...
    In the first place, links like <a href="http://something.com"> Something </a> are not possible in Messenger, so forget about that. However, http://en.wikipedia.org/wiki/Some_Subject should work! Are you sure your friends use the latest versions of Messenger It should work in all versions in my opinion, but I am 100% sure about versions starting from MSN 6 till WLM 8.

  • Not displaying links correctly in messages sent by the AddIn