Changeset f7cc734 for irc_send.c
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.