CIRCServer.onNotice Member
Syntax
object.onNotice(e);
Arguments
Argument | Summary |
---|---|
e |
Returns
Remarks
See Also
Source Code
function serv_notice_privmsg (e)
{
var targetName = e.params[1];
if (this.userModes)
{
// Strip off one (and only one) user mode prefix.
for (var i = 0; i < this.userModes.length; i++)
{
if (targetName[0] == this.userModes[i].symbol)
{
e.msgPrefix = this.userModes[i];
targetName = targetName.substr(1);
break;
}
}
}
/* setting replyTo provides a standard place to find the target for */
/* replies associated with this event. */
if (arrayIndexOf(this.channelTypes, targetName[0]) != -1)
{
e.channel = new CIRCChannel(this, null, targetName);
if ("user" in e)
e.user = new CIRCChanUser(e.channel, e.user.unicodeName);
e.replyTo = e.channel;
e.set = "channel";
}
else if (!("user" in e))
{
e.set = "network";
e.destObject = this.parent;
return true;
}
else
{
e.set = "user";
e.replyTo = e.user; /* send replies to the user who sent the message */
}
// The CAPAB IDENTIFY-MSG stuff for freenode
if (this.capab.identifyMsg)
{
e.identifyMsg = false;
var flag = e.params[2].substring(0,1);
if (flag == "+")
{
e.identifyMsg = true;
e.params[2] = e.params[2].substring(1);
}
else if (flag == "-")
{
e.params[2] = e.params[2].substring(1);
}
else
{
// Just print to console on failure - or we'd spam the user
dd("Warning: IDENTIFY-MSG is on, but there's no message flags");
}
}
if (e.params[2].search (/^\x01[^ ]+.*\x01$/) != -1)
{
if (e.code == "NOTICE")
{
e.type = "ctcp-reply";
e.destMethod = "onCTCPReply";
}
else // e.code == "PRIVMSG"
{
e.type = "ctcp";
e.destMethod = "onCTCP";
}
e.set = "server";
e.destObject = this;
}
else
{
e.msg = e.decodeParam(2, e.replyTo);
e.destObject = e.replyTo;
}
return true;
}