Changeset f7cc734
- Timestamp:
- 2018-07-31T04:41:25Z (6 years ago)
- Branches:
- master
- Children:
- 9767d03
- Parents:
- c82e4ca
- git-author:
- Philippe Daouadi <philippe@…> (15-03-17 17:06:52)
- git-committer:
- dequis <dx@…> (31-07-18 04:41:25)
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
dcc.c
rc82e4ca rf7cc734 214 214 df->ft->file_name, ipaddr, port, df->ft->file_size); 215 215 216 irc_send_msg_raw(iu, "PRIVMSG", iu->irc->user->nick, cmd );216 irc_send_msg_raw(iu, "PRIVMSG", iu->irc->user->nick, cmd, 0); 217 217 218 218 g_free(cmd); -
irc.h
rc82e4ca rf7cc734 76 76 CAP_AWAY_NOTIFY = (1 << 3), 77 77 CAP_USERHOST_IN_NAMES = (1 << 4), 78 CAP_SERVER_TIME = (1 << 5), 78 79 } irc_cap_flag_t; 79 80 … … 342 343 void irc_send_whois(irc_user_t *iu); 343 344 void irc_send_who(irc_t *irc, GSList *l, const char *channel); 344 void irc_send_msg(irc_user_t *iu, const char *type, const char *dst, const char *msg, const char *prefix );345 void irc_send_msg_raw(irc_user_t *iu, const char *type, const char *dst, const char *msg);345 void irc_send_msg(irc_user_t *iu, const char *type, const char *dst, const char *msg, const char *prefix, time_t ts); 346 void irc_send_msg_raw(irc_user_t *iu, const char *type, const char *dst, const char* tags, const char *msg); 346 347 void irc_send_msg_f(irc_user_t *iu, const char *type, const char *dst, const char *format, ...) G_GNUC_PRINTF(4, 5); 347 348 void irc_send_nick(irc_user_t *iu, const char *new_nick); … … 364 365 char *set_eval_timezone(struct set *set, char *value); 365 366 char *irc_format_timestamp(irc_t *irc, time_t msg_ts); 367 char *irc_format_servertime(irc_t *irc, time_t msg_ts); 366 368 char *set_eval_self_messages(struct set *set, char *value); 367 369 -
irc_cap.c
rc82e4ca rf7cc734 43 43 {"away-notify", CAP_AWAY_NOTIFY}, 44 44 {"userhost-in-names", CAP_USERHOST_IN_NAMES}, 45 {"server-time", CAP_SERVER_TIME}, 45 46 {NULL}, 46 47 }; -
irc_channel.c
rc82e4ca rf7cc734 500 500 va_end(params); 501 501 502 irc_send_msg(ic->irc->root, "PRIVMSG", ic->name, text, NULL );502 irc_send_msg(ic->irc->root, "PRIVMSG", ic->name, text, NULL, 0); 503 503 g_free(text); 504 504 } -
irc_commands.c
rc82e4ca rf7cc734 524 524 for lag checks, so try to support that. */ 525 525 if (nick_cmp(NULL, cmd[1], irc->user->nick) == 0) { 526 irc_send_msg(irc->user, "NOTICE", irc->user->nick, cmd[2], NULL );526 irc_send_msg(irc->user, "NOTICE", irc->user->nick, cmd[2], NULL, 0); 527 527 } else if ((iu = irc_user_by_name(irc, cmd[1]))) { 528 528 iu->f->privmsg(iu, cmd[2]); … … 825 825 int i; 826 826 827 irc_send_msg_raw(irc->root, "NOTICE", irc->user->nick, "COMPLETIONS OK" );827 irc_send_msg_raw(irc->root, "NOTICE", irc->user->nick, "COMPLETIONS OK", 0); 828 828 829 829 for (i = 0; root_commands[i].command; i++) { … … 839 839 } 840 840 841 irc_send_msg_raw(irc->root, "NOTICE", irc->user->nick, "COMPLETIONS END" );841 irc_send_msg_raw(irc->root, "NOTICE", irc->user->nick, "COMPLETIONS END", 0); 842 842 } 843 843 -
irc_im.c
rc82e4ca rf7cc734 305 305 306 306 wrapped = word_wrap(msg, IRC_WORD_WRAP); 307 irc_send_msg(src_iu, message_type, dst, wrapped, prefix );307 irc_send_msg(src_iu, message_type, dst, wrapped, prefix, sent_at); 308 308 g_free(wrapped); 309 309 … … 347 347 g_string_append_c(msg, '\001'); 348 348 349 irc_send_msg((irc_user_t *) bu->ui_data, "NOTICE", irc->user->nick, msg->str, NULL );349 irc_send_msg((irc_user_t *) bu->ui_data, "NOTICE", irc->user->nick, msg->str, NULL, 0); 350 350 351 351 g_string_free(msg, TRUE); … … 707 707 708 708 wrapped = word_wrap(msg, IRC_WORD_WRAP); 709 irc_send_msg(iu, "PRIVMSG", ic->name, wrapped, ts );709 irc_send_msg(iu, "PRIVMSG", ic->name, wrapped, ts, sent_at); 710 710 g_free(ts); 711 711 g_free(wrapped); … … 819 819 irc_send_msg_f(iu, "PRIVMSG", irc->user->nick, "<< \002BitlBee\002 - Invitation to chatroom %s >>", name); 820 820 if (msg) { 821 irc_send_msg(iu, "PRIVMSG", irc->user->nick, msg, NULL );821 irc_send_msg(iu, "PRIVMSG", irc->user->nick, msg, NULL, 0); 822 822 } 823 823 if (chan) { -
irc_send.c
rc82e4ca rf7cc734 136 136 137 137 dst = irc_user_msgdest(iu); 138 irc_send_msg(iu, cmd, dst, text, NULL );138 irc_send_msg(iu, cmd, dst, text, NULL, 0); 139 139 } 140 140 … … 363 363 } 364 364 365 void irc_send_msg(irc_user_t *iu, const char *type, const char *dst, const char *msg, const char *prefix )365 void irc_send_msg(irc_user_t *iu, const char *type, const char *dst, const char *msg, const char *prefix, time_t ts) 366 366 { 367 367 char last = 0; 368 368 const char *s = msg, *line = msg; 369 char *tags = NULL; 369 370 char raw_msg[strlen(msg) + 1024]; 371 372 if (!(iu->irc->caps & CAP_SERVER_TIME)) { 373 ts = 0; 374 } 370 375 371 376 while (!last) { … … 379 384 } 380 385 if (*s == 0 || *s == '\n') { 386 if (ts) 387 tags = irc_format_servertime(iu->irc, ts); 381 388 if (g_strncasecmp(line, "/me ", 4) == 0 && (!prefix || !*prefix) && 382 389 g_strcasecmp(type, "PRIVMSG") == 0) { … … 384 391 strncat(raw_msg, line + 4, s - line - 4); 385 392 strcat(raw_msg, "\001"); 386 irc_send_msg_raw(iu, type, dst, raw_msg);393 irc_send_msg_raw(iu, type, dst, tags, raw_msg); 387 394 } else { 388 395 *raw_msg = '\0'; … … 391 398 } 392 399 strncat(raw_msg, line, s - line); 393 irc_send_msg_raw(iu, type, dst, raw_msg);400 irc_send_msg_raw(iu, type, dst, tags, raw_msg); 394 401 } 402 if (ts) 403 g_free(tags); 395 404 line = s + 1; 396 405 } … … 399 408 } 400 409 401 void irc_send_msg_raw(irc_user_t *iu, const char *type, const char *dst, const char *msg)402 { 403 irc_write(iu->irc, " :%s!%s@%s %s %s :%s",404 iu->nick, iu->user, iu->host, type, dst, msg && *msg ? msg : " ");410 void irc_send_msg_raw(irc_user_t *iu, const char *type, const char *dst, const char* tags, const char *msg) 411 { 412 irc_write(iu->irc, "%s%s:%s!%s@%s %s %s :%s", 413 tags ? tags : "", tags ? " " : "", iu->nick, iu->user, iu->host, type, dst, msg && *msg ? msg : " "); 405 414 } 406 415 -
irc_user.c
rc82e4ca rf7cc734 261 261 static gboolean self_privmsg(irc_user_t *iu, const char *msg) 262 262 { 263 irc_send_msg(iu, "PRIVMSG", iu->nick, msg, NULL );263 irc_send_msg(iu, "PRIVMSG", iu->nick, msg, NULL, 0); 264 264 265 265 return TRUE; -
irc_util.c
rc82e4ca rf7cc734 120 120 } 121 121 122 char *irc_format_servertime(irc_t *irc, time_t msg_ts) 123 { 124 struct tm msg; 125 126 if (msg_ts <= 0) { 127 return NULL; 128 } 129 130 gmtime_r(&msg_ts, &msg); 131 132 return g_strdup_printf("@time=%04d-%02d-%02dT" 133 "%02d:%02d:%02d.000Z", 134 msg.tm_year + 1900, msg.tm_mon + 1, msg.tm_mday, 135 msg.tm_hour, msg.tm_min, msg.tm_sec); 136 } 122 137 123 138 char *set_eval_self_messages(set_t *set, char *value)
Note: See TracChangeset
for help on using the changeset viewer.