diff --git a/src/ami.js/messages.js b/src/ami.js/messages.js index d334051..3cf9a33 100644 --- a/src/ami.js/messages.js +++ b/src/ami.js/messages.js @@ -52,18 +52,26 @@ var AmiMessageList = function(parent) { }, child: nameBody, }, - { + ]; + + if(msgInfo.showColon) + messageBody.push({ tag: 'span', attrs: { className: 'msgColon' }, - child: msgInfo.showColon ? ':' : '', - }, - ' ', - { + child: ':', + }); + + if(msgInfo.isAction) { + if(msgInfo.bodyText.indexOf("'") !== 0 || (msgInfo.bodyText.match(/\'/g).length % 2) === 0) + messageBody.push(' '); + } else { + messageBody.push(' '); + messageBody.push({ tag: 'span', attrs: { className: 'msgBreak' }, child: { tag: 'br' }, - }, - ]; + }); + } if(msgInfo.isPM) { if(msgInfo.pmTargetName) @@ -87,7 +95,10 @@ var AmiMessageList = function(parent) { child: messageBody, }); - message.insertAdjacentHTML('beforeend', msgInfo.bodyRaw); + let msgBodyTarget = message; + if(msgInfo.isAction) + message.appendChild(msgBodyTarget = $e({ tag: 'i' })); + msgBodyTarget.insertAdjacentHTML('beforeend', msgInfo.bodyRaw); if(msgInfo.canDelete) message.appendChild($e({ diff --git a/src/ami.js/sockchat.js b/src/ami.js/sockchat.js index 4a2220a..9cf84a9 100644 --- a/src/ami.js/sockchat.js +++ b/src/ami.js/sockchat.js @@ -44,11 +44,12 @@ var AmiSockChat = function(auth) { }; var parseMsgFlags = function(str) { return { - isNameBold: str[0] !== '0', - isNameItalic: str[1] !== '0', - isNameUnderline: str[2] !== '0', - isNameSeparate: str[3] !== '0', - isPrivate: str[4] !== '0', + nameBold: str[0] !== '0', + nameItalics: str[1] !== '0', + nameUnderline: str[2] !== '0', + showColon: str[3] !== '0', + isPM: str[4] !== '0', + isAction: str[1] !== '0' && str[3] === '0', }; }; diff --git a/src/ami.js/ts_20_ui.js b/src/ami.js/ts_20_ui.js index 9e39ff1..c2c2f34 100644 --- a/src/ami.js/ts_20_ui.js +++ b/src/ami.js/ts_20_ui.js @@ -100,6 +100,8 @@ var UI = (function () { nameUnderline: flags[2] !== '0', showColon: flags[3] !== '0', isPM: flags[4] !== '0', + isAction: flags[1] !== '0' && flags[3] === '0', + bodyText: msg, canDelete: 'self' in UserContext && !isNaN(parseInt(msgid)) && !u.isBot()