aboutsummaryrefslogtreecommitdiff
path: root/weechat
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-04-16 21:11:05 +0200
committertomsmeding <tom.smeding@gmail.com>2017-04-16 21:11:05 +0200
commit0983e38e640d5168c31ddc6663057268afaefb4a (patch)
treece9496c064392c0f2802dbb823c1b61c9b14f8cd /weechat
parentb24fd5efe6a0029b5e26763066b7b305308b2ef2 (diff)
weechat: Don't beep on history messages
Diffstat (limited to 'weechat')
-rw-r--r--weechat/net.c2
-rw-r--r--weechat/net.h12
-rw-r--r--weechat/tomsg.c6
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 {
@@ -35,10 +29,6 @@ struct net_response{
char **items;
};
struct {
- int nhistory;
- struct net_history_item *history;
- };
- struct {
char *room;
char *username;
i64 timestamp;
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;roomi<conn->nrooms;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){