#1 Handle topic saving in Channel Settings

master
Tomatix 3 years ago
parent 8e1f1508a0
commit 2ea14bca4b
  1. 35
      ChannelSettings.iis

@ -51,6 +51,9 @@ menu channel
return;
}
channelOrig = channel;
channel = strlower(channel);
if (chansethndl[channel] != void && dlgvalidhndl(chansethndl[channel]))
dlgclose(chansethndl[channel]);
@ -71,7 +74,7 @@ menu channel
# Custom attribute to keep track of which channel the dialog has an effect to
dlgsetattr(hndl, "channel", channel);
dlgsetattr(hndl, "title", "Settings for " + channel);
dlgsetattr(hndl, "title", "Settings for " + channelOrig);
dlgsetwidgetattr(hndl, "bantable", "header", list("Mask", "Set by", "Date"));
@ -104,7 +107,8 @@ menu channel
hook numeric(code, params, message)
{
channel = params[1];
channel = strlower(params[1]);
if (channel == void)
return;
@ -113,9 +117,10 @@ hook numeric(code, params, message)
hndl = chansethndl[channel];
# No topic is set.
# No topic is set
if (code == "331") {
topicDone[channel] = true;
currentTopic[channel] = "";
}
# Topic received
@ -125,6 +130,7 @@ hook numeric(code, params, message)
currentTopic[channel] = message;
}
# Topic-by message is always a bit late to the party so must be unmuted separately.
else if (code == "333") {
/unmuteresp 333
}
@ -144,7 +150,7 @@ hook numeric(code, params, message)
# Ban list item received
else if (code == "367") {
handle = chansethndl[params[1]];
handle = chansethndl[channel];
mask = params[2];
setby = params[3];
@ -160,7 +166,7 @@ hook numeric(code, params, message)
# Invites list item received
else if (code == "346") {
handle = chansethndl[params[1]];
handle = chansethndl[channel];
mask = params[2];
setby = params[3];
@ -176,7 +182,7 @@ hook numeric(code, params, message)
# Exceptions list item received
else if (code == "348") {
handle = chansethndl[params[1]];
handle = chansethndl[channel];
mask = params[2];
setby = params[3];
@ -199,6 +205,7 @@ hook numeric(code, params, message)
#
hook mode(sender, target, modes)
{
target = strlower(target);
if (chansethndl[target] == void)
return;
handle = chansethndl[target];
@ -274,6 +281,8 @@ function findAndRemoveFromTable(handle, table, mask)
#
function checkAndHandleAllDone(channel)
{
channel = strlower(channel);
if ((topicDone[channel] == false)
|| (modesDone[channel] == false)
|| (bansDone[channel] == false)
@ -293,6 +302,8 @@ function checkAndHandleAllDone(channel)
#
function parseChannelModes(channel, modes, args)
{
channel = strlower(channel);
hndl = chansethndl[channel];
i = 0;
argi = 0; # Index of 'args', increments on group B and C.
@ -658,9 +669,19 @@ dialog channelsettings
height = 25;
hook clicked => {
channel = dlggetattr(handle, "channel");
newModes = createModeDiff(channel);
if (strlen(newModes) > 0)
/mode %channel %newModes
newTopic = dlggetwidgetattr(handle, "topic", "text");
if (newTopic != currentTopic[channel]) {
if (newTopic == "")
/topic -c %channel
else
/topic %channel %newTopic
}
dlgclose(handle);
}
}
@ -672,6 +693,8 @@ dialog channelsettings
#
function createModeDiff(channel)
{
channel = strlower(channel);
hndl = chansethndl[channel];
unsetmodes = "";

Loading…
Cancel
Save