[mw-devel] [Git][arthur/mw][master] Remove the hashtag logging stuff

Andrew Price welshbyte at sucs.org
Thu Mar 3 21:45:10 GMT 2016


Andrew Price pushed to branch master at Justin Mitchell / mw


Commits:
1be3f67d by Andrew Price at 2016-03-03T21:43:11+00:00
Remove the hashtag logging stuff

Experiment: success
Conclusion: no

- - - - -


1 changed file:

- src/client/log.c


Changes:

=====================================
src/client/log.c
=====================================
--- a/src/client/log.c
+++ b/src/client/log.c
@@ -17,7 +17,6 @@
 
 extern struct user * const user;
 static void *file_url(void * data);
-static void *file_tag(void * data);
 
 /*
  * Check whats said for URLs and log them
@@ -27,7 +26,7 @@ struct uripatt {
 	const char *regex;
 	int   	regflags; /* compile flags */
 	regex_t	*patt; /* compiled version */
-	enum { END=0, URL, FLAG, IGNORE, NOLOG, TAG } type;
+	enum { END=0, URL, FLAG, IGNORE, NOLOG } type;
 	uint32_t flags;
 };
 
@@ -54,15 +53,6 @@ struct uripatt urilist[] = {
 	{"^-log", 		REG_ICASE, NULL, NOLOG, 0},
 	{"^(-log)$", 		REG_ICASE, NULL, NOLOG, 0},
 	{"^(nolog)$", 		REG_ICASE, NULL, NOLOG, 0},
-	/* section for hashtags, exclude C preprocessor directives */
-	{"^#include$", 		REG_ICASE, NULL, IGNORE, 0},
-	{"^#define$", 		REG_ICASE, NULL, IGNORE, 0},
-	{"^#pragma$", 		REG_ICASE, NULL, IGNORE, 0},
-	{"^#if$", 		REG_ICASE, NULL, IGNORE, 0},
-	{"^#ifdef$", 		REG_ICASE, NULL, IGNORE, 0},
-	{"^#ifndef$", 		REG_ICASE, NULL, IGNORE, 0},
-	{"^#endif$", 		REG_ICASE, NULL, IGNORE, 0},
-	{"^#[[:alnum:]]+$",	REG_ICASE|REG_EXTENDED, NULL, TAG, 0},
 	{ NULL, 0, NULL, END, 0 }
 };
 
@@ -71,11 +61,6 @@ struct urihit {
 	uint32_t flags;
 };
 
-struct taghit {
-	char *tag;
-	char *line;
-};
-
 void catchuri(const char *what)
 {
 	char *text = strip_colours(what);
@@ -83,8 +68,6 @@ void catchuri(const char *what)
 	/* kludge, find at most 20 URLs */
 	char *foundurl[20];
 	int nfoundurl=0;
-	char *foundtag[20];
-	int nfoundtag=0;
 	uint32_t flags = 0;
 
 	/* split the line into words on whitespace */
@@ -128,9 +111,6 @@ void catchuri(const char *what)
 					free(text);
 					return;
 				}
-				if (u->type == TAG) {
-					if (nfoundtag < 20) foundtag[nfoundtag++] = token;
-				}
 			}
 			u++;
 		}
@@ -156,24 +136,6 @@ void catchuri(const char *what)
 		}
 		pthread_attr_destroy(&ptattr);
 	}
-
-	/* we also found some tags */
-	if (nfoundtag>0) {
-		int i;
-		pthread_attr_t ptattr;
-
-		pthread_attr_init(&ptattr);
-		pthread_attr_setdetachstate(&ptattr, PTHREAD_CREATE_DETACHED);
-		for (i=0;i<nfoundtag;i++) {
-			struct taghit *tag;
-			pthread_t pt;
-			tag = malloc(sizeof(struct taghit));
-			tag->tag = strdup(foundtag[i]);
-			tag->line = strdup(what);
-			pthread_create(&pt, &ptattr, file_tag, tag);
-		}
-		pthread_attr_destroy(&ptattr);
-	}
 	free(text);
 }
 
@@ -321,32 +283,6 @@ static void *file_url(void * data)
 	return NULL;
 }
 
-static void *file_tag(void * data)
-{
-	struct taghit *tag = data;
-	struct db_result *res;
-
-	char *query = sqlite3_mprintf("INSERT INTO mwtag (user, tag, added, line) "
-	                              "VALUES (%Q,%Q,datetime('now'),%Q)",
-				      user->record.name, tag->tag, tag->line);
-	res = db_query(MWURI_DB, query, 1);
-	if (res == NULL) {
-		res = db_query(MWURI_DB, "CREATE TABLE mwtag "
-		               "(id INTEGER PRIMARY KEY AUTOINCREMENT, "
-			       "user TEXT, tag TEXT, added TEXT, line TEXT)", 0);
-		if (res != NULL) {
-			db_free(res);
-			res = db_query(MWURI_DB, query, 0);
-		}
-	}
-	db_free(res);
-	sqlite3_free(query);
-	free(tag->tag);
-	free(tag->line);
-	free(tag);
-	return NULL;
-}
-
 /* store the doing/status string in the db */
 void catchdoing(const char *what)
 {



View it on GitLab: https://projects.sucs.org/arthur/mw/commit/1be3f67d31c40ab57979494c1fc35f666bf245d0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sucs.org/pipermail/mw-devel/attachments/20160303/cf6a1cdd/attachment.html>


More information about the mw-devel mailing list