xsylvain2
Junior Member
MsgPlus! For Evermore
Posts: 17
50 / / –
Joined: Feb 2007
|
RE: removing emotions?
quote: Originally posted by effection
well im having trouble removing emotions from messages sent to me.
I have code that detects all the default emoticons and custom ones as well, i then call code: Message = Message.replace(data, " ");
which replaces the emoticon shortcut code in the incoming message fine when printed to the Debug output but in the actual chat window the emoticon is still there. Any ideas why this isn't working or why it maybe cant be done?
thanks.
To remove emoticon :
code: function RemoveEmoticons(Text) {
// very dodgy routine, this needs to be made better (and custom emoticons need to be included too ;))
var DefIcons = new Array(
'8o\\|', '8\\-\\)', ':[\\-]?D', ':[\\-]?O', ':[\\-]?P', ':[\\-]?S', ':[\\-]?\\$', ':[\\-]?\\(', ':[\\-]?\\)',
':[\\-]?\\@', ':[\\-]?\\[', ':[\\-]?\\|', ':\\-\\#', ':\\-\\*', ':\\^\\)', ':[\\-]?\\>', ':[\\-]?\\<',
'\\(AP\\)', '\\(AU\\)', '\\(A\\)', '\\(BAH\\)', '\\(BRB\\)', '\\(B\\)', '\\(CI\\)', '\\(CO\\)', '\\(C\\)',
'\\(D\\)', '\\(E\\)', '\\(F\\)', '\\(G\\)', '\\(H5\\)', '\\(H\\)', '\\(IP\\)', '\\(I\\)', '\\(K\\)',
'\\(LI\\)', '\\(L\\)', '\\(MO\\)', '\\(MP\\)', '\\(M\\)', '\\(N\\)', '\\(NAH\\)', '\\(O\\)', '\\(PI\\)',
'\\(PL\\)', '\\(P\\)', '\\(R\\)', '\\(SN\\)', '\\(SO\\)', '\\(ST\\)', '\\(S\\)', '\\(TU\\)', '\\(T\\)',
'\\(UM\\)', '\\(U\\)', '\\(W\\)', '\\(XX\\)', '\\(X\\)', '\\(YN\\)', '\\(Y\\)', '\\(Z\\)', '\\(\\&\\)',
'\\(\\*\\)', '\\(\\@\\)', '\\(\\^\\)', '\\(\\{\\)', '\\(\\}\\)', '\\(\\~\\)', '\\+o\\(', '\\^o\\)', '\\|\\-\\)');
for (var i in DefIcons) {
//Debug.Trace('Going through... ' + i + ' => ' + DefIcons[i]);
Text = Text.replace(eval('/' + DefIcons[i] + '/ig'), "");
}
return Text.replace(/\s{2}/ig, " ").replace(/^[\s|\n|\r\n|\t]+|[\s|\n|\r\n|\t]+$/g, "");
}
Like this:
Merlin.Speak(RemoveEmoticons(MsgPlus.RemoveFormatCodes(Contact.Name+Message+TimeD()))+"!")
This exemple was made whit Merlin, but it work. Change Merlin.Speak by other things
This post was edited on 03-14-2007 at 10:16 PM by xsylvain2.
|
|