char line[MAX_LINE_SIZE+1];
struct handle_info *hi;
char *sepstr = NULL;
- int sepsize = 0;
+ unsigned int sepsize = 0;
if (IsChannelName(to) || *to == '$') {
message_dest = NULL;
if (irc_send)
{} /* use that function */
- else if (hi)
+ else if(IsChannelName(to)) {
+ irc_send = irc_privmsg;
+ }
+ else if (message_dest->no_notice) {
+ irc_send = irc_privmsg;
+ }
+ else if (hi) {
irc_send = HANDLE_FLAGGED(hi, USE_PRIVMSG) ? irc_privmsg : irc_notice;
- else
- irc_send = IsChannelName(to) ? irc_privmsg : irc_notice;
+ }
+ else {
+ irc_send = irc_notice;
+ }
/* Limit size to how much we can show at once */
if (size > sizeof(line))
line[pos++] = ' ';
}
line[pos] = 0;
- sepsize = strlen_vis(line);
- sepstr = malloc(sepsize + 1);
- memset(sepstr, '-', sepsize);
- sepstr[sepsize] = 0;
- if(hi && hi->userlist_style != HI_STYLE_CLEAN)
+
+ /* Dont show ---- bars in 'clean' style. */
+ if(!(hi && hi->userlist_style == HI_STYLE_CLEAN)) {
+ //sepsize = strlen_vis(line);
+ sepsize = tot_width * nreps;
+ sepstr = malloc(sepsize + 1);
+ memset(sepstr, '-', sepsize);
+ sepstr[sepsize] = 0;
irc_send(from, to, sepstr); /* ----------------- */
- irc_send(from, to, line); /* alpha beta roe */
- if(hi && hi->userlist_style != HI_STYLE_CLEAN)
+ }
+ irc_send(from, to, line); /* alpha beta roe */
+ if(!(hi && hi->userlist_style == HI_STYLE_CLEAN))
irc_send(from, to, sepstr); /* ----------------- */
ii = 1;
}
/* Send the table. */
for (jj=0, pos=0, reps=0; ii<table.length; ) {
while (1) {
+ int PAD_COL_LEFT = false;
+ if(table.flags & TABLE_PAD_LEFT || str_is_number(table.contents[ii][jj]))
+ PAD_COL_LEFT = true;
len = strlen(table.contents[ii][jj]);
spaces = max_width[jj] - len;
- if (table.flags & TABLE_PAD_LEFT)
+ //if (table.flags & TABLE_PAD_LEFT)
+ if(PAD_COL_LEFT)
while (spaces--) line[pos++] = ' ';
memcpy(line+pos, table.contents[ii][jj], len);
pos += len;
break;
}
}
- if (!(table.flags & TABLE_PAD_LEFT))
+ //if (!(table.flags & TABLE_PAD_LEFT))
+ if(!PAD_COL_LEFT)
while (spaces--)
line[pos++] = ' ';
line[pos++] = ' ';
}
}
- if (!(table.flags & TABLE_NO_HEADERS)) {
- /* Send end bar & free its memory */
- if(sepsize > 5)
+ /* Send end bar */
+ if (!(table.flags & TABLE_NO_HEADERS) &&
+ !(table.flags & TABLE_NO_FOOTER) &&
+ !(hi && hi->userlist_style == HI_STYLE_CLEAN)) {
+ char endstr[MAX_LINE_SIZE+1];
+ sprintf(endstr, "End (%d rows)", table.length-1);
+
+ /* Copy above into the sepstr, centered */
+ if(sepsize > strlen(endstr)+2)
{
- sepstr[sepsize/2-1] = 'E';
- sepstr[sepsize/2] = 'n';
- sepstr[sepsize/2+1]= 'd';
+ char* eptr = endstr;
+ char* sptr = sepstr+(sepsize/2) - (strlen(endstr)+2)/2;
+ while(*eptr)
+ *sptr++ = *eptr++;
}
-
- if(hi && hi->userlist_style != HI_STYLE_CLEAN)
- irc_send(from, to, sepstr);
- free(sepstr);
+ irc_send(from, to, sepstr);
}
+ if(!(hi && hi->userlist_style == HI_STYLE_CLEAN))
+ free(sepstr);
+
if (!(table.flags & TABLE_NO_FREE)) {
/* Deallocate table memory (but not the string memory). */
for (ii=0; ii<table.length; ii++)
unsigned int size, ipos, pos, length, chars_sent, use_color;
unsigned int expand_pos, expand_ipos, newline_ipos;
char line[MAX_LINE_SIZE];
+ struct service *service;
+ static char* trigger = NULL;
if (IsChannelName(dest) || *dest == '$') {
message_dest = NULL;
size = DEFAULT_LINE_SIZE;
switch (msg_type & 3) {
case 0:
- irc_send = irc_notice;
+ if(message_dest && message_dest->no_notice)
+ irc_send = irc_privmsg;
+ else
+ irc_send = irc_notice;
break;
case 2:
irc_send = irc_wallchops;
case 'H':
value = handle ? handle->handle : "Account";
break;
+ case '!': /* Command Char for chanserv */
+ if(!trigger)
+ trigger = calloc(sizeof(*trigger), 2);
+ if(chanserv && (service = service_find(chanserv->nick)))
+ trigger[0] = service->trigger;
+ else
+ trigger[0] = '!';
+ value = trigger;
+ break;
#define SEND_LINE(TRUNCED) do { \
line[pos] = 0; \
if (pos > 0) { \