Douglas William Thrift 14 years ago
parent
commit
0bebccd50a
3 changed files with 26 additions and 5 deletions
  1. 1 0
      .gitattributes
  2. 5 5
      locationbot.py
  3. 20 0
      locationbot.sql

+ 1 - 0
.gitattributes

@@ -1 +1,2 @@
 *.py	ident
+*.sql	ident

+ 5 - 5
locationbot.py

@@ -88,9 +88,9 @@ class LocationBot(ircbot.SingleServerIRCBot):
 
 		commands = [
 			('help', '', 'show this help message'),
-			('login', 'user secret', 'login as user with secret'),
-			('register', 'user secret', 'register as user with secret'),
-			('status', '[user]', 'show where everybody or a user is'),
+			('login', '[nick] secret', 'login as nick with secret'),
+			('register', '[nick] secret', 'register as nick with secret'),
+			('status', '[nick]', 'show where everybody or a nick is'),
 		]
 
 		if True:
@@ -203,9 +203,9 @@ class LocationBot(ircbot.SingleServerIRCBot):
 
 			if self.__locations_lock.acquire(False):
 				if self.__locations and sorted(self.__channels) == sorted(self.channels.keys()):
-					for user, location in self.__locations:
+					for nick, location in self.__locations:
 						for channel in self.__channels:
-							self.connection.notice(channel, '%s is in %s' % (user, location))
+							self.connection.notice(channel, '%s is in %s' % (nick, location))
 
 					self.__locations = []
 

+ 20 - 0
locationbot.sql

@@ -0,0 +1,20 @@
+-- Location Bot
+--
+-- Douglas Thrift
+--
+-- $Id$
+
+create schema locationbot;
+
+create table locationbot.nick (
+	id serial primary key,
+	nick text not null unique,
+	secret char(32) not null,
+	masks text[],
+	channels text[],
+	location text,
+	latitude bigint,
+);
+
+create index locationbot.nick_location_index on locationbot.nick (location);
+create index locationbot.nick_latitude_index on locationbot.nick (latitude);