--- a/irssi/datechange.c Thu Aug 27 19:47:19 2009 -0400
+++ b/irssi/datechange.c Fri Aug 28 02:57:23 2009 -0500
@@ -38,57 +38,63 @@
/******************************************************************************
*****************************************************************************/
-irssi_datechange_get_day(time_t *t) {
+irssi_datechange_get_day_and_month(time_t *t, gint *day, gint *month) {
-irssi_datechange_get_month(time_t *t) {
irssi_datechange_timeout_cb(gpointer data) {
+ gint day = 0, month = 0;
+ gchar *message = NULL, *new_year = NULL; + if(!irssi_datechange_get_day_and_month(&t, &day, &month))
- newday = irssi_datechange_get_day(&t);
+ l = purple_get_conversations(); + if(day == 1 && month == 0 && purple_prefs_get_bool(SENDNEWYEAR_PREF)) + new_year = g_strdup(_("Happy New Year!")); strftime(buff, sizeof(buff), "%d %b %Y", localtime(&t));
message = g_strdup_printf(_("Day changed to %s"), buff);
- for(l = purple_get_conversations(); l; l = l->next) {
+ for(; l; l = l->next) { PurpleConversation *conv = (PurpleConversation *)l->data;
purple_conversation_write(conv, NULL, message,
PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_ACTIVE_ONLY,
- if ((irssi_datechange_get_day(&t) == 1) && (irssi_datechange_get_month(&t) == 0) &&
- purple_prefs_get_bool(SENDNEWYEAR_PREF))
- const gchar *new_year = _("Happy New Year");
if(conv->type == PURPLE_CONV_TYPE_IM)
purple_conv_im_send(PURPLE_CONV_IM(conv), new_year);
else if(conv->type == PURPLE_CONV_TYPE_CHAT)
@@ -97,8 +103,7 @@
@@ -108,14 +113,12 @@
*****************************************************************************/
irssi_datechange_init(PurplePlugin *plugin) {
if(purple_prefs_get_bool(DATECHANGE_PREF)) {
if(irssi_datechange_timeout_id != 0)
purple_timeout_remove(irssi_datechange_timeout_id);
- lastday = irssi_datechange_get_day(&t);
+ if(!irssi_datechange_get_day_and_month(NULL, &lastday, NULL)) /* set this to get called every 30 seconds.