         return
 
       # Execute the callback with the results
-      callback projects[0], tasks[0]+      callback projects[0], tasks[0]
+
+  # (internal method)
+  # Searches through all entries made for today and tries
+  # to find a running timer for the given project/task
+  # combination.
+  # If it is found, the respective entry object is passed to
+  # the callback, otherwise an error message is replied and
+  # the callback doesn't get executed.
+  find_day_entry: (msg, target_project, target_task, callback) ->
+    this.find_project_and_task msg, target_project, target_task, (project, task) =>
+      this.daily msg, (status, body) ->
+        # For some unknown reason, the daily entry IDs are strings
+        # instead of numbers, causing the comparison below to fail.
+        # So, convert our target stuff to strings as well.
+        project_id = "#{project.id}"
+        task_id    = "#{task.id}"
+        # Iterate through all available entries for today
+        # and try to find the requested ID.
+        found_entry = null
+        for entry in body.day_entries
+          if entry.project_id == project_id and entry.task_id == task_id and entry.timer_started_at?
+            found_entry = entry
+            break
+
+        # None found
+        unless found_entry?
+          msg.reply "I couldn't find a running timer in today's timesheet for the combination #{target_project}/#{target_task}."
+          return
+
+        # Execute the callback with the result
+        callback found_entry

#                                                      (both of which may be abbreviated, Hubot
#                                                      will ask you if your input is ambigious).
#                                                      An existing timer (if any) will be stopped.
#   hubot finish harvest at <project> - TODO
#   hubot daily harvest [of <user>] - Hubot responds with your/a specific user's entries for today
#
# Notes:


  # Kick off a new timer, stopping the previously running one, if any.
  robot.respond /start harvest at (.+)\/(.+): (.*)/i, (msg) ->
    user    = msg.message.user
    project = msg.match[1]
    task    = msg.match[2]
    notes   = msg.match[3]

    # Check if we know the detected user's credentials.
    unless user.harvest_account
      msg.reply "You have to tell me your Harvest credentials first."
      return
    
    user.harvest_account.start msg, project, task, notes, (status, body) ->
      if 200 <= status <= 299
        if body.hours_for_previously_running_timer?
          msg.reply "Previously running timer stopped at #{body.hours_for_previously_running_timer}h."
        msg.reply "Started tracking. Back to your work, #{msg.message.user.name}!"
      else
        msg.reply "Request failed with status #{status}."

  # Stops the timer running for a project/task combination,
  # if any.
  robot.respond /stop harvest at (.+)\/(.+)/i, (msg) ->
    user    = msg.message.user
    project = msg.match[1]
    task    = msg.match[2]
    unless user.harvest_account
      msg.reply "You have to tell me your Harvest credentials first."
      return
    
    user.harvest_account.stop msg, project, task, (status, body) ->
      if 200 <= status <= 299
        msg.reply "Timer stopped."
      else
        msg.reply "Request failed with status #{status}."
        msg.reply body

  # Stop the first running timer it can find.
  # Not yet implemented.
  #robot.respond /stop harvest/i, (msg) ->
  #  msg.reply "Not yet implemented."

# Class managing the Harvest account associated with
# a user. Keeps track of the user's credentials and can
