| 638 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
638 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 639 g_free(msg); |
639 g_free(msg); |
| 640 } |
640 } |
| 641 g_free(tmp2); |
641 g_free(tmp2); |
| 642 g_free(topic); |
642 g_free(topic); |
| |
643 } |
| |
644 |
| |
645 void irc_msg_topicinfo(struct irc_conn *irc, const char *name, const char *from, char **args) |
| |
646 { |
| |
647 PurpleConversation *convo; |
| |
648 struct tm *tm; |
| |
649 time_t t; |
| |
650 char *msg, *timestamp, *datestamp; |
| |
651 |
| |
652 if (!args || !args[1] || !args[2] || !args[3]) |
| |
653 return; |
| |
654 |
| |
655 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); |
| |
656 if (!convo) { |
| |
657 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got topic info for %s, which doesn't exist\n", args[1]); |
| |
658 return; |
| |
659 } |
| |
660 |
| |
661 t = (time_t)atol(args[3]); |
| |
662 if (t == 0) { |
| |
663 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got apparently nonsensical topic timestamp %s\n", args[3]); |
| |
664 return; |
| |
665 } |
| |
666 tm = localtime(&t); |
| |
667 |
| |
668 timestamp = g_strdup(purple_time_format(tm)); |
| |
669 datestamp = g_strdup(purple_date_format_short(tm)); |
| |
670 msg = g_strdup_printf("Topic for %s set by %s at %s on %s", args[1], args[2], timestamp, datestamp); |
| |
671 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, time(NULL)); |
| |
672 g_free(timestamp); |
| |
673 g_free(datestamp); |
| |
674 g_free(msg); |
| 643 } |
675 } |
| 644 |
676 |
| 645 void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args) |
677 void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 646 { |
678 { |
| 647 PurpleConnection *gc = purple_account_get_connection(irc->account); |
679 PurpleConnection *gc = purple_account_get_connection(irc->account); |