diff options
Diffstat (limited to 'weechat')
-rw-r--r-- | weechat/tomsg.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/weechat/tomsg.c b/weechat/tomsg.c index 41ade25..2954a47 100644 --- a/weechat/tomsg.c +++ b/weechat/tomsg.c @@ -88,18 +88,21 @@ static int room_input_cb(const void *room_vp,void *_d,struct t_gui_buffer *buffe struct conndata *conn=room->conn; const char *tosend; const char *p=strchr(input,'\n'); + bool skipfirst=input[0]=='/'&&input[1]=='/'; + bool free_tosend=false; if(p!=NULL){ fprintf(debugf,"room_input_cb: input contained newline <%s>\n",input); - tosend=strdup(input); + tosend=strdup(input+skipfirst); *strchr(tosend,'\n')='\0'; + free_tosend=true; } else { - tosend=input; + tosend=input+skipfirst; } net_sendf(conn->fd,message_net_callback,NULL,"send %s %s",room->name,tosend); weechat_printf(room->buffer,"%s\t%s",conn->username,tosend); - if(tosend!=input){ + if(free_tosend){ free((void*)tosend); } return WEECHAT_RC_OK; |