def remove_tray_timer(userdata): global tray_notification_queue, tray_balloon_timer #unhook the timer and set the variable to None so the primary function knows theres no timer active xchat.unhook(tray_balloon_timer) tray_balloon_timer = None #If theres something in the queue, take the oldest item in the queue and send it to the tray_verbose function if tray_notification_queue is not None: if len(tray_notification_queue) > 0: next_balloon = tray_notification_queue.pop(0) tray_verbose(next_balloon[0], next_balloon[1], "tray_timer") def tray_balloon(title, text, activator="normal"): global tray_notification_queue, tray_balloon_timer #If we currently have a timer out then we need to add the new notification to our queue and wait. if tray_balloon_timer is not None: if tray_notification_queue is None: tray_notification_queue = [[title, text]] else: if len(tray_notification_queue) > 0: tray_notification_queue.append([title, text]) else: tray_notification_queue = [[title, text]] # If there isn't a timer currently we make a balloon notification then we start a timer to prevent other balloons from being created. else: tray_command = "TRAY -b \"" + title +"\" \"" + text + "\"" xchat.command(tray_command) #When the timer is up, it will go to the function remove_tray_timer. tray_balloon_timer = xchat.hook_timer(5000, remove_tray_timer)