From 0983e38e640d5168c31ddc6663057268afaefb4a Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sun, 16 Apr 2017 21:11:05 +0200 Subject: weechat: Don't beep on history messages --- weechat/net.c | 2 +- weechat/net.h | 12 +----------- weechat/tomsg.c | 6 +++++- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/weechat/net.c b/weechat/net.c index 656a7a5..1618130 100644 --- a/weechat/net.c +++ b/weechat/net.c @@ -287,7 +287,7 @@ void net_handle_recv(int fd,const char *msg){ i64 textlen=msglen-(textp-msg); struct net_response res; - res.type=NET_MESSAGE; + res.type=NET_HISTORY; const char *endp; res.timestamp=strtoll(stampp,(char**)&endp,10); if(endp-stampp!=stamplen){ diff --git a/weechat/net.h b/weechat/net.h index 335664c..6348a89 100644 --- a/weechat/net.h +++ b/weechat/net.h @@ -11,19 +11,13 @@ enum net_response_type{ NET_NAME, NET_LIST, NET_PONG, - NET_HISTORY, NET_MESSAGE, + NET_HISTORY, NET_JOIN, NET_INVITE, NET_ONLINE, }; -struct net_history_item{ - char *username; - i64 timestamp; - char *message; -}; - struct net_response{ enum net_response_type type; union { @@ -34,10 +28,6 @@ struct net_response{ int nitems; char **items; }; - struct { - int nhistory; - struct net_history_item *history; - }; struct { char *room; char *username; diff --git a/weechat/tomsg.c b/weechat/tomsg.c index 2103406..90e43b0 100644 --- a/weechat/tomsg.c +++ b/weechat/tomsg.c @@ -194,7 +194,7 @@ static void push_net_callback(int fd,struct net_response res,void *payload){ fprintf(debugf,"push_net_callback(fd=%d,res={.type=%d})\n",fd,res.type); struct conndata *conn=weechat_hashtable_get(conntable,&fd); assert(conn); - if(res.type==NET_MESSAGE||res.type==NET_JOIN||res.type==NET_INVITE){ + if(res.type==NET_MESSAGE||res.type==NET_HISTORY||res.type==NET_JOIN||res.type==NET_INVITE){ i64 roomi; for(roomi=0;roominrooms;roomi++){ if(strcmp(conn->rooms[roomi]->name,res.room)==0){ @@ -215,6 +215,10 @@ static void push_net_callback(int fd,struct net_response res,void *payload){ weechat_printf_date_tags( room->buffer,res.timestamp/1000000LL,private?"notify_private":"notify_message", "%s\t%s",res.username,res.message); + } else if(res.type==NET_HISTORY){ + weechat_printf_date_tags( + room->buffer,res.timestamp/1000000LL,NULL, + "%s\t%s",res.username,res.message); } else if(res.type==NET_JOIN){ weechat_printf(room->buffer,"%sUser %s joined this room",netpfx,res.username); if(room->buffer_nickgroup){ -- cgit v1.2.3-70-g09d2