This code block doesn't follow the Smuxi CS at all and needs to be moved to MessageBuilder.ParseSmartLinks() in that loop that goes through all images and replaces the names.