typedef struct channel_t {
server_t *server;
char *name;
+ char *topic;
FILE *log;
int seen;
channel_t *next;
if (match(cmd, "TOPIC")) {
chan = find_dest(srv, arg, 1);
chan_notice(chan, "Topic changed to %s", msg);
+ strset(&chan->channel.topic, msg);
}
- if (match(cmd, "331") || match(cmd, "322")) {
+ if (match(cmd, "331") || match(cmd, "332")) {
chan = find_dest(srv, arg, 1);
chan_notice(chan, "Topic: %s", msg);
+ strset(&chan->channel.topic, msg);
}
if (match(cmd, "353") && prefix(arg, "@", &arg)) {
chan = find_dest(srv, arg, 1);
/* Drawing functions */
void draw_header(void)
{
+ const char *topic = "No Topic";
+ if (focus && focus->channel && focus->channel->topic)
+ topic = focus->channel->topic;
attron(color_title);
- move(0, 0);
- clrtoeol();
- printw("%-*s", COLS, "Header Bar");
+ mvhline(0, 0, ' ', COLS);
+ mvprintw(0, 0, " %s", topic);
attroff(color_title);
}
attron(color_title);
mvhline(LINES-2, 0, ' ', COLS);
move(LINES-2, 0);
- printw("Windows:");
+ printw(" Windows:");
if (!windows)
printw(" none");
for (window_t *cur = windows; cur; cur = cur->next) {
srv->stamp = timegm(&tm);
}
}
+ if (match(end, "subject") && chan) {
+ strset(&chan->channel.topic, data);
+ }
if (match(end, "body")) {
strset(&srv->body, data);
}