diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-04-15 18:53:00 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-04-15 19:04:18 +0200 |
commit | 95eec6affee455e1ba935a1781495682b2ee7e9a (patch) | |
tree | 0bec9887dc2d36c04413e0e1a5afa1f11a076455 /weechat/tomsg.c | |
parent | e6bb11fc2801ca5be48ddceeecc5001cd5c39ef6 (diff) |
weechat: Handle _push online
Diffstat (limited to 'weechat/tomsg.c')
-rw-r--r-- | weechat/tomsg.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/weechat/tomsg.c b/weechat/tomsg.c index 01aa995..6e9042b 100644 --- a/weechat/tomsg.c +++ b/weechat/tomsg.c @@ -155,7 +155,6 @@ static void isonline_net_callback(int fd,struct net_response res,void *payload){ free(rn); struct t_gui_nick *nickp=weechat_nicklist_search_nick(room->buffer,room->buffer_nickgroup,name); - fprintf(debugf," nickp=%p: setting '%s' to '%s'\n",nickp,name,color); free(name); if(nickp==NULL)return; weechat_nicklist_nick_set(room->buffer,nickp,"color",color); @@ -232,6 +231,18 @@ static void push_net_callback(int fd,struct net_response res,void *payload){ } else { assert(false); } + } else if(res.type==NET_PONG){ + // ok + } else if(res.type==NET_ONLINE){ + fprintf(debugf," NET_ONLINE with username='%s' num='%" PRIi64 "'\n",res.online.username,res.online.num); + const char *color=res.online.num>0 ? "weechat.color.chat_nick" : "weechat.color.nicklist_away"; + for(i64 i=0;i<conn->nrooms;i++){ + struct t_gui_nick *nickp=weechat_nicklist_search_nick( + conn->rooms[i]->buffer,conn->rooms[i]->buffer_nickgroup,res.online.username); + if(nickp!=NULL){ + weechat_nicklist_nick_set(conn->rooms[i]->buffer,nickp,"color",color); + } + } } else { fprintf(debugf,"push_net_callback: unknown response type %d\n",res.type); } |