window_item_destroy((WI_ITEM_REC *) rec);
MODULE_DATA_DEINIT(rec);
- g_free(rec->name);
+ g_free(rec->visible_name);
g_free(rec);
}
+static const char *exec_get_target(WI_ITEM_REC *item)
+{
+ return ((EXEC_WI_REC *) item)->visible_name;
+}
+
static EXEC_WI_REC *exec_wi_create(WINDOW_REC *window, PROCESS_REC *rec)
{
EXEC_WI_REC *item;
item = g_new0(EXEC_WI_REC, 1);
item->type = module_get_uniq_id_str("WINDOW ITEM TYPE", "EXEC");
item->destroy = (void (*) (WI_ITEM_REC *)) exec_wi_destroy;
- item->name = rec->name != NULL ? g_strdup(rec->name) :
+ item->get_target = exec_get_target;
+ item->visible_name = rec->name != NULL ? g_strdup(rec->name) :
g_strdup_printf("%%%d", rec->id);
item->createtime = time(NULL);
/* redirect output to active channel/query */
if (item == NULL)
cmd_return_error(CMDERR_NOT_JOINED);
- target = item->name;
+ target = (char *) window_item_get_target(item);
target_channel = IS_CHANNEL(item);
target_nick = IS_QUERY(item);
} else if (g_hash_table_lookup(optlist, "msg") != NULL) {
3, str, server, item);
g_free(str);
} else if (rec->target_item != NULL) {
- printtext(NULL, rec->target_item->name,
+ printtext(NULL, rec->target_item->visible_name,
rec->level, "%s", text);
} else {
printtext_window(rec->target_win, rec->level, "%s", text);
static void event_text(const char *data, SERVER_REC *server, EXEC_WI_REC *item)
{
- if (!IS_EXEC_WI(item)) return;
+ if (!IS_EXEC_WI(item))
+ return;
net_sendbuffer_send(item->process->out, data, strlen(data));
net_sendbuffer_send(item->process->out, "\n", 1);