/usr/share/epic5/script/topicbar is in epic5 1.1.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | #
# This script supplies a topicbar.
# It uses the status_format or status_format1 to format output.
# Currently it "hogs" topline 1.
#
# Shut off with /SET TOPICBAR OFF. The default is ON.
#
# I hope you like it. :-)
#
# - howl@epicsol.org sep'08
#
if (word(2 $loadinfo()) != [pf])
{
load -pf $word(1 $loadinfo());
return;
};
package TOPICBAR;
alias topicbar.update
{
fe (topic 332 331 333 switch_channels switch_windows part server_lost) li
{
fe ($hookctl(list hooks $li)) ho
{
if (hookctl(get $ho package) == 'TOPICBAR')
{
@ hookctl(remove $ho);
};
};
};
if (getset(topicbar) == 'off')
{
topicbar.off;
return;
};
^on #-topic + "*"
{
topicbar.dataupdate $serverctl(from_server) $1-;
};
@ hookctl(set hook $hookctl(last_created) package topicbar);
^on #-332 + "*"
{
topicbar.dataupdate $serverctl(from_server) $1-;
};
@ hookctl(set hook $hookctl(last_created) package topicbar);
^on #-331 + "*"
{
topicbar.dataupdate $serverctl(from_server) $1;
};
@ hookctl(set hook $hookctl(last_created) package topicbar);
^on #-switch_channels + "*"
{
topicbar.winupdate $0;
};
@ hookctl(set hook $hookctl(last_created) package topicbar);
^on #-switch_windows + "*"
{
topicbar.winupdate $3;
};
@ hookctl(set hook $hookctl(last_created) package topicbar);
^on #-part + "*"
{
@ :se = serverctl(from_server);
if ([$0] != serverctl(get $se nick))
return;
topicbar.datapurge $se $1;
};
@ hookctl(set hook $hookctl(last_created) package topicbar);
^on #-server_lost + "*"
{
topicbar.datapurge $0;
};
@ hookctl(set hook $hookctl(last_created) package topicbar);
topicbar.harvest;
};
alias topicbar.off (list default $winrefs())
{
fe ($list) win
{
window $win toplines 0;
window $win topline 0;
};
};
alias topicbar.winupdate (list default $winrefs())
{
fe ($list) win
{
@ :se = windowctl(get $win server);
@ :ch = winchan($win);
@ :it = matchitem(topicbar $se $ch *);
@ :st = afterw($ch $getitem(topicbar $it));
@ :ol = 1;
if (windowctl(get $win double) == 1)
{
@ :for = windowctl(get $win status_format1);
if (!@for)
{
@ for = getset(status_format1);
};
}
else
{
@ :for = windowctl(get $win status_format);
if (!@for)
{
@ for = getset(status_format);
};
};
@ for = before($left(1 $stripcrap(all,ansi $for)) $for);
if (!@ch || it < 0 || #st == 0)
{
window $win toplines 0;
window $win topline $ol;
continue;
};
window $win toplines $ol;
window $win topline $ol "$^"for $^"st";
};
};
alias topicbar.dataupdate
{
@ :item = matchitem(topicbar $0 $1 *);
if (item < 0)
{
@ :item = numitems(topicbar);
};
@ :st = aliasctl(alias exist utf8hack) ? utf8hack($2-) : [$2-];
@ setitem(topicbar $item $0 $1 $st);
xeval -s $0
{
topicbar.winupdate $chanwin($1);
};
};
alias topicbar.flush
{
@ delarray(topicbar);
};
alias topicbar.harvest
{
@ topicbar.harvest = myservers(*);
fe ($topicbar.harvest) server
{
xeval -s $server {@ topicbar.harvest[$server] = mychannels();};
};
topicbar.harvest_next;
};
alias topicbar.harvest_next
{
fe (331 332 333) li
{
fe ($hookctl(list hooks $li)) ho
{
if (hookctl(get hook $ho package) == 'topicbar_harvest')
{
@ hookctl(remove $ho);
};
};
};
@ :server = word(0 $topicbar.harvest);
@ :channel = pop(topicbar.harvest[$server]);
if (!@channel && !@topicbar.harvest[$server])
{
shift topicbar.harvest;
^assign -topicbar.harvest[$server];
@ :server = word(0 $topicbar.harvest);
if (!@topicbar.harvest) ^assign -topicbar.harvest;
@ :channel = pop(topicbar.harvest[$server]);
if (!@channel)
{
^assign -topicbar.harvest;
return;
};
};
@ :p = ["$serverctl(get $server itsname) $channel *"];
^on ^331 $p
{
defer {topicbar.harvest_next;};
@ hookctl(remove $word(0 $hookctl(exec)));
};
@ hookctl(set hook $hookctl(last_created) package topicbar_harvest);
^on ^332 $p
{
@ hookctl(remove $word(0 $hookctl(exec)));
};
@ hookctl(set hook $hookctl(last_created) package topicbar_harvest);
^on ^333 $p
{
@ hookctl(remove $word(0 $hookctl(exec)));
defer {topicbar.harvest_next;};
};
@ hookctl(set hook $hookctl(last_created) package topicbar_harvest);
xeval -s $server {topic $channel;}
};
alias topicbar.list
{
@ :item = 0;
xecho -b Topicbar data;
while ((:st = getitem(topicbar $item)) != '')
{
xecho $item: $st;
@ item++;
}
};
alias topicbar.purge
{
@ :l = [$*];
if (@l == 0)
@ l = [*];
while ((:it = matchitem(topicbar $l)) > -1)
{
@ delitem(topicbar $it);
};
while ((:it = matchitem(topicbar $l *)) > -1)
{
@ delitem(topicbar $it);
};
if (numitems(topicbar) == 0)
@ delarray(topicbar);
};
@ symbolctl(create topicbar);
@ symbolctl(set topicbar 1 builtin_variable type bool);
@ symbolctl(set topicbar 1 builtin_variable script topicbar.update);
@ symbolctl(set topicbar 1 builtin_variable data on);
# vim: tabstop=2 syntax=
|