diff options
Diffstat (limited to 'weechat')
-rw-r--r-- | weechat/tomsg.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/weechat/tomsg.c b/weechat/tomsg.c index 03f0f5e..b56b08c 100644 --- a/weechat/tomsg.c +++ b/weechat/tomsg.c @@ -75,12 +75,17 @@ static void display_message( const char *message, int64_t msgid, bool is_reply, - bool is_history + bool is_history, + bool is_self_msg ) { char tags[128]; - snprintf(tags, sizeof tags, "tomsgid_%" PRIi64 "%s%s", + snprintf(tags, sizeof tags, "tomsgid_%" PRIi64 ",nick_%s,log1%s%s", msgid, - room->nmembers == 2 && !is_history ? ",notify_private" : ",notify_message", + username, + is_history ? ",notify_none,no_log" + : is_self_msg ? ",notify_none" + : room->nmembers == 2 ? ",notify_private" + : ",notify_message", is_reply ? ",tomsg_reply" : ""); weechat_printf_date_tags( @@ -352,7 +357,7 @@ static int room_input_cb(const void *room_vp,void *_d,struct t_gui_buffer *buffe payload->ids[0]=room->next_pending_id++; payload->replyid=-1; net_sendf(conn->fd,message_net_callback,payload,"send %s -1 %s",room->name,tosend); - display_message(room,gettimestamp(),conn->username,tosend,-payload->ids[0],false,false); + display_message(room,gettimestamp(),conn->username,tosend,-payload->ids[0],false,false,true); if(free_tosend){ free((void*)tosend); @@ -470,8 +475,8 @@ static void push_net_callback(int fd,struct net_response res,void *payload){ debugf("Found reply msgid=%" PRIi64 " replyid=%" PRIi64 "\n",res.msgid,res.replyid); char str[128]; snprintf(str,sizeof str,"%s> ...",weechat_color("green")); - display_message(room,res.timestamp,res.username,str,res.msgid,true,res.type==NET_HISTORY); - display_message(room,res.timestamp,"",res.message,res.msgid,false,res.type==NET_HISTORY); + display_message(room,res.timestamp,res.username,str,res.msgid,true,res.type==NET_HISTORY,false); + display_message(room,res.timestamp,"",res.message,res.msgid,false,res.type==NET_HISTORY,false); struct room_and_msgid *payload=malloc(sizeof(struct room_and_msgid)); assert(payload); @@ -479,7 +484,7 @@ static void push_net_callback(int fd,struct net_response res,void *payload){ payload->msgid=res.msgid; net_sendf(fd,reply_get_message_net_callback,payload,"get_message %" PRIi64,res.replyid); } else { - display_message(room,res.timestamp,res.username,res.message,res.msgid,false,res.type==NET_HISTORY); + display_message(room,res.timestamp,res.username,res.message,res.msgid,false,res.type==NET_HISTORY,false); } } else if(res.type==NET_JOIN){ weechat_printf(room->buffer,"%sUser %s joined this room",netpfx,res.username); @@ -867,8 +872,8 @@ static int cmd_tomsg_cb( char str[128]; snprintf(str,sizeof str,"%s> ...",weechat_color("green")); i64 timestamp=gettimestamp(); - display_message(room,timestamp,room->conn->username,str,-msg_payload->ids[0],true,false); - display_message(room,timestamp,"",message_body,-msg_payload->ids[1],false,false); + display_message(room,timestamp,room->conn->username,str,-msg_payload->ids[0],true,false,true); + display_message(room,timestamp,"",message_body,-msg_payload->ids[1],false,false,true); // TODO: do get_payload in message_net_callback // struct room_and_msgid *get_payload=malloc(sizeof(struct room_and_msgid)); |