[mw-devel] MW3 r1081 - trunk/src
arthur at sucs.org
arthur at sucs.org
Fri Apr 3 12:36:43 BST 2009
Author: arthur
Date: 2009-04-03 12:36:42 +0100 (Fri, 03 Apr 2009)
New Revision: 1081
Modified:
trunk/src/log.c
Log:
add extra classes of mwuri flags:
-anon or -coward to not list the username ont he website
-sucs or -members to only show that uri to logged in users
Modified: trunk/src/log.c
===================================================================
--- trunk/src/log.c 2009-03-17 21:25:25 UTC (rev 1080)
+++ trunk/src/log.c 2009-04-03 11:36:42 UTC (rev 1081)
@@ -65,6 +65,8 @@
};
#define URLFLAG_NSFW 0x0001
+#define URLFLAG_ANON 0x0002
+#define URLFLAG_SUCS 0x0004
struct uripatt urilist[] = {
{"^http://$", REG_ICASE, NULL, IGNORE, 0},
@@ -74,6 +76,10 @@
{"^www\\.", REG_ICASE, NULL, URL, 0},
{"^[[:alnum:]_.-]+\\.(com|org|net|gov|(co|org|net|gov)\\.uk)", REG_ICASE|REG_EXTENDED, NULL, URL, 0},
{"nsfw", REG_ICASE, NULL, FLAG, URLFLAG_NSFW},
+ {"^-anon$", REG_ICASE, NULL, FLAG, URLFLAG_ANON},
+ {"^-coward$", REG_ICASE, NULL, FLAG, URLFLAG_ANON},
+ {"^-sucs$", REG_ICASE, NULL, FLAG, URLFLAG_SUCS},
+ {"^-member", REG_ICASE, NULL, FLAG, URLFLAG_SUCS},
{"^-log", REG_ICASE, NULL, NOLOG, 0},
{"^(-log)$", REG_ICASE, NULL, NOLOG, 0},
/* section for hashtags, exclude C preprocessor directives */
@@ -256,6 +262,7 @@
char *deli=NULL;
char *body=NULL;
char *title=NULL;
+ char flags[1024];
c = curl_easy_init();
@@ -299,6 +306,21 @@
}
/* fishing mission complete, store the results */
+
+ flags[0]=0;
+ if (uri->flags & URLFLAG_NSFW) {
+ int n = strlen(flags);
+ snprintf(&flags[n], sizeof(flags)-n, "%snsfw", flags[0]==0?"":" ");
+ }
+ if (uri->flags & URLFLAG_ANON) {
+ int n = strlen(flags);
+ snprintf(&flags[n], sizeof(flags)-n, "%sanon", flags[0]==0?"":" ");
+ }
+ if (uri->flags & URLFLAG_SUCS) {
+ int n = strlen(flags);
+ snprintf(&flags[n], sizeof(flags)-n, "%ssucs", flags[0]==0?"":" ");
+ }
+
snprintf(path,sizeof(path),"%s/mwuri.db", STATEDIR);
char *query = sqlite3_mprintf("INSERT INTO mwuri (user, url, added, flags, title, tags) values (%Q,%Q,datetime('now'),%Q,%Q,%Q)", user->name, url, (uri->flags&URLFLAG_NSFW)?"nsfw":NULL, title, deli);
res = db_query(path, query, 1);
More information about the mw-devel
mailing list