diff options
Diffstat (limited to 'irc_im.c')
| -rw-r--r-- | irc_im.c | 33 | 
1 files changed, 27 insertions, 6 deletions
@@ -112,6 +112,10 @@ static gboolean bee_irc_user_status(bee_t *bee, bee_user_t *bu, bee_user_t *old)  	irc_t *irc = bee->ui_data;  	irc_user_t *iu = bu->ui_data; +	if (set_getbool(&bu->ic->acc->set, "offline_is_away") && !(bu->flags & BEE_USER_ONLINE)) { +		bu->flags |= (BEE_USER_ONLINE | BEE_USER_AWAY); +	} +  	/* Do this outside the if below since away state can change without  	   the online state changing. */  	iu->flags &= ~IRC_USER_AWAY; @@ -136,7 +140,8 @@ static gboolean bee_irc_user_status(bee_t *bee, bee_user_t *bu, bee_user_t *old)  			   one QUIT instead of possibly many (in case of  			   multiple control chans). If there's a channel that  			   shows offline people, a JOIN will follow. */ -			if (set_getbool(&bee->set, "offline_user_quits")) { +			if (set_getbool(&bee->set, "offline_user_quits") && +					set_getbool(&bu->ic->acc->set, "offline_user_quits")) {  				irc_user_quit(iu, "Leaving...");  			}  		} @@ -224,9 +229,16 @@ static gboolean bee_irc_user_msg(bee_t *bee, bee_user_t *bu, const char *msg_, g  	char *wrapped, *ts = NULL;  	char *msg = g_strdup(msg_);  	char *message_type = "PRIVMSG"; +	char *tags = NULL;  	GSList *l; - -	if (sent_at > 0 && set_getbool(&irc->b->set, "display_timestamps")) { +	struct tm msg_time; + +	if (sent_at > 0 && (irc->caps & CAP_SERVER_TIME)) { +		gmtime_r(&sent_at, &msg_time); +		tags = g_strdup_printf("time=%04d-%02d-%02dT%02d:%02d:%02d.000Z", +		    msg_time.tm_year + 1900, msg_time.tm_mon + 1, msg_time.tm_mday, +		    msg_time.tm_hour, msg_time.tm_min, msg_time.tm_sec); +	} else if (sent_at > 0 && set_getbool(&irc->b->set, "display_timestamps")) {  		ts = irc_format_timestamp(irc, sent_at);  	} @@ -299,13 +311,14 @@ static gboolean bee_irc_user_msg(bee_t *bee, bee_user_t *bu, const char *msg_, g  	}  	wrapped = word_wrap(msg, 425); -	irc_send_msg(src_iu, message_type, dst, wrapped, prefix); +	irc_send_tagged_msg(src_iu, message_type, dst, wrapped, prefix, tags);  	g_free(wrapped);  cleanup:  	g_free(prefix);  	g_free(msg);  	g_free(ts); +	g_free(tags);  	return TRUE;  } @@ -663,19 +676,27 @@ static gboolean bee_irc_chat_msg(bee_t *bee, struct groupchat *c, bee_user_t *bu  	irc_user_t *iu = flags & OPT_SELFMESSAGE ? irc->user : bu->ui_data;  	irc_channel_t *ic = c->ui_data;  	char *wrapped, *ts = NULL; +	char *tags = NULL; +	struct tm msg_time;  	if (ic == NULL) {  		return FALSE;  	} -	if (sent_at > 0 && set_getbool(&bee->set, "display_timestamps")) { +	if (sent_at > 0 && (irc->caps & CAP_SERVER_TIME)) { +		gmtime_r(&sent_at, &msg_time); +		tags = g_strdup_printf("time=%04d-%02d-%02dT%02d:%02d:%02d.000Z", +		    msg_time.tm_year + 1900, msg_time.tm_mon + 1, msg_time.tm_mday, +		    msg_time.tm_hour, msg_time.tm_min, msg_time.tm_sec); +	} else if (sent_at > 0 && set_getbool(&bee->set, "display_timestamps")) {  		ts = irc_format_timestamp(irc, sent_at);  	}  	wrapped = word_wrap(msg, 425); -	irc_send_msg(iu, "PRIVMSG", ic->name, wrapped, ts); +	irc_send_tagged_msg(iu, "PRIVMSG", ic->name, wrapped, ts, tags);  	g_free(ts);  	g_free(wrapped); +	g_free(tags);  	return TRUE;  }  | 
