<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -16,8 +16,8 @@ import logging
 class FooApp(object):
     name = 'foo'
 
-    def __init__(self, user):
-        self.config = json.loads(file('/etc/foobox.conf', 'r').read())
+    def __init__(self, user, config_file='/etc/foobox.conf'):
+        self.config = json.loads(file(config_file, 'r').read())
         self.data = HTTPStore(self.config['common']['data_url'])
         try:
             self.config.update(json.loads(self.data['%s/config' % user]))
@@ -71,9 +71,9 @@ class FooResponder(object):
         yield self.app.status
         return
 
-def start_app(myapp, listen_port=0):
-    app = myapp()
-    logging.basicConfig(filename=app.config['common']['log_path'], level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+def start_app(myapp, listen_port=0, user='synack'):
+    app = myapp(user)
+    logging.basicConfig(filename=app.config['common']['log_path'], level=logging.DEBUG, format='%(asctime)s - ' + user + ' - %(levelname)s - %(message)s')
 
     urls = [
         ('^/',  FooResponder),</diff>
      <filename>fooapp.py</filename>
    </modified>
    <modified>
      <diff>@@ -205,12 +205,8 @@ class Worker(Thread):
                 self.send(app, msg)
             except:
                 logging.warning('Error processing message: %s' % format_exc())
-                if retry &lt; 4:
-                    self.queue.put_nowait((app, msg, retry + 1))
-                    logging.info('Requeuing message after error (retry %i): %s' % (retry, msg['id']))
-                else:
-                    logging.info('Dropping message after %i retries: %s' % (retry, msg['id']))
-            self.queue.task_done()
+            finally:
+                self.queue.task_done()
     
     def send(self, app, msg):
         status, response = request('POST', app['url'], json.dumps(msg))</diff>
      <filename>foobox.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 from fooapp import FooApp, start_app
 import logging
+import sys
 from time import sleep
 from urllib import urlopen, quote
 import re
@@ -15,7 +16,7 @@ class GoogleSMS(FooApp):
     name = 'google'
     config_opts = {}
 
-    def __init__(self, user='synack'):
+    def __init__(self, user):
         FooApp.__init__(self, user)
         self.searchurl = 'http://www.google.com/sms/demo?hl=en&amp;country=US&amp;q='
         try:
@@ -87,4 +88,4 @@ class GoogleSMS(FooApp):
 
 if __name__ == '__main__':
     become_daemon()
-    start_app(GoogleSMS)
+    start_app(GoogleSMS, sys.argv[1])</diff>
      <filename>google_sms.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,8 @@
 from socket import socket, getfqdn
 from select import select
 from threading import Thread
+import logging
+import sys
 
 from fooapp import FooApp, start_app
 from ncore.daemon import become_daemon
@@ -14,7 +16,7 @@ class IRC(FooApp):
         'target': 'Nick to send messages to',
     }
 
-    def __init__(self, user='synack'):
+    def __init__(self, user):
         FooApp.__init__(self, user)
 
         self.nick = self.config['irc']['nick']
@@ -24,7 +26,12 @@ class IRC(FooApp):
         self.sock = socket()
         host, port = self.config['irc']['server'].split(':', 1)
         port = int(port)
-        self.sock.connect((host, port))
+        try:
+            logging.debug('Attempting to connect to %s:%i' % (host, port))
+            self.sock.connect((host, port))
+            logging.info('Connected to irc server %s:%i' % (host, port))
+        except:
+            logging.warning('Unable to connect to irc server %s:%i' % (host, port))
 
         self.thread = Thread(target=self.run)
         self.thread.setDaemon(True)
@@ -68,6 +75,8 @@ class IRC(FooApp):
         nick, msg = params.split(' ', 1)
         msg = msg[1:]
 
+        if nick != self.config['irc']['target']: return
+
         if msg.startswith('!'):
             cmd, msg = msg.split(' ', 1)
             cmd = cmd.lstrip('!')
@@ -77,4 +86,4 @@ class IRC(FooApp):
 
 if __name__ == '__main__':
     become_daemon()
-    start_app(IRC)
+    start_app(IRC, user=sys.argv[1])</diff>
      <filename>irc.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 from fooapp import FooApp, start_app
 import feedparser
+import sys
 from time import sleep
 from ncore.data import FileStore
 from ncore.daemon import become_daemon
@@ -12,8 +13,8 @@ class RSS(FooApp):
 	name = 'rss'
 	config_opts = {}
 
-	def __init__(self):
-		FooApp.__init__(self)
+	def __init__(self, user):
+		FooApp.__init__(self, user)
 
 		try:
 			self.feeds = json.loads(self.data['feeds'])
@@ -54,4 +55,4 @@ class RSS(FooApp):
 
 if __name__ == '__main__':
 	become_daemon()
-	start_app(RSS)
+	start_app(RSS, user=sys.argv[1])</diff>
      <filename>rss.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 from fooapp import FooApp, start_app
 import twitter
 import logging
+import sys
 from time import sleep
 from traceback import format_exc
 from ncore.data import FileStore
@@ -12,12 +13,8 @@ except ImportError:
 
 class Twitter(FooApp):
     name = 'twitter'
-    config_opts = {
-        'username': 'Your twitter username',
-        'password': 'Your twitter password',
-    }
 
-    def __init__(self, user='synack'):
+    def __init__(self, user):
         FooApp.__init__(self, user)
         self.api = twitter.Api(username=self.config['twitter']['username'], password=self.config['twitter']['password'])
         try:
@@ -61,4 +58,4 @@ class Twitter(FooApp):
 
 if __name__ == '__main__':
     become_daemon()
-    start_app(Twitter)
+    start_app(Twitter, user=sys.argv[1])</diff>
      <filename>tweet.py</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,7 @@ from ncore.data import FileStore
 from ncore.daemon import become_daemon
 from ncore.rest import request
 import logging
+import sys
 try:
     import json
 except ImportError:
@@ -16,7 +17,7 @@ class UPS(FooApp):
     name = 'ups'
     config_opts = {}
 
-    def __init__(self, user='synack'):
+    def __init__(self, user):
         FooApp.__init__(self, user)
 
         try:
@@ -93,4 +94,4 @@ class UPS(FooApp):
 
 if __name__ == '__main__':
     become_daemon()
-    start_app(UPS)
+    start_app(UPS, user=sys.argv[1])</diff>
      <filename>ups.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>03c6f46328fa45c47e09a0543a06952ea7e38f1e</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Grosser</name>
    <email>synack@neohippie.net</email>
  </author>
  <url>http://github.com/synack/foobox/commit/23ce9bd649dd45ddcde8f5e923cd2e8857e25278</url>
  <id>23ce9bd649dd45ddcde8f5e923cd2e8857e25278</id>
  <committed-date>2009-01-26T22:49:28-08:00</committed-date>
  <authored-date>2009-01-26T22:49:28-08:00</authored-date>
  <message>Scripts require you pass a &lt;user&gt; argument now. Each user runs an independent daemon... This will be fixed with a service manager soon.</message>
  <tree>6a51e299287ac3b07987184a00e7858309ff6fa9</tree>
  <committer>
    <name>Jeremy Grosser</name>
    <email>synack@neohippie.net</email>
  </committer>
</commit>
