diff --git a/src/common/logger.py b/src/common/logger.py
index fabb77f3c13616bf706d1d90ac296f685813e11c..662cff120b24c808f5328cbc5156469d7e042bbb 100644
--- a/src/common/logger.py
+++ b/src/common/logger.py
@@ -206,7 +206,16 @@ class Logger:
 		results = cur.fetchall()
 		results.reverse()
 		return results
-
+	
+	def get_unix_time_from_date(self, year, month, day):
+		# year (fe 2005), month (fe 11), day (fe 25)
+		# returns time in seconds for the second that starts that date since epoch
+		# gimme unixtime from year month day:
+		d = datetime.date(year, month, day)
+		local_time = d.timetuple() # time tupple (compat with time.localtime())
+		start_of_day = int(time.mktime(local_time)) # we have time since epoch baby :)
+		return start_of_day
+	
 	def get_conversation_for_date(self, jid, year, month, day):
 		'''returns contact_name, time, kind, show, message
 		for each row in a list of tupples,
@@ -214,10 +223,7 @@ class Logger:
 		jid = jid.lower()
 		jid_id = self.get_jid_id(jid)
 		
-		# gimme unixtime from year month day:
-		d = datetime.date(year, month, day)
-		local_time = d.timetuple() # time tupple (compat with time.localtime())
-		start_of_day = int(time.mktime(local_time)) # we have time since epoch baby :)
+		start_of_day = self.get_unix_time_from_date(year, month, day)
 		
 		now = int(time.time())
 		
@@ -232,3 +238,28 @@ class Logger:
 		
 		results = cur.fetchall()
 		return results
+
+	def date_has_logs(self, jid, year, month, day):
+		'''returns True if we have logs for given day, else False'''
+		jid = jid.lower()
+		jid_id = self.get_jid_id(jid)
+		
+		start_of_day = self.get_unix_time_from_date(year, month, day)
+		seconds_in_a_day = 86400 # 60 * 60 * 24
+		last_second_of_day = start_of_day + seconds_in_a_day - 1
+		
+		con = sqlite.connect(LOG_DB_PATH)
+		cur = con.cursor()
+		# just ask one row to see if we have sth for this date
+		cur.execute('''
+			SELECT log_line_id FROM logs
+			WHERE jid_id = %d
+			AND time BETWEEN %d AND %d
+			ORDER BY time LIMIT 1
+			''' % (jid_id, start_of_day, last_second_of_day))
+		
+		results = cur.fetchone()
+		if results:
+			return True
+		else:
+			return False
diff --git a/src/gtkgui.glade b/src/gtkgui.glade
index aeb08f879926c51e63a5eedb86716444ba2ea011..ef7830d0142ac92713a66c6ea7815d7508d2b98f 100644
--- a/src/gtkgui.glade
+++ b/src/gtkgui.glade
@@ -9007,6 +9007,7 @@ Custom</property>
 	      <property name="can_focus">True</property>
 	      <property name="display_options">GTK_CALENDAR_SHOW_HEADING|GTK_CALENDAR_SHOW_DAY_NAMES</property>
 	      <signal name="day_selected" handler="on_calendar_day_selected" last_modification_time="Sun, 20 Nov 2005 19:26:58 GMT"/>
+	      <signal name="month_changed" handler="on_calendar_month_changed" last_modification_time="Thu, 24 Nov 2005 00:49:22 GMT"/>
 	    </widget>
 	    <packing>
 	      <property name="shrink">True</property>
diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py
index 0f03f3715584e52f3aa9aa2f5126e2cdbcd8280c..e456f987bd823170ca92cbbf2391cb5ad0748dfb 100644
--- a/src/gtkgui_helpers.py
+++ b/src/gtkgui_helpers.py
@@ -442,3 +442,6 @@ def make_gtk_month_python_month(month):
 	but python's time start from 1, so align to python
 	month MUST be integer'''
 	return month + 1
+
+def make_python_month_gtk_month(month):
+	return month - 1
diff --git a/src/history_window.py b/src/history_window.py
index e629dba948a72cdfaaa6cffc8ade0571757de047..6556b4160244ddc3a01672f438178ccca5a55f16 100644
--- a/src/history_window.py
+++ b/src/history_window.py
@@ -20,6 +20,7 @@
 import gtk
 import gtk.glade
 import time
+import calendar
 import os
 
 import gtkgui_helpers
@@ -81,6 +82,19 @@ class HistoryWindow:
 		year, month, day = widget.get_date() # integers
 		month = gtkgui_helpers.make_gtk_month_python_month(month)
 		self.add_lines_for_date(year, month, day)
+		
+	def on_calendar_month_changed(self, widget):
+		year, month, day = widget.get_date() # integers
+		month = gtkgui_helpers.make_gtk_month_python_month(month)
+		weekday, days_in_this_month = calendar.monthrange(year, month)
+		for day in xrange(1, days_in_this_month + 1): # count from 1, so add 1 more
+			#FIXME: optimize (ask db once per month and store days that have logs)
+			# return those here in tupple
+			#print 'ask', year, month, day
+			if gajim.logger.date_has_logs(self.jid, year, month, day):
+				widget.mark_day(day)
+			else:
+				widget.unmark_day(day)
 
 	def add_lines_for_date(self, year, month, day):
 		'''adds all the lines for given date in textbuffer'''