[mw-devel] MW3 r1068 - trunk/src
arthur at sucs.org
arthur at sucs.org
Thu Mar 12 16:28:41 GMT 2009
Author: arthur
Date: 2009-03-12 16:28:41 +0000 (Thu, 12 Mar 2009)
New Revision: 1068
Modified:
trunk/src/Makefile
trunk/src/js.h
trunk/src/sqlite.c
trunk/src/sqlite.h
trunk/src/talker.c
Log:
collect urls entered by the user and stuff them in a db, refs #38
Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile 2009-03-12 12:17:14 UTC (rev 1067)
+++ trunk/src/Makefile 2009-03-12 16:28:41 UTC (rev 1068)
@@ -26,7 +26,7 @@
# cflags for standard 'cc' compiler
CFLAGS+= -Wall -pedantic -fpie -std=gnu99 -D_GNU_SOURCE
LDFLAGS+= -pie
-LDLIBS+= -lreadline -lhistory -ltermcap -lcrypt -l$(JSLIB) -lsqlite3 -lcurl
+LDLIBS+= -lreadline -ltermcap -lcrypt -l$(JSLIB) -lsqlite3 -lcurl -lpthread
# info strings, do not edit.
DEFS:= -DBUILD_DATE=\"$(shell date +%Y%m%d)\"
@@ -99,7 +99,7 @@
topten.o sort.o tidyup.o gags.o script_inst.o script.o\
incoming.o command.o chattable.o alias.o frl.o hash.o vars.o expand.o\
mud.o mudtable.o files.o completion.o sentinel.o iconv.o gagtable.o \
-js.o sqlite.o ipc.o
+js.o sqlite.o ipc.o log.o
$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^
del_user: del_user.o perms.o strings.o
Modified: trunk/src/js.h
===================================================================
--- trunk/src/js.h 2009-03-12 12:17:14 UTC (rev 1067)
+++ trunk/src/js.h 2009-03-12 16:28:41 UTC (rev 1068)
@@ -7,3 +7,4 @@
void js_stop_execution(void);
int stop_js(void);
int setup_js(void);
+size_t urldata(void *ptr, size_t size, size_t nmemb, void *stream);
Modified: trunk/src/sqlite.c
===================================================================
--- trunk/src/sqlite.c 2009-03-12 12:17:14 UTC (rev 1067)
+++ trunk/src/sqlite.c 2009-03-12 16:28:41 UTC (rev 1068)
@@ -66,7 +66,7 @@
}
struct db_result*
-db_query(char *dbname, char *query)
+db_query(char *dbname, char *query, int quiet)
{
struct db_result *new;
int ret;
@@ -89,7 +89,7 @@
ret = sqlite3_exec(db, query, db_callback, new, &error);
if (ret != SQLITE_OK) {
- printf("Error %s (%d) on query %s\n", error, ret, query);
+ if (!quiet) printf("Error %s (%d) on query %s\n", error, ret, query);
sqlite3_free(error);
db_close(db);
return NULL;
Modified: trunk/src/sqlite.h
===================================================================
--- trunk/src/sqlite.h 2009-03-12 12:17:14 UTC (rev 1067)
+++ trunk/src/sqlite.h 2009-03-12 16:28:41 UTC (rev 1068)
@@ -20,7 +20,7 @@
char *error_text;
};
-struct db_result *db_query(char *dbname, char *query);
+struct db_result *db_query(char *dbname, char *query, int quiet);
struct js_db_result* js_db_query(char *dbname, char *query);
void db_getrow(struct db_result *result, int *row);
void db_free(struct db_result *result);
Modified: trunk/src/talker.c
===================================================================
--- trunk/src/talker.c 2009-03-12 12:17:14 UTC (rev 1067)
+++ trunk/src/talker.c 2009-03-12 16:28:41 UTC (rev 1068)
@@ -6,6 +6,8 @@
#include <arpa/telnet.h>
#include <ctype.h>
#include <termcap.h>
+#include <sys/types.h>
+#include <regex.h>
#include "bb.h"
#include "Parse.h"
@@ -22,6 +24,7 @@
#include "rooms.h"
#include "ipc.h"
+#include "log.h"
#include "alias.h"
extern Alias bind_list;
@@ -151,6 +154,7 @@
char buff[MAXTEXTLENGTH];
mwlog("SAY %s", text);
+ catchuri(text);
snprintf(buff, MAXTEXTLENGTH, "%s: %s", user->name, text);
talk_send_to_room(buff, channel);
}
@@ -159,6 +163,7 @@
char buff[MAXTEXTLENGTH];
mwlog("RAW %s", text);
+ catchuri(text);
snprintf(buff, MAXTEXTLENGTH, "%s", text);
talk_send_to_room(buff, channel);
}
@@ -180,6 +185,7 @@
void talk_send_emote(char * text, int channel, int pleural){
char buff[MAXTEXTLENGTH];
+ catchuri(text);
switch (pleural) {
case 1:
snprintf(buff, MAXTEXTLENGTH, "%s's %s", user->name, text);
More information about the mw-devel
mailing list