message: Fix mentions in Cisco Spark (fix for
diff: @@ -210,9 +210,20 @@ function Sparkbot(configuration) {
  if (message.original_message.html) {
  // strip the mention & HTML from the message
  - var pattern = new RegExp('^\<p\>\<spark\-mention .*?data\-object\-id\=\"' + controller.identity.id + '\".*\>.*?\<\/spark\-mention\>');
  + var pattern = new RegExp('^(\<p\>)?\<spark\-mention .*?data\-object\-id\=\"' + controller.identity.id + '\".*\>.*?\<\/spark\-mention\>', 'im');
  + if (!message.original_message.html.match(pattern)) {
  + var encoded_id = controller.identity.id;
  + var decoded = new Buffer(encoded_id,'base64').toString('ascii');
  +
  + // this should look like ciscospark://us/PEOPLE/<id string>
  + var matches;
  + if (matches = decoded.match(/ciscospark\:\/\/.*\/(.*)/im)) {
  + pattern = new RegExp('^(\<p\>)?\<spark\-mention .*?data\-object\-id\=\"' + matches[1] + '\".*\>.*?\<\/spark\-mention\>', 'im');
  + }
  + }
  var action = message.original_message.html.replace(pattern, '');
  +
  // strip the remaining HTML tags
  action = action.replace(/\<.*?\>/img, '');
  