<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
img {
max-width: 100%;
height: auto;
}
p.details {
font-style:italic;
color:#777
}
.footer p {
font-size:small;
color:#777
}
pre.commit-message {
white-space: pre-wrap;
}
.file-stats a {
text-decoration: none;
}
.file-stats .new-file {
color: #090;
}
.file-stats .deleted-file {
color: #B00;
}
</style>
<body>
<div class='content'>
<h3>Andrew Price pushed to branch master at <a href="https://projects.sucs.org/arthur/mw">Justin Mitchell / mw</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01">0513f996</a></strong>
<div>
<span>by Andrew Price</span>
<i>at 2015-10-17T11:59:46Z</i>
</div>
<pre class='commit-message'>The big dangling whitespace cleanup of 2015
Tip: this can be avoided by adding this to your .vimrc:
match ErrorMsg '\s\+$'</pre>
</li>
</ul>
<h4>57 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
src/client/Parse.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
src/client/add.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
src/client/alarm.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
src/client/alarm.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-4'>
src/client/alias.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-5'>
src/client/colour.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-6'>
src/client/edit.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-7'>
src/client/expand.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-8'>
src/client/getpass.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-9'>
src/client/hash.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-10'>
src/client/incoming.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-11'>
src/client/init.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-12'>
src/client/js.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-13'>
src/client/log.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-14'>
src/client/log.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-15'>
src/client/main.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-16'>
src/client/mesg.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-17'>
src/client/mod.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-18'>
src/client/new.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-19'>
src/client/newmain.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-20'>
src/client/read.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-21'>
src/client/script.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-22'>
src/client/script.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-23'>
src/client/script_inst.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-24'>
src/client/sort.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-25'>
src/client/sqlite.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-26'>
src/client/talker.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-27'>
src/client/talker_privs.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-28'>
src/client/uri.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-29'>
src/client/user.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-30'>
src/client/userio.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-31'>
src/folders.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-32'>
src/gags.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-33'>
src/gagtable.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-34'>
src/iconv.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-35'>
src/ipc.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-36'>
src/list.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-37'>
src/perms.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-38'>
src/server/mwserv.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-39'>
src/server/replay.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-40'>
src/server/servsock.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-41'>
src/socket.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-42'>
src/socket.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-43'>
src/special.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-44'>
src/special.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-45'>
src/str_util.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-46'>
src/talker_privs.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-47'>
src/user.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-48'>
src/user.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-49'>
src/utils/clean_users.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-50'>
src/utils/del_user.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-51'>
src/utils/fixuser.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-52'>
src/utils/sizes.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-53'>
src/webclient/comms.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-54'>
src/webclient/import.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-55'>
src/webclient/list.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-56'>
src/webclient/mwpoll.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-0'>
<strong>
src/client/Parse.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/Parse.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/Parse.c
</span><span style="color: #aaaaaa">@@ -29,7 +29,7 @@ int ParseLine(char *line, const char *argv[])
</span> int n=0;
int quoted=0;
int slashed=0;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> while(n<MAX_ARGC-1)
{
/* printf("Skip spaces on [%s...]\n",ptr);*/
<span style="color: #aaaaaa">@@ -93,7 +93,7 @@ char *remove_first_word(char *args)
</span> {
char *ptr, *ptr2;
- ptr = args;
<span style="color: #000000;background-color: #ddffdd">+ ptr = args;
</span> while (ptr && *ptr && isspace(*ptr)) ptr++;
if (ptr && *ptr)
{
<span style="color: #aaaaaa">@@ -144,7 +144,7 @@ int DoCommand(char *input, CommandList *cm)
</span> al=alias_list;
while (al!=NULL)
{
- if (!strcasecmp(al->from,argv[0]))
<span style="color: #000000;background-color: #ddffdd">+ if (!strcasecmp(al->from,argv[0]))
</span> {
dowhat=al->to;
break;
<span style="color: #aaaaaa">@@ -181,7 +181,7 @@ int DoCommand(char *input, CommandList *cm)
</span> printf("Ambiguous command. Possibilities:-\n");
printf("%s, %s",found->Command, cm->Command);
}else /* more */
- printf(", %s",cm->Command);
<span style="color: #000000;background-color: #ddffdd">+ printf(", %s",cm->Command);
</span> count++;
}
}
<span style="color: #aaaaaa">@@ -231,7 +231,7 @@ int DoCommand(char *input, CommandList *cm)
</span> exact->Function(exact,argc,argv, args);
if (args!=NULL) free(args);
return 1;
- }else
<span style="color: #000000;background-color: #ddffdd">+ }else
</span> if (count==1)
{
if(argc<found->Args+1)
<span style="color: #aaaaaa">@@ -292,7 +292,7 @@ int command_compare(const char *input, const char *comm)
</span> while (tolower(input[c])==tolower(comm[c]) && c<len) c++;
return(c);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> void help_list(CommandList *c, unsigned int hidestuff)
{
char buff[10];
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-1'>
<strong>
src/client/add.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/add.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/add.c
</span><span style="color: #aaaaaa">@@ -116,7 +116,7 @@ int add_msg(int folnum,struct person *user,int replyto)
</span>
fol=(struct folder *)malloc(sizeof(*fol));
new=(struct Header *)malloc(sizeof(*new));
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (!get_folder_number(fol,folnum))
{
free(fol);
<span style="color: #aaaaaa">@@ -136,15 +136,15 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> if (!remote)
{
if (replyto==0)
- printf(_("Writing in folder %s.\n"),fol->name);
<span style="color: #000000;background-color: #ddffdd">+ printf(_("Writing in folder %s.\n"),fol->name);
</span> else
printf(_("Replying to message %d in folder %s\n"),replyto,fol->name);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (!remote && is_private(fol,user))
{
printf(_("Note: Operators have the right to read any 'private' messages.\n"));
- printf(_(" : If you don't like this, don't write private messages.\n"));
<span style="color: #000000;background-color: #ddffdd">+ printf(_(" : If you don't like this, don't write private messages.\n"));
</span> }
if (replyto>0)
{
<span style="color: #aaaaaa">@@ -178,15 +178,15 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> free(new);
return(0);
}
- replyposn=lseek(headfile,0,1)-sizeof(inreplyto);
<span style="color: #000000;background-color: #ddffdd">+ replyposn=lseek(headfile,0,1)-sizeof(inreplyto);
</span> close(headfile);
inreplyto.status|=(1<<2);
}
-
- new->replyto=replyto;
<span style="color: #000000;background-color: #ddffdd">+
+ new->replyto=replyto;
</span> new->status=0;
if (remote) new->status|=(1<<3);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> new->date=time(0);
if (!remote) printf(_("Message from %s\n"),user->name);
strncpy(new->from,user->name,30);
<span style="color: #aaaaaa">@@ -198,7 +198,7 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> strncpy(t,new->to,NAMESIZE);
strip_name(t);
if (is_private(fol,user) && !is_old(&usr,t,&up))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> printf(_("Message must be addressed to an existing user.\n"));
free(fol);
free(new);
<span style="color: #aaaaaa">@@ -218,7 +218,7 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> printf(_("Send to: "));
get_str(new->to,SUBJECTSIZE);
if (is_private(fol,user) && !is_old(&usr,new->to,&up))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> printf(_("Message must be addressed to an existing user.\n"));
free(fol);
free(new);
<span style="color: #aaaaaa">@@ -232,10 +232,10 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> strncpy(new->to,inreplyto.from,SUBJECTSIZE);
printf(("Marked as To: %s\n"),new->to);
}
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> /* read in main message text */
-
- clearerr(stdin);
<span style="color: #000000;background-color: #ddffdd">+
+ clearerr(stdin);
</span> buff=(char *)malloc(1024);
limit=1024;
if (!remote)
<span style="color: #aaaaaa">@@ -269,7 +269,7 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> clearerr(stdin);
/* read in current folder status & prepare message for saveing */
- if (!remote)
<span style="color: #000000;background-color: #ddffdd">+ if (!remote)
</span> do{
printf(_("Post message, edit, reformat, or Abandon ?"));
get_str(answer,9);
<span style="color: #aaaaaa">@@ -305,7 +305,7 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> }else
myeditor=SECUREEDITOR;
- if (perms_drop()==-1)
<span style="color: #000000;background-color: #ddffdd">+ if (perms_drop()==-1)
</span> {
printf(_("Failed to set user id, aborting.\n"));
perror("setuid");
<span style="color: #aaaaaa">@@ -326,7 +326,7 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> mask=umask(~0600);
tfile = mkstemp(fullpath);
if (tfile < 0)
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> printf(_("Cannot create temporary file: %s\n"), strerror(errno));
perms_restore();
free(fol);
<span style="color: #aaaaaa">@@ -354,7 +354,7 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> }else
{
int a;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> do {
a=wait(NULL);
if (a==-1 && errno!=EINTR)
<span style="color: #aaaaaa">@@ -384,9 +384,9 @@ int add_msg(int folnum,struct person *user,int replyto)
</span>
folderfile=openfolderfile(O_RDWR);
Lock_File(folderfile);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* open files ready for saveing */
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if ((i=err_open(buildpath(STATEDIR,fol->name,INDEX_END,is_moderated(fol,user)?MOD_END:""),O_CREAT|O_RDWR,0600))<0)
{
exit(-1);
<span style="color: #aaaaaa">@@ -398,7 +398,7 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> Lock_File(folderfile);
Lock_File(i);
Lock_File(data);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> new->datafield=lseek(data,0l,2);
lseek(folderfile,folnum*sizeof(struct folder),0);
read(folderfile,fol,sizeof(*fol));
<span style="color: #aaaaaa">@@ -417,10 +417,10 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> {
new->Ref=0;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> tt=lseek(i,0,2);
td=tt%sizeof(*new);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (td>0){
printf(_("Warning: Index error, skipping back %ld bytes.\r\n"),td);
lseek(i,-td,1);
<span style="color: #aaaaaa">@@ -451,7 +451,7 @@ int add_msg(int folnum,struct person *user,int replyto)
</span> Unlock_File(data);
Unlock_File(i);
Unlock_File(folderfile);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> close(i);
close(data);
close(folderfile);
</code></pre>
<br>
</li>
<li id='diff-2'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-2'>
<strong>
src/client/alarm.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/alarm.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/alarm.c
</span><span style="color: #aaaaaa">@@ -50,7 +50,7 @@ void alarm_cleanup(void)
</span> s.sa_handler = SIG_DFL;
s.sa_flags = 0;
s.sa_mask = mask;
- sigaction(SIGALRM, &s, NULL);
<span style="color: #000000;background-color: #ddffdd">+ sigaction(SIGALRM, &s, NULL);
</span> next_alarm = NULL;
while (first_alarm != NULL)
{
</code></pre>
<br>
</li>
<li id='diff-3'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-3'>
<strong>
src/client/alarm.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/alarm.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/alarm.h
</span><span style="color: #aaaaaa">@@ -21,7 +21,7 @@ void alarm_cleanup(void);
</span> void alarm_handler(int sig);
struct alarm *alarm_at(const struct timeval *when, void *what, void (*how)(void *));
struct alarm *alarm_after(long secs, long usecs, void *what, void (*how)(void *));
-void alarm_sleep(struct timeval *delay, int resume);
<span style="color: #000000;background-color: #ddffdd">+void alarm_sleep(struct timeval *delay, int resume);
</span> int alarm_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
#endif /* ALARM_H */
</code></pre>
<br>
</li>
<li id='diff-4'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-4'>
<strong>
src/client/alias.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/alias.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/alias.h
</span><span style="color: #aaaaaa">@@ -1,7 +1,7 @@
</span> #ifndef ALIAS_H
#define ALIAS_H
-typedef struct alias_record
<span style="color: #000000;background-color: #ddffdd">+typedef struct alias_record
</span> {
char *from;
char *to;
</code></pre>
<br>
</li>
<li id='diff-5'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-5'>
<strong>
src/client/colour.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/colour.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/colour.c
</span><span style="color: #aaaaaa">@@ -51,7 +51,7 @@ char *colour(char *text, int *concealed)
</span> line[i++]='[';
/* reset string ? */
- if (strchr("-n", text[0]) &&
<span style="color: #000000;background-color: #ddffdd">+ if (strchr("-n", text[0]) &&
</span> strchr("-n", text[1]) )
{
line[i++]='m';
<span style="color: #aaaaaa">@@ -59,9 +59,9 @@ char *colour(char *text, int *concealed)
</span> return(line);
}
-#ifdef CHILDISH
<span style="color: #000000;background-color: #ddffdd">+#ifdef CHILDISH
</span> /* hidden text ? */
- if (strchr("Hh", text[0]) &&
<span style="color: #000000;background-color: #ddffdd">+ if (strchr("Hh", text[0]) &&
</span> strchr("Hh", text[1]) )
{
/* return 'normal' colour code, and set 'concealed' */
<span style="color: #aaaaaa">@@ -92,7 +92,7 @@ char *colour(char *text, int *concealed)
</span> if (strchr("bB",text[0])) line[i++]='4'; else
if (strchr("mM",text[0])) line[i++]='5'; else
if (strchr("cC",text[0])) line[i++]='6'; else
- if (strchr("wW",text[0])) line[i++]='7';
<span style="color: #000000;background-color: #ddffdd">+ if (strchr("wW",text[0])) line[i++]='7';
</span>
/* seperator */
if (strchr("n-",text[0])==NULL && strchr("n-",text[1])==NULL) line[i++]=';';
<span style="color: #aaaaaa">@@ -156,7 +156,7 @@ void colour_load(char *file, int quiet)
</span> if ((c=strtok(buff," \t"))==NULL) { free(buff); continue; }
i=atoi(c);
if (i<0 || i>=COLOUR_LIMIT) { free(buff); continue; }
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if ((c=strtok(NULL, "\n"))==NULL) { free(buff); continue; }
while (*c==' ' || *c=='\t') c++;
<span style="color: #aaaaaa">@@ -164,18 +164,18 @@ void colour_load(char *file, int quiet)
</span> if (colour_chart[i]!=NULL)
if (!quiet) printf("Warning: redefining colour %d\n",i);
- colour_chart[i]=strdup(c);
<span style="color: #000000;background-color: #ddffdd">+ colour_chart[i]=strdup(c);
</span> count++;
free(buff);
}
if (!quiet) printf("Loaded %d colour definitions.\n",count);
}
-void init_colour(void)
<span style="color: #000000;background-color: #ddffdd">+void init_colour(void)
</span> {
int i;
char path[1024];
-
<span style="color: #000000;background-color: #ddffdd">+
</span> for (i=0;i<COLOUR_LIMIT;i++) colour_chart[i]=NULL;
snprintf(path, 1023, COLOURDIR"/%d.col", user->colour);
</code></pre>
<br>
</li>
<li id='diff-6'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-6'>
<strong>
src/client/edit.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/edit.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/edit.c
</span><span style="color: #aaaaaa">@@ -46,11 +46,11 @@ extern long userposn;
</span> static void edit_all(struct person *usr)
{
int i,r;
- char tmp[80];
-
<span style="color: #000000;background-color: #ddffdd">+ char tmp[80];
+
</span> printf("Editing user %s\n",usr->name);
printf("Enter new data for each field <cr> to leave unchanged.\n");
-
<span style="color: #000000;background-color: #ddffdd">+
</span> printf("realname: %s\nnew name: ",usr->realname);
get_str(tmp,REALNAMESIZE);
if (strlen(tmp)!=0) strcpy(usr->realname,tmp);
<span style="color: #aaaaaa">@@ -80,7 +80,7 @@ static void edit_all(struct person *usr)
</span> show_user_stats(usr->status,tmp,true);
printf("current status %s\nnew status: ",tmp);
get_str(tmp,20);
- if (*tmp)
<span style="color: #000000;background-color: #ddffdd">+ if (*tmp)
</span> {
usr->status=user_stats(tmp,usr->status);
show_user_stats(usr->status,tmp,false);
<span style="color: #aaaaaa">@@ -113,7 +113,7 @@ static void show_change(char *old, char *new, const char *fmt, ...)
</span> strncat(sub, buff, MAXTEXTLENGTH - strlen(sub) - 1);
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* calulate add */
add[0] = 0;
for (i=0; i < strlen(new); i++)
<span style="color: #aaaaaa">@@ -150,7 +150,7 @@ void edit_user(const char *args, const char *name)
</span> printf(_("Username %s not found.\n"),name);
return;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (stringcmp(args,"edit",-1))
edit_all(&usr);
else
<span style="color: #aaaaaa">@@ -222,7 +222,7 @@ void edit_user(const char *args, const char *name)
</span> printf(_("New chatprivs [+-=][%s]: "),display_cpflags((unsigned long)0xffffffff));
get_str(stats,38);
if (*stats)
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> usr.chatprivs=cp_setbycode(usr.chatprivs, stats);
printf(_("Chatprivs set to [%s].\n"),display_cpflags(usr.chatprivs));
ipc_send_to_username(usr.name, IPC_CHATPRIVS, stats);
<span style="color: #aaaaaa">@@ -278,7 +278,7 @@ void edit_user(const char *args, const char *name)
</span> printf(_("New chatmode [+-=][%s]: "),display_cmflags((unsigned long)0xffffffff));
get_str(stats,38);
if (*stats)
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> usr.chatmode=cm_setbycode(usr.chatmode, stats);
printf(_("Chatmode set to [%s].\n"),display_cmflags(usr.chatmode));
ipc_send_to_username(usr.name, IPC_CHATMODE, stats);
<span style="color: #aaaaaa">@@ -412,12 +412,12 @@ void edit_user(const char *args, const char *name)
</span> }else
printf(_("Attempting to update existing user.\n"));
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> printf(_("Are you sure you want to change user '%s' into user '%s' ? "),oldname,username);
fflush(stdout);
get_str(answer,5);
if (answer[0]=='y' || answer[0]=='Y')
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> strcpy(usr.name,username);
ipc_send_to_username(oldname, IPC_USERNAME, usr.name);
printf(_("New name set.\n"));
<span style="color: #aaaaaa">@@ -552,7 +552,7 @@ void edit_user(const char *args, const char *name)
</span> show_special(usr.special,specs,true);
printf(_("Username: %s\nReal Name: %s\n"),usr.name,usr.realname);
printf(_("Contact: %s\nStatus [%s]\tSpecials [%s]\n"),usr.contact,stats,specs);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> show_fold_groups(usr.groups,stats,true);
printf(_("Groups [%s]\n"),stats);
<span style="color: #aaaaaa">@@ -587,7 +587,7 @@ static void users_lastread(int folnum)
</span> {
struct person usr;
int ufile;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> ufile=userdb_open(O_RDWR);
Lock_File(ufile);
while (read(ufile,&usr,sizeof(usr))>0)
<span style="color: #aaaaaa">@@ -607,8 +607,8 @@ void edit_folder(const char *args, const char *name)
</span> int folnum;
int afile;
struct folder fold;
- char tmp[80];
-
<span style="color: #000000;background-color: #ddffdd">+ char tmp[80];
+
</span> if ((folnum=foldernumber(name))==-1)
{
printf(_("Unknown folder name.\n"));
<span style="color: #aaaaaa">@@ -668,7 +668,7 @@ void edit_folder(const char *args, const char *name)
</span> get_str(tmp,FOLNAMESIZE);
if (*tmp)
{
- char oldpath[PATHSIZE];
<span style="color: #000000;background-color: #ddffdd">+ char oldpath[PATHSIZE];
</span> mwlog("FOLDER(RENAME) of %s to %s", fold.name, tmp);
sprintf(oldpath,"%s/%s%s",STATEDIR,fold.name,INDEX_END);
<span style="color: #aaaaaa">@@ -681,12 +681,12 @@ void edit_folder(const char *args, const char *name)
</span> {
sprintf(oldpath,"%s/%s%s%s",STATEDIR,fold.name,INDEX_END,MOD_END);
sprintf(fullpath,"%s/%s%s%s",STATEDIR,tmp,INDEX_END,MOD_END);
- if (!access(oldpath,00)) rename(oldpath,fullpath);
<span style="color: #000000;background-color: #ddffdd">+ if (!access(oldpath,00)) rename(oldpath,fullpath);
</span> sprintf(oldpath,"%s/%s%s%s",STATEDIR,fold.name,TEXT_END,MOD_END);
sprintf(fullpath,"%s/%s%s%s",STATEDIR,tmp,TEXT_END,MOD_END);
if (!access(oldpath,00)) rename(oldpath,fullpath);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> strcpy(fold.name,tmp);
printf(_("Name changed to %s\n"),fold.name);
}
<span style="color: #aaaaaa">@@ -771,8 +771,8 @@ void edit_folder(const char *args, const char *name)
</span> lseek(afile,folnum*sizeof(struct folder),0);
write(afile,&fold,sizeof(struct folder));
Unlock_File(afile);
- close(afile);
-}
<span style="color: #000000;background-color: #ddffdd">+ close(afile);
+}
</span>
const char *partlist_mesg[]={
"edit", "to", "subject", "delete", "undelete", "status", NULL};
<span style="color: #aaaaaa">@@ -782,12 +782,12 @@ void mesg_edit(const char *args, char *foldername, int msgno, struct person *usr
</span> int fd, text;
struct Header head;
char *buff;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if ((fd=err_open(buildpath(STATEDIR,foldername,INDEX_END,""),O_RDWR,0))<0)
return;
if ((text=err_open(buildpath(STATEDIR,foldername,TEXT_END,""),O_RDWR,0))<0)
return;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* go and get message */
while (get_data(fd,&head) && head.Ref<msgno);
if (head.Ref!=msgno)
<span style="color: #aaaaaa">@@ -797,7 +797,7 @@ void mesg_edit(const char *args, char *foldername, int msgno, struct person *usr
</span> }
buff=(char *)malloc(head.size);
lseek(text,head.datafield,0);
- read(text,buff,head.size);
<span style="color: #000000;background-color: #ddffdd">+ read(text,buff,head.size);
</span>
if (!u_god(usr->status) && !u_mod(usr->status) && strcasecmp(head.from,usr->name))
{
<span style="color: #aaaaaa">@@ -813,7 +813,7 @@ void mesg_edit(const char *args, char *foldername, int msgno, struct person *usr
</span> int child;
const char *myeditor;
- if (perms_drop()==-1)
<span style="color: #000000;background-color: #ddffdd">+ if (perms_drop()==-1)
</span> {
printf(_("Failed to set user id, aborting.\n"));
perror("setuid");
<span style="color: #aaaaaa">@@ -852,7 +852,7 @@ void mesg_edit(const char *args, char *foldername, int msgno, struct person *usr
</span> }else
{
int a;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> do {
if (mesg_waiting) handle_mesg();
a=wait(NULL);
<span style="color: #aaaaaa">@@ -942,7 +942,7 @@ void mesg_edit(const char *args, char *foldername, int msgno, struct person *usr
</span> close(fd);
close(text);
free(buff);
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
void time_on(long u)
{
</code></pre>
<br>
</li>
<li id='diff-7'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-7'>
<strong>
src/client/expand.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/expand.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/expand.c
</span><span style="color: #aaaaaa">@@ -399,7 +399,7 @@ static const char *expand_index(const char *in, var_list_t *array)
</span> char *name_start;
var_op_t saved_op;
char *saved_key;
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> SHOWSTATE();
/*printf("Entering expand_index()\n");*/
/* Recursively expand the quoted name */
<span style="color: #aaaaaa">@@ -698,7 +698,7 @@ static const char *eval_expr(const char *in)
</span> case '(':
if (push_paren()) break; else return NULL;
case ')':
- if (push_op(op_paren))
<span style="color: #000000;background-color: #ddffdd">+ if (push_op(op_paren))
</span> {
/*printf("Remaining input: \"%s\"\n", in);*/
break;
</code></pre>
<br>
</li>
<li id='diff-8'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-8'>
<strong>
src/client/getpass.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/getpass.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/getpass.c
</span><span style="color: #aaaaaa">@@ -16,7 +16,7 @@ char *get_pass(char *p)
</span> int pos=0;
printf("%s",p);
fflush(stdout);
- echo_off();
<span style="color: #000000;background-color: #ddffdd">+ echo_off();
</span> while(1)
{
int c;
<span style="color: #aaaaaa">@@ -34,7 +34,7 @@ char *get_pass(char *p)
</span> else if(c==10 || c==13)
{
buf[pos]=0;
- echo_on();
<span style="color: #000000;background-color: #ddffdd">+ echo_on();
</span> if(internet==0)
{
printf("\r\n");
</code></pre>
<br>
</li>
<li id='diff-9'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-9'>
<strong>
src/client/hash.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/hash.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/hash.c
</span><span style="color: #aaaaaa">@@ -68,7 +68,7 @@ void hash_free(int field)
</span>
/* Make sure all variables are removed */
hash_purge(field);
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> frec = &fields[field];
/* Relink into free list */
frec->gnext = freefields;
</code></pre>
<br>
</li>
<li id='diff-10'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-10'>
<strong>
src/client/incoming.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/incoming.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/incoming.c
</span><span style="color: #aaaaaa">@@ -117,7 +117,7 @@ static void StackEvent(char *text, char *from, int flags)
</span>
void ClearStack(void) {
struct mstack *old;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* Nuke the entire stack */
while (MesgStack!=NULL) {
old=MesgStack;
<span style="color: #aaaaaa">@@ -464,7 +464,7 @@ static void force_lastread(const char * newbuff) {
</span> sscanf(newbuff,"%d:%d",&fol,&pos);
user->lastread[fol]=pos;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> static void display_uptime(ipc_message_t *msg)
{
json_t * j = json_init(msg);
<span style="color: #aaaaaa">@@ -542,7 +542,7 @@ static void display_content(ipc_message_t *msg)
</span> } else
if (strcmp(type, "raw")==0) {
snprintf(tb, len, "%s", text);
- } else
<span style="color: #000000;background-color: #ddffdd">+ } else
</span> if (strcmp(type, "emote")==0) {
int plural = json_getint(j, "plural");
switch (plural) {
<span style="color: #aaaaaa">@@ -600,7 +600,7 @@ static void display_content(ipc_message_t *msg)
</span> len -= s;
tb += s;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (strcmp(type, "whispers")==0) {
snprintf(tb, len, "%s whispers: %s", whom, text);
} else
<span style="color: #aaaaaa">@@ -631,7 +631,7 @@ static void display_content(ipc_message_t *msg)
</span> len -= s;
tb += s;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> snprintf(tb, len, "%s shouts: %s", whom, text);
force_text(msg, buff, whom);
} else
<span style="color: #aaaaaa">@@ -759,7 +759,7 @@ static void accept_pipe_cmd(ipc_message_t *msg, struct person *mesg_user)
</span> }
ipcmsg_destroy(msg);
- update_user(user,userposn);
<span style="color: #000000;background-color: #ddffdd">+ update_user(user,userposn);
</span> }
static void force_newmail(void)
<span style="color: #aaaaaa">@@ -774,13 +774,13 @@ static void force_text(ipc_message_t *msg, const char *text, const char *from)
</span>
mesg = malloc(sizeof(*mesg));
mesg->flags = MST_EVENT|MST_BEEP;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> tb[0]=0;
if (s_timestamp(user->special))
{
time_t t;
struct tm *tt;
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> t= msg->head.when;
tt=localtime(&t);
strftime(tb, MAXTEXTLENGTH,"%H:%M ", tt);
<span style="color: #aaaaaa">@@ -907,7 +907,7 @@ static void force_gag(char *newbuff, unsigned long theirprivs, const char *from)
</span>
unsigned long newcm = user->chatmode & ~CM_GAGMASK;
- if (newbuff[0]=='+')
<span style="color: #000000;background-color: #ddffdd">+ if (newbuff[0]=='+')
</span> newcm |= atoi(&newbuff[1]) << CM_GAGSHIFT;
user->chatmode=chatmode_describe(user->chatmode, newcm, ourapl, theirapl, from);
<span style="color: #aaaaaa">@@ -1024,7 +1024,7 @@ static void force_kick(char *newbuff, char *from, unsigned long theirprivs)
</span> {
char *msg = NULL;
char type;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> type = *newbuff;
if (newbuff[1] == 'r') msg = &newbuff[2];
<span style="color: #aaaaaa">@@ -1088,7 +1088,7 @@ static void mrod(char *from, char *msg)
</span> printf(_("Boing, Zebedee's left you standing all alone\n"));
printf(_("WWWHHHEEEEEEEKKKKEEEERRRRRUUUUUNNNNNCCCCCHHHHHH\7\7\7\7\7\n"));
printf(_("%s has just dropped the Magic Roundabout of Death on you.\n"),from);
- if (msg!=NULL)
<span style="color: #000000;background-color: #ddffdd">+ if (msg!=NULL)
</span> {
snprintf(mrod_message, MAXTEXTLENGTH-1, _("\"%s\033--\" says Zebedee\n"), msg);
display_message(mrod_message, 1, 1);
<span style="color: #aaaaaa">@@ -1096,7 +1096,7 @@ static void mrod(char *from, char *msg)
</span> fflush(stdout);
fix_terminal();
-
<span style="color: #000000;background-color: #ddffdd">+
</span> mrod_user = malloc(sizeof(char) * (strlen(from) + 1));
strcpy(mrod_user, from);
close_down(3, from, msg);
</code></pre>
<br>
</li>
<li id='diff-11'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-11'>
<strong>
src/client/init.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/init.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/init.c
</span><span style="color: #aaaaaa">@@ -54,7 +54,7 @@ void perms_restore(void)
</span>
static int ReadInitFile(const char *base, const char *filename)
{
- FILE *file;
<span style="color: #000000;background-color: #ddffdd">+ FILE *file;
</span> char *buff, *backup, *header;
char path[1024];
char *a, *b, *c;
<span style="color: #aaaaaa">@@ -123,7 +123,7 @@ static int ReadInitFile(const char *base, const char *filename)
</span> return 0; // changed because if an error occured after this point the file exists, the js code has reported the error to the user and returning 1 will report to them that it doesn't exist
}
- lineno=0;
<span style="color: #000000;background-color: #ddffdd">+ lineno=0;
</span> while (!feof(file))
{
if ((buff = frl_line_nspace(file, "#")) == NULL) break;
<span style="color: #aaaaaa">@@ -139,7 +139,7 @@ static int ReadInitFile(const char *base, const char *filename)
</span> /* load command aliases */
if (!strcasecmp(a,"alias"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed alias in %s at line %d\n"),filename,lineno);
free(backup);
<span style="color: #aaaaaa">@@ -162,7 +162,7 @@ static int ReadInitFile(const char *base, const char *filename)
</span> /* load function binds */
if (!strcasecmp(a,"bind"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed bind in %s at line %d\n"),filename,lineno);
free(backup);
<span style="color: #aaaaaa">@@ -185,7 +185,7 @@ static int ReadInitFile(const char *base, const char *filename)
</span> /* load rpc binds */
if (!strcasecmp(a,"rpc"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed rpc bind in %s at line %d\n"),filename,lineno);
free(backup);
<span style="color: #aaaaaa">@@ -208,7 +208,7 @@ static int ReadInitFile(const char *base, const char *filename)
</span> /* include a seperate script file */
if (!strcasecmp(a, "include"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed include in %s at line %d\n"),filename,lineno);
free(backup);
<span style="color: #aaaaaa">@@ -227,7 +227,7 @@ static int ReadInitFile(const char *base, const char *filename)
</span> /* check for destroying functions */
if (!strcasecmp(a, "destroy"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed include in %s at line %d\n"),filename,lineno);
free(backup);
<span style="color: #aaaaaa">@@ -255,7 +255,7 @@ static int ReadInitFile(const char *base, const char *filename)
</span> /* bind ipc function */
if (!strcasecmp(a, "ipc"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed ipc in %s at line %d\n"),filename,lineno);
free(backup);
<span style="color: #aaaaaa">@@ -315,11 +315,11 @@ static int ReadInitFile(const char *base, const char *filename)
</span> {
printf(_("Force bind already exists. Useless instruction at line %d in %s.\n"), lineno, filename);
}
- }else
<span style="color: #000000;background-color: #ddffdd">+ }else
</span> /* load mw-script functions */
if (!strcasecmp(a,"function"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed Script Function declaration in %s at line %d\n"),filename,lineno);
free(backup);
<span style="color: #aaaaaa">@@ -328,11 +328,11 @@ static int ReadInitFile(const char *base, const char *filename)
</span> }
/* set function to 'normal' */
LoadFunction(b, header, file, &lineno, filename, 0);
- }else
<span style="color: #000000;background-color: #ddffdd">+ }else
</span> /* load mw-script functions (local, hidden function) */
if (!strcasecmp(a,"lfunction"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed Script Function declaration in %s at line %d\n"),filename,lineno);
free(backup);
<span style="color: #aaaaaa">@@ -341,11 +341,11 @@ static int ReadInitFile(const char *base, const char *filename)
</span> }
/* set function to 'non-interface' (local) */
LoadFunction(b, header, file, &lineno, filename, FUNCFLAG_LOCAL);
- }else
<span style="color: #000000;background-color: #ddffdd">+ }else
</span> /* load mw-script initialisation function */
if (!strcasecmp(a,"initfunc"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed Script Init declaration in %s at line %d\n"),filename,lineno);
free(backup);
<span style="color: #aaaaaa">@@ -354,11 +354,11 @@ static int ReadInitFile(const char *base, const char *filename)
</span> }
/* set function to 'init' */
LoadFunction(b, header, file, &lineno, filename, FUNCFLAG_AUTOINIT);
- }else
<span style="color: #000000;background-color: #ddffdd">+ }else
</span> /* load a local, hidden mw-script initialisation function */
if (!strcasecmp(a,"linitfunc"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed Script Init declaration in %s at line %d\n"),filename,lineno);
free(backup);
<span style="color: #aaaaaa">@@ -367,11 +367,11 @@ static int ReadInitFile(const char *base, const char *filename)
</span> }
/* set function to 'init' and 'non-interface'*/
LoadFunction(b, header, file, &lineno, filename, FUNCFLAG_AUTOINIT | FUNCFLAG_LOCAL);
- }else
<span style="color: #000000;background-color: #ddffdd">+ }else
</span> /* load mw-script board initialisation function */
if (!strcasecmp(a,"boardfunc"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed Script BoardInit declaration in %s at line %d\n"),filename,lineno);
free(backup);
<span style="color: #aaaaaa">@@ -380,11 +380,11 @@ static int ReadInitFile(const char *base, const char *filename)
</span> }
/* set function to 'boardinit' */
LoadFunction(b, header, file, &lineno, filename, FUNCFLAG_BOARDINIT);
- }else
<span style="color: #000000;background-color: #ddffdd">+ }else
</span> /* load a local, hidden mw-script board initialisation function */
if (!strcasecmp(a,"lboardfunc"))
{
- if ((b=strtok(NULL," \t\n\r"))==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((b=strtok(NULL," \t\n\r"))==NULL)
</span> {
printf(_("Malformed Script BoardInit declaration in %s at line %d\n"),filename,lineno);
free(backup);
</code></pre>
<br>
</li>
<li id='diff-12'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-12'>
<strong>
src/client/js.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/js.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/js.c
</span><span style="color: #aaaaaa">@@ -101,14 +101,14 @@ JSClass js_termsizeclass = {
</span>
/* prints a warning */
-static void js_warning(JSContext *cx, const char *warning)
<span style="color: #000000;background-color: #ddffdd">+static void js_warning(JSContext *cx, const char *warning)
</span> {
JSStackFrame *fp = NULL;
JSScript *script;
const char *filename;
int lineno;
jsbytecode *pc;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> fp = JS_FrameIterator(cx, &fp); // get the current js stack frame
script = JS_GetFrameScript(cx, fp); // get the current script from the stack frame
filename = JS_GetScriptFilename(cx, script); // get the file name of the script
<span style="color: #aaaaaa">@@ -116,7 +116,7 @@ static void js_warning(JSContext *cx, const char *warning)
</span> lineno = JS_PCToLineNumber(cx, script, pc); // get the actual line number from the pc
printf("JS Warning: %s\nFile: %s:%u\n", warning, filename, lineno+1);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
/* called if a script runs too long */
<span style="color: #aaaaaa">@@ -148,7 +148,7 @@ static void js_start_timeout(void)
</span> /* Function for printing to standard out from javascript (helpful for
* debugging and demonstrates how to call C from js) - also useful for event functions
*/
-static JSBool js_print(JSContext *cx, unsigned int argc, jsval *vp)
<span style="color: #000000;background-color: #ddffdd">+static JSBool js_print(JSContext *cx, unsigned int argc, jsval *vp)
</span> {
unsigned int i;
jsval *argv = JS_ARGV(cx, vp);
<span style="color: #aaaaaa">@@ -156,12 +156,12 @@ static JSBool js_print(JSContext *cx, unsigned int argc, jsval *vp)
</span> if (argc < 1) {
return JS_TRUE;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> for (i = 0; i<argc; i++) {
if (JSVAL_IS_STRING(argv[i]) || JSVAL_IS_NUMBER(argv[i])) {
msg = JS_EncodeString(cx, JS_ValueToString(cx, argv[i]));
display_message(msg, 0, 1);
- } else
<span style="color: #000000;background-color: #ddffdd">+ } else
</span> if (JSVAL_IS_NULL(argv[i])) {
display_message("jsval is NULL",0,1);
} else
<span style="color: #aaaaaa">@@ -176,7 +176,7 @@ static JSBool js_print(JSContext *cx, unsigned int argc, jsval *vp)
</span> }
/* execute a talker command */
-static JSBool js_mwexec(JSContext *cx, unsigned int argc, jsval *vp)
<span style="color: #000000;background-color: #ddffdd">+static JSBool js_mwexec(JSContext *cx, unsigned int argc, jsval *vp)
</span> {
jsval *argv = JS_ARGV(cx, vp);
AUTOFREE_BUFFER msg = NULL;
<span style="color: #aaaaaa">@@ -184,7 +184,7 @@ static JSBool js_mwexec(JSContext *cx, unsigned int argc, jsval *vp)
</span> JS_ReportError(cx, "exec() expects an argument.");
return JS_FALSE;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (JSVAL_IS_STRING(argv[0])) {
msg = JS_EncodeString(cx, JS_ValueToString(cx, argv[0]));
DoCommand(msg, chattable);
<span style="color: #aaaaaa">@@ -196,7 +196,7 @@ static JSBool js_mwexec(JSContext *cx, unsigned int argc, jsval *vp)
</span>
/* say to the talker */
-static JSBool js_say(JSContext *cx, unsigned int argc, jsval *vp)
<span style="color: #000000;background-color: #ddffdd">+static JSBool js_say(JSContext *cx, unsigned int argc, jsval *vp)
</span> {
jsval *argv = JS_ARGV(cx, vp);
AUTOFREE_BUFFER msg = NULL;
<span style="color: #aaaaaa">@@ -223,7 +223,7 @@ static JSBool js_say(JSContext *cx, unsigned int argc, jsval *vp)
</span> }
/* send an rpc/rpb */
-static JSBool js_rpc(JSContext *cx, unsigned int argc, jsval *vp)
<span style="color: #000000;background-color: #ddffdd">+static JSBool js_rpc(JSContext *cx, unsigned int argc, jsval *vp)
</span> {
jsval *argv = JS_ARGV(cx, vp);
AUTOFREE_BUFFER msg = NULL;
<span style="color: #aaaaaa">@@ -260,7 +260,7 @@ static JSBool js_rpc(JSContext *cx, unsigned int argc, jsval *vp)
</span> }
/* send an ipc/ipb */
-static JSBool js_ipc(JSContext *cx, unsigned int argc, jsval *vp)
<span style="color: #000000;background-color: #ddffdd">+static JSBool js_ipc(JSContext *cx, unsigned int argc, jsval *vp)
</span> {
jsval *argv = JS_ARGV(cx, vp);
AUTOFREE_BUFFER msg = NULL;
<span style="color: #aaaaaa">@@ -292,16 +292,16 @@ static JSBool js_ipc(JSContext *cx, unsigned int argc, jsval *vp)
</span> }
/* ask a user for extra input */
-static JSBool js_input(JSContext *cx, unsigned int argc, jsval *vp)
<span style="color: #000000;background-color: #ddffdd">+static JSBool js_input(JSContext *cx, unsigned int argc, jsval *vp)
</span> {
jsval *argv = JS_ARGV(cx, vp);
JSString *the_jsstring, *jsstr;
size_t ucs2_length, prompt_length, line_length;
const jschar *ucs2_string;
int conv_error;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> char *prompt=NULL, *line;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(argc > 0) {
if(JSVAL_IS_STRING(argv[0])) {
// convert prompt to local - this bit of ugliness is still needed in case people aren't using utf8
<span style="color: #aaaaaa">@@ -309,7 +309,7 @@ static JSBool js_input(JSContext *cx, unsigned int argc, jsval *vp)
</span> ucs2_length=JS_GetStringLength(the_jsstring);
ucs2_string=JS_GetStringCharsZ(cx, the_jsstring);
prompt_length=sizeof(char)*((ucs2_length*3)+1); // bit ugly
- prompt=malloc(prompt_length);
<span style="color: #000000;background-color: #ddffdd">+ prompt=malloc(prompt_length);
</span> if(prompt!=NULL) {
conv_error=convert_string_charset((char *)ucs2_string, "UCS-2", ucs2_length*sizeof(jschar), prompt, "LOCAL//TRANSLIT", prompt_length, NULL, NULL, NULL, NULL, NULL);
if(conv_error<0) {
<span style="color: #aaaaaa">@@ -334,14 +334,14 @@ static JSBool js_input(JSContext *cx, unsigned int argc, jsval *vp)
</span> busy--;
free(prompt);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> line_length = sizeof(jschar) * (strlen(line) + 1);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> // likewise as this has come straight from a readline we need a convert from local charset
jschar *u2_string = malloc(line_length);
if(u2_string!=NULL) {
conv_error=convert_string_charset(line, "LOCAL", strlen(line),
- (char *)u2_string, "UTF-16//TRANSLIT", line_length,
<span style="color: #000000;background-color: #ddffdd">+ (char *)u2_string, "UTF-16//TRANSLIT", line_length,
</span> NULL, NULL, NULL, NULL, NULL);
if(conv_error>=0) {
jsstr = JS_NewUCStringCopyZ(cx, u2_string);
<span style="color: #aaaaaa">@@ -379,12 +379,12 @@ static JSBool js_beep(JSContext *cx, unsigned int argc, jsval *vp)
</span> {
write(1,"\7",1);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> return JS_TRUE;
}
/* bind something to a javascript function */
-static JSBool js_bind(JSContext *cx, unsigned int argc, jsval *vp)
<span style="color: #000000;background-color: #ddffdd">+static JSBool js_bind(JSContext *cx, unsigned int argc, jsval *vp)
</span> {
jsval *argv = JS_ARGV(cx, vp);
AUTOFREE_BUFFER jbind = NULL;
<span style="color: #aaaaaa">@@ -392,14 +392,14 @@ static JSBool js_bind(JSContext *cx, unsigned int argc, jsval *vp)
</span> int bind_type=-1;
int i=1;
char msg[MAXTEXTLENGTH];
-
<span style="color: #000000;background-color: #ddffdd">+
</span> msg[MAXTEXTLENGTH-1]='\0';
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (argc < 2) {
JS_ReportError(cx, "Error in javascript: bind expects at least 2 arguments");
return JS_FALSE;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (JSVAL_IS_STRING(argv[0])) {
jbind = JS_EncodeString(cx, JS_ValueToString(cx, argv[0]));
bind_type=K_BIND;
<span style="color: #aaaaaa">@@ -492,7 +492,7 @@ static JSBool js_bind(JSContext *cx, unsigned int argc, jsval *vp)
</span> snprintf(msg, MAXTEXTLENGTH-1, "Shutdown bind %s already exists", function_name);
js_warning(cx, msg);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> break;
case K_BIND_INPUT:
if(AddLink(&eventin_list, function_name, ""))
<span style="color: #aaaaaa">@@ -510,21 +510,21 @@ static JSBool js_bind(JSContext *cx, unsigned int argc, jsval *vp)
</span> }
/* bind something to a javascript function */
-static JSBool js_unbind(JSContext *cx, unsigned int argc, jsval *vp)
<span style="color: #000000;background-color: #ddffdd">+static JSBool js_unbind(JSContext *cx, unsigned int argc, jsval *vp)
</span> {
jsval *argv = JS_ARGV(cx, vp);
AUTOFREE_BUFFER jbind = NULL;
char *function_name=NULL;
int bind_type=-1;
char msg[MAXTEXTLENGTH];
-
<span style="color: #000000;background-color: #ddffdd">+
</span> msg[MAXTEXTLENGTH-1]='\0';
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (argc < 1) {
JS_ReportError(cx, "Error in javascript: unbind expects at least 1 argument");
return JS_FALSE;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (JSVAL_IS_STRING(argv[0])) {
jbind = JS_EncodeString(cx, JS_ValueToString(cx, argv[0]));
bind_type=K_BIND;
<span style="color: #aaaaaa">@@ -613,7 +613,7 @@ static JSBool js_unbind(JSContext *cx, unsigned int argc, jsval *vp)
</span> snprintf(msg, MAXTEXTLENGTH-1, "Shutdown bind %s does not exist for unbinding", function_name);
js_warning(cx, msg);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> break;
case K_BIND_INPUT:
if(!DestroyLink(&eventin_list, function_name))
<span style="color: #aaaaaa">@@ -631,11 +631,11 @@ static JSBool js_unbind(JSContext *cx, unsigned int argc, jsval *vp)
</span> }
// return the users terminal dimensions
-static JSBool js_termsize(JSContext *cx, unsigned int argc, jsval *vp)
<span style="color: #000000;background-color: #ddffdd">+static JSBool js_termsize(JSContext *cx, unsigned int argc, jsval *vp)
</span> {
JSObject *result_object;
int width, height;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> result_object=JS_NewObject(cx, &js_termsizeclass, NULL, NULL);
if(result_object==NULL)
{
<span style="color: #aaaaaa">@@ -770,20 +770,20 @@ size_t headlimit( void *ptr, size_t size, size_t nmemb, void *stream)
</span>
/* Function to make a url GET request and return the resulting page
*/
-static JSBool js_urlget(JSContext *cx, unsigned int argc, jsval *vp)
<span style="color: #000000;background-color: #ddffdd">+static JSBool js_urlget(JSContext *cx, unsigned int argc, jsval *vp)
</span> {
jsval *argv = JS_ARGV(cx, vp);
AUTOFREE_BUFFER url = NULL;
JSString *jsstr;
char msg[MAXTEXTLENGTH];
-
<span style="color: #000000;background-color: #ddffdd">+
</span> msg[MAXTEXTLENGTH-1]='\0';
if (argc < 1) {
JS_ReportError(cx, "Bad Call to js_urlget\n");
return JS_FALSE;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (JSVAL_IS_STRING(argv[0])) {
CURL *cl;
char cerr[CURL_ERROR_SIZE];
<span style="color: #aaaaaa">@@ -812,9 +812,9 @@ static JSBool js_urlget(JSContext *cx, unsigned int argc, jsval *vp)
</span> return JS_TRUE;
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> JS_ReportError(cx, "urlget requires a string.");
-
<span style="color: #000000;background-color: #ddffdd">+
</span> return JS_FALSE;
}
<span style="color: #aaaaaa">@@ -823,10 +823,10 @@ static JSObject *dbdata_to_jsarray(JSContext *cx, struct db_data *data, int ncol
</span> JSObject *jsdata;
JSString *jsstr;
jsval jv;
- int i;
<span style="color: #000000;background-color: #ddffdd">+ int i;
</span> // int conv_error;
// size_t data_length;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (data == NULL || ncols < 1) return NULL;
jsdata = JS_NewArrayObject(cx, 0, NULL);
<span style="color: #aaaaaa">@@ -885,21 +885,21 @@ static JSObject *dbresult_to_jsarray(JSContext *cx, struct db_result *data) {
</span> static JSObject *dbresult_to_jscolnames(JSContext *cx, struct db_result *data) {
JSObject *jsarray;
jsval jv;
- int i;
<span style="color: #000000;background-color: #ddffdd">+ int i;
</span> JSString *jsstr;
if (data == NULL) return NULL;
jsarray = JS_NewArrayObject(cx, 0, NULL);
JS_AddObjectRoot(cx, &jsarray);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> for(i=0;i<data->cols;i++) {
jsstr = JS_NewStringCopyZ(cx, data->colNames[i]);
jv = STRING_TO_JSVAL(jsstr);
JS_SetElement(cx, jsarray, i, &jv);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
-
<span style="color: #000000;background-color: #ddffdd">+
</span> JS_RemoveObjectRoot(cx, &jsarray);
return jsarray;
<span style="color: #aaaaaa">@@ -913,17 +913,17 @@ static JSBool dbresult_to_jsdbobject(JSContext *cx, struct js_db_result *data, j
</span> JSObject *result_object;
JSObject *jsarray, *jscolumns;
jsval jsarray_val, jscolumns_val;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> result_object=JS_NewObject(cx, &js_dbresultclass, NULL, NULL);
if(result_object==NULL) {
return JS_FALSE;
}
*db_object=OBJECT_TO_JSVAL(result_object);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> JS_DefineProperty(cx, result_object, "db_error", INT_TO_JSVAL(data->db_error), NULL, NULL, JSPROP_READONLY);
JS_DefineProperty(cx, result_object, "query_error", INT_TO_JSVAL(data->query_error), NULL, NULL, JSPROP_READONLY);
if(data->error_text!=NULL) {
-
<span style="color: #000000;background-color: #ddffdd">+
</span> JS_DefineProperty(cx, result_object, "error_text", STRING_TO_JSVAL(JS_NewStringCopyZ(cx, data->error_text)), NULL, NULL, JSPROP_READONLY);
} else {
JS_DefineProperty(cx, result_object, "error_text", STRING_TO_JSVAL(JS_NewStringCopyZ(cx, "No Error")), NULL, NULL, JSPROP_READONLY);
<span style="color: #aaaaaa">@@ -935,11 +935,11 @@ static JSBool dbresult_to_jsdbobject(JSContext *cx, struct js_db_result *data, j
</span> jscolumns=dbresult_to_jscolnames(cx, data->query_result);
jscolumns_val=OBJECT_TO_JSVAL(jscolumns);
JS_DefineProperty(cx, result_object, "column_names", jscolumns_val, NULL, NULL, 0);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> } else {
JS_DefineProperty(cx, result_object, "data", JSVAL_NULL, NULL, NULL, 0);
JS_DefineProperty(cx, result_object, "column_names", JSVAL_NULL, NULL, NULL, 0);
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> return JS_TRUE;
}
<span style="color: #aaaaaa">@@ -1080,7 +1080,7 @@ int js_exec(char *name, int argc, const char **argvc) {
</span> fprintf(stderr, "js_exec: argc %d was NULL!\n",i);
continue;
}
- argv[i] = STRING_TO_JSVAL(JS_NewStringCopyZ(jscx, argvc[i]));
<span style="color: #000000;background-color: #ddffdd">+ argv[i] = STRING_TO_JSVAL(JS_NewStringCopyZ(jscx, argvc[i]));
</span> }
js_interrupted=0;
js_start_timeout();
<span style="color: #aaaaaa">@@ -1099,20 +1099,20 @@ int js_exec(char *name, int argc, const char **argvc) {
</span>
/* Prints error reports to stdout when a javascript error occurs */
/* Taken from the spidermonkey tutorial at Kicken's World */
-static void
<span style="color: #000000;background-color: #ddffdd">+static void
</span> js_error_handler(JSContext __attribute__((unused)) *cx, const char *msg, JSErrorReport *er)
{
char *pointer=NULL;
char *line=NULL;
int len;
-
-
<span style="color: #000000;background-color: #ddffdd">+
+
</span> if (er->linebuf != NULL) {
len = er->tokenptr - er->linebuf + 1;
if(len<2) len=2;
pointer = malloc(len); memset(pointer,
- '-', len); pointer[len-1]='\0';
- pointer[len-2]='^';
<span style="color: #000000;background-color: #ddffdd">+ '-', len); pointer[len-1]='\0';
+ pointer[len-2]='^';
</span> len = strlen(er->linebuf)+1;
line = malloc(len);
strncpy(line, er->linebuf, len);
<span style="color: #aaaaaa">@@ -1129,9 +1129,9 @@ js_error_handler(JSContext __attribute__((unused)) *cx, const char *msg, JSError
</span> line[len-1]='\0';
len--;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> printf("JS Error: %s\nFile: %s:%u\n", msg, er->filename, er->lineno+1);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (line[0]) {
printf("%s\n%s\n", line, pointer);
}
<span style="color: #aaaaaa">@@ -1158,7 +1158,7 @@ int load_jsfile(FILE *f, const char *filename)
</span> printf("Failed to compile js script: %s\n", filename);
return 1;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* Execute the compiled script */
js_interrupted=0;
js_start_timeout();
<span style="color: #aaaaaa">@@ -1192,7 +1192,7 @@ int is_js(char *name)
</span>
static JSBool js_operation_callback(JSContext *cx) {
JSObject *global = JS_GetGlobalObject(cx);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (global) {
if (js_interrupted==1) {
JS_ReportError(cx,"Script execution interupted");
<span style="color: #aaaaaa">@@ -1229,7 +1229,7 @@ int stop_js(void)
</span> JS_DestroyContext(jscx);
JS_DestroyRuntime(jsrt);
return 0;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
// starts the javascript engine.
<span style="color: #aaaaaa">@@ -1268,7 +1268,7 @@ int setup_js(void)
</span>
/* initiate builtin classes */
JS_InitStandardClasses(jscx, jsroot);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* create a callback function that is run when javascript branches backwards */
/* allows us to interupt looping scripts */
#ifdef JS_OPERATION_WEIGHT_BASE
<span style="color: #aaaaaa">@@ -1309,7 +1309,7 @@ int setup_js(void)
</span>
// Broadcast constant (for ipc,rpc)
JS_DefineProperty(jscx, jsroot, "K_BROADCAST", INT_TO_JSVAL(K_BROADCAST), NULL, NULL, JSPROP_READONLY|JSPROP_PERMANENT);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* A stateful object backed with persistent db storage */
JS_DefineObject(jscx, jsroot, "Store", &js_storeclass, NULL, JSPROP_READONLY|JSPROP_PERMANENT);
<span style="color: #aaaaaa">@@ -1317,8 +1317,8 @@ int setup_js(void)
</span> if (is_local) {
JS_DefineFunction(jscx, jsroot, "dbquery", js_doquery, 2, 1);
}
-
- /* need additional functions :
<span style="color: #000000;background-color: #ddffdd">+
+ /* need additional functions :
</span> * - one to load another script (include?) - possibly although most scripts are loaded from the .mwrc or using .load
* - get system date/time - no, 'new Date()' will get this information for you in a Date object.
*/
</code></pre>
<br>
</li>
<li id='diff-13'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-13'>
<strong>
src/client/log.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/log.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/log.c
</span><span style="color: #aaaaaa">@@ -35,7 +35,7 @@ struct uripatt {
</span> struct uripatt urilist[] = {
{"^http://$", REG_ICASE, NULL, IGNORE, 0},
{"^https://$", REG_ICASE, NULL, IGNORE, 0},
- {"^sucs.org$", REG_ICASE, NULL, IGNORE, 0}, /* Ignore the SUCS homepage, "sucs.org" rarely refers to the website and we can presume people know it */
<span style="color: #000000;background-color: #ddffdd">+ {"^sucs.org$", REG_ICASE, NULL, IGNORE, 0}, /* Ignore the SUCS homepage, "sucs.org" rarely refers to the website and we can presume people know it */
</span> {"^http://", REG_ICASE, NULL, URL, 0},
{"^https://", REG_ICASE, NULL, URL, 0},
{"^www\\.", REG_ICASE, NULL, URL, 0},
<span style="color: #aaaaaa">@@ -117,7 +117,7 @@ void catchuri(const char *what)
</span> foundurl[nfoundurl++] = token;
}
}
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> if (u->type == FLAG) {
/* printf("Found flag: '%s' -> %x\n", token, u->flags); */
flags |= u->flags;
<span style="color: #aaaaaa">@@ -137,7 +137,7 @@ void catchuri(const char *what)
</span> }
/*
- * we found urls, so launch background threads to
<span style="color: #000000;background-color: #ddffdd">+ * we found urls, so launch background threads to
</span> * categorise and file the details
* cant do it in foreground, would stall the ui
*/
<span style="color: #aaaaaa">@@ -195,7 +195,7 @@ static char * cleanup_url(const char *in)
</span> if (strchr(p, '/')==NULL) {
strcat(out, "/");
}
- return out;
<span style="color: #000000;background-color: #ddffdd">+ return out;
</span> }
static char *md5(const char *in)
<span style="color: #aaaaaa">@@ -227,7 +227,7 @@ static char * extract_title(const char *body)
</span> }
-static void *file_url(void * data)
<span style="color: #000000;background-color: #ddffdd">+static void *file_url(void * data)
</span> {
struct urihit *uri = data;
char path[1024];
<span style="color: #aaaaaa">@@ -244,9 +244,9 @@ static void *file_url(void * data)
</span> c = curl_easy_init();
/* set max download sizes */
- block_limit(deli, 8192);
- block_limit(body, 8192);
- block_limit(head, 4096);
<span style="color: #000000;background-color: #ddffdd">+ block_limit(deli, 8192);
+ block_limit(body, 8192);
+ block_limit(head, 4096);
</span>
/* lets go fishing on del.icio.us */
url = cleanup_url(uri->url);
<span style="color: #aaaaaa">@@ -292,9 +292,9 @@ static void *file_url(void * data)
</span> block_free(head);
/* fishing mission complete, store the results */
-
<span style="color: #000000;background-color: #ddffdd">+
</span> uri_make_flags_str(uri->flags, flags, sizeof(flags));
-
<span style="color: #000000;background-color: #ddffdd">+
</span> char *query = sqlite3_mprintf("INSERT INTO mwuri (user, url, added, flags, title, tags) values (%Q,%Q,datetime('now'),%Q,%Q,%Q)", user->name, url, flags, title, deli==NULL?NULL:deli->p_buffer);
res = db_query(MWURI_DB, query, 1);
if (res == NULL) {
<span style="color: #aaaaaa">@@ -315,7 +315,7 @@ static void *file_url(void * data)
</span> return NULL;
}
-static void *file_tag(void * data)
<span style="color: #000000;background-color: #ddffdd">+static void *file_tag(void * data)
</span> {
struct taghit *tag = data;
struct db_result *res;
</code></pre>
<br>
</li>
<li id='diff-14'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-14'>
<strong>
src/client/log.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/log.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/log.h
</span><span style="color: #aaaaaa">@@ -11,7 +11,7 @@ struct block_t {
</span>
int i_used; /* current fill level */
char *p_cursor; /* user pointer */
-};
<span style="color: #000000;background-color: #ddffdd">+};
</span>
struct block_t * block_new(int);
void block_free(struct block_t *);
</code></pre>
<br>
</li>
<li id='diff-15'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-15'>
<strong>
src/client/main.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/main.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/main.c
</span><span style="color: #aaaaaa">@@ -138,7 +138,7 @@ static void set_prompt(void)
</span> {
char pre[20];
- if (UseRL)
<span style="color: #000000;background-color: #ddffdd">+ if (UseRL)
</span> sprintf(pre,"%s", "");
/*sprintf(pre,"%s",clear_line);*/
else strcpy(pre,"\r");
<span style="color: #aaaaaa">@@ -149,7 +149,7 @@ static void set_prompt(void)
</span> }
else
{
- if (cm_flags(user->chatmode,CM_ONCHAT,CM_MODE_ANY))
<span style="color: #000000;background-color: #ddffdd">+ if (cm_flags(user->chatmode,CM_ONCHAT,CM_MODE_ANY))
</span> snprintf(prompt,40, "%stalk{%d}-* ",pre,user->room);
else
if (u_god(user->status))
<span style="color: #aaaaaa">@@ -216,7 +216,7 @@ static void accept_line(char *line)
</span> }
} else
{
-
<span style="color: #000000;background-color: #ddffdd">+
</span> //strncpy(comm, line, MAXTEXTLENGTH-1);
//comm[MAXTEXTLENGTH-1] = '\0';
conversion_result=convert_string_charset(line, "LOCAL", strlen(line), comm, "UTF-8", MAXTEXTLENGTH-100, NULL, NULL, NULL, NULL, "?");
<span style="color: #aaaaaa">@@ -224,10 +224,10 @@ static void accept_line(char *line)
</span> {
if( conversion_result & WINVALIDCHARS )
{
- printf("Warning: Your input contained characters that are invalid in your current locale.\n Please ensure your terminal and locale are using the same character set\n");
<span style="color: #000000;background-color: #ddffdd">+ printf("Warning: Your input contained characters that are invalid in your current locale.\n Please ensure your terminal and locale are using the same character set\n");
</span> }
eof_count=0;
- strip_str(comm);
<span style="color: #000000;background-color: #ddffdd">+ strip_str(comm);
</span> if (new_mail_waiting==1)
{
display_message(_("\03305*** You have new mail.\n"), 1, 1);
<span style="color: #aaaaaa">@@ -567,13 +567,13 @@ int main(int argc, char **argv)
</span> exit(-1);
}
remote=true;
- show_new(user);
<span style="color: #000000;background-color: #ddffdd">+ show_new(user);
</span> update_user(user,tmp);
free(user);
free(fold);
exit(0);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* jump straight to add_mesg() */
if (foldername_num>-1 && god_mode())
{
<span style="color: #aaaaaa">@@ -658,9 +658,9 @@ int main(int argc, char **argv)
</span> else
{
mwlog("LOGIN from %s", inet_ntoa(((struct sockaddr_in *)&sa)->sin_addr) );
- }
- }
-
<span style="color: #000000;background-color: #ddffdd">+ }
+ }
+
</span> time_t when = user->lastlogout;
printf(_("\nLast logged out %s\n\n"),ctime(&when));
if (u_reg(user->status)) {
<span style="color: #aaaaaa">@@ -713,7 +713,7 @@ int main(int argc, char **argv)
</span> user->chatmode |= (oldchat & CM_PROTMASK);
user->idletime=time(0);
- update_user(user,userposn);
<span style="color: #000000;background-color: #ddffdd">+ update_user(user,userposn);
</span>
/* list new BBS items */
list_new_items(user,true);
<span style="color: #aaaaaa">@@ -727,10 +727,10 @@ int main(int argc, char **argv)
</span> set_rights();
init_colour();
-
<span style="color: #000000;background-color: #ddffdd">+
</span> RoomInit(&myroom);
-/* if (!(rights&65l)) a pleb - timeout of 10 mins
<span style="color: #000000;background-color: #ddffdd">+/* if (!(rights&65l)) a pleb - timeout of 10 mins
</span> user->timeout=600; */
update_user(user,userposn);
<span style="color: #aaaaaa">@@ -788,14 +788,14 @@ int main(int argc, char **argv)
</span> disable_rl(0);
}
}
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> }
void accept_command(char *cmd)
{
char history_comm[MAXTEXTLENGTH];
int conversion_result;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (UseRL)
{
conversion_result=convert_string_charset(cmd, "UTF-8", strlen(cmd), history_comm, "LOCAL", MAXTEXTLENGTH, NULL, NULL, NULL, NULL, NULL);
<span style="color: #aaaaaa">@@ -806,7 +806,7 @@ void accept_command(char *cmd)
</span> }
}
if (cm_flags(user->chatmode,CM_ONCHAT,CM_MODE_ANY))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> if (cmd[0]==*CMD_BOARD_STR)
{
set_rights();
<span style="color: #aaaaaa">@@ -1013,7 +1013,7 @@ int idle(int fd, int millis)
</span> fprintf(stderr, _("\nError on input terminal, argh.\n"));
return -1;
}
- if (FD_ISSET(incoming_pipe, &readfds))
<span style="color: #000000;background-color: #ddffdd">+ if (FD_ISSET(incoming_pipe, &readfds))
</span> handle_mesg();
}
in_idle--;
<span style="color: #aaaaaa">@@ -1050,7 +1050,7 @@ static void printline_in_local(char *line, int *warnings, size_t *not_in_local)
</span> char local_line[MAXTEXTLENGTH];
int conversion_result;
size_t irreversible=0, outbyte=0, inbyte=0;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> conversion_result=convert_string_charset(line, "UTF-8", strlen(line), local_line, "LOCAL//TRANSLIT", MAXTEXTLENGTH, &outbyte, &irreversible, &inbyte, NULL, "#");
if(conversion_result>=0)
{
<span style="color: #aaaaaa">@@ -1083,7 +1083,7 @@ void display_message(const char *text, int beeps, int newline)
</span> int len;
int ptr;
int concealed = 0;
- char line[MAXTEXTLENGTH];
<span style="color: #000000;background-color: #ddffdd">+ char line[MAXTEXTLENGTH];
</span> int i, j, colrstart;
int hascolour;
int screen_width = screen_w();
<span style="color: #aaaaaa">@@ -1146,7 +1146,7 @@ void display_message(const char *text, int beeps, int newline)
</span> ptr++;
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* escape sequence, skip next two chars */
if (s_colouroff(user->special))
{
<span style="color: #aaaaaa">@@ -1155,7 +1155,7 @@ void display_message(const char *text, int beeps, int newline)
</span> hascolour++;
str[2]=0;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> colr=colour(str, &concealed);
if (colr!=NULL)
<span style="color: #aaaaaa">@@ -1207,7 +1207,7 @@ void display_message(const char *text, int beeps, int newline)
</span> colrstart = -1;
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
else
{
<span style="color: #aaaaaa">@@ -1279,7 +1279,7 @@ void display_message(const char *text, int beeps, int newline)
</span> {
printf("Warning: %d characters in the last message could not be displayed in your current character set.\n You might want to consider using UTF-8.\n", (int)not_in_local);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /*if (UseRL && inreadline) rl_forced_update_display();*/
if (!u_beep(user->status) && beeps)
{
<span style="color: #aaaaaa">@@ -1323,7 +1323,7 @@ static void time_out(void *idle_count_p)
</span> char msg[128];
snprintf(msg, sizeof(msg), _("%c*** Wakey ! Wakey !\r\n"), 7);
idle_count++;
- update_user(user,userposn);
<span style="color: #000000;background-color: #ddffdd">+ update_user(user,userposn);
</span> write(1,msg,strlen(msg));
}
else
<span style="color: #aaaaaa">@@ -1331,7 +1331,7 @@ static void time_out(void *idle_count_p)
</span> mwlog("TIMEOUT(BLOCKED)");
close_down(1, NULL, NULL);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
void reset_timeout(int secs)
<span style="color: #aaaaaa">@@ -1345,7 +1345,7 @@ void reset_timeout(int secs)
</span> timeout_event_2 = alarm_after(secs+120, 0, &idle_count, &time_out);
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* start of Readline Commands */
char *dupstr(const char *text, const char *prepend)
<span style="color: #aaaaaa">@@ -1689,7 +1689,7 @@ char *list_commands(const char *text, int state)
</span> }
free(rtext);
return(NULL);
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
/* tab completion feature for talker commands */
char *list_chat_commands(const char *text, int state)
<span style="color: #aaaaaa">@@ -1718,7 +1718,7 @@ char *list_chat_commands(const char *text, int state)
</span> i++;
}
return(NULL);
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
char *find_folder(const char *text, int state)
{
<span style="color: #aaaaaa">@@ -1730,7 +1730,7 @@ char *find_folder(const char *text, int state)
</span>
if (state==0)
{
- if (nofolders()) return(NULL);
<span style="color: #000000;background-color: #ddffdd">+ if (nofolders()) return(NULL);
</span> if (file!=0) close(file);
if ((file=openfolderfile(O_RDONLY))<0) return NULL;
len=strlen(text);
<span style="color: #aaaaaa">@@ -1738,20 +1738,20 @@ char *find_folder(const char *text, int state)
</span>
while (get_folder_entry(file,fol))
{
- if (f_active(fol->status)
<span style="color: #000000;background-color: #ddffdd">+ if (f_active(fol->status)
</span> && (allowed_r(fol,user)
|| allowed_w(fol,user))) /*allowed*/
if (len==0 || !strncasecmp(text,fol->name,len))
return (dupstr(fol->name, ""));
}
- close(file);
<span style="color: #000000;background-color: #ddffdd">+ close(file);
</span> file=0;
return(NULL);
}
-char *part_user(const char *text, int status)
<span style="color: #000000;background-color: #ddffdd">+char *part_user(const char *text, int status)
</span> {
static int file=0;
static int len=0;
<span style="color: #aaaaaa">@@ -1759,7 +1759,7 @@ char *part_user(const char *text, int status)
</span>
if (status==0)
{
- if (file!=0) close(file);
<span style="color: #000000;background-color: #ddffdd">+ if (file!=0) close(file);
</span> file=userdb_open(O_RDONLY);
len=strlen(text);
}
</code></pre>
<br>
</li>
<li id='diff-16'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-16'>
<strong>
src/client/mesg.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/mesg.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/mesg.c
</span><span style="color: #aaaaaa">@@ -22,7 +22,7 @@ void send_mesg(char *from, const char *to, char *text, int wiz)
</span> {
char buff[MAXTEXTLENGTH];
struct person * usr;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> usr = user_get(to);
if (! usr) {
printf(_("User does not exist.\n"));
<span style="color: #aaaaaa">@@ -43,7 +43,7 @@ void send_mesg(char *from, const char *to, char *text, int wiz)
</span> }
}
free(usr);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> snprintf(buff, MAXTEXTLENGTH, "*** %s: %s", from, text);
if (ipc_send_to_username(to, IPC_WIZ, buff) <= 0) {
printf(_("User not logged on.\n"));
<span style="color: #aaaaaa">@@ -70,7 +70,7 @@ void postinfo(struct person *who, struct folder *fol, struct Header *mesg)
</span> ipc_send_to_all(IPC_TEXT, buff);
}
-/* broadcast state
<span style="color: #000000;background-color: #ddffdd">+/* broadcast state
</span> 0= everyone no choice
1= login information
2= wiz chat people only
<span style="color: #aaaaaa">@@ -79,7 +79,7 @@ void postinfo(struct person *who, struct folder *fol, struct Header *mesg)
</span> 0x100= raw text, eg !su, .mrod
*/
-void broadcast(int state, const char *fmt, ...)
<span style="color: #000000;background-color: #ddffdd">+void broadcast(int state, const char *fmt, ...)
</span> {
char buff[MAXTEXTLENGTH];
char text[MAXTEXTLENGTH];
<span style="color: #aaaaaa">@@ -145,7 +145,7 @@ void mwlog(const char *fmt, ...)
</span> time_t t;
va_start(ap, fmt);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if ((file=open(LOGFILE,O_WRONLY|O_CREAT|O_APPEND,0600))<0)
{
perror("log");
</code></pre>
<br>
</li>
<li id='diff-17'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-17'>
<strong>
src/client/mod.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/mod.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/mod.c
</span><span style="color: #aaaaaa">@@ -21,7 +21,7 @@ static void add_message(struct folder *fold, struct Header *head, char *text)
</span> {
char fullpath[PATHSIZE];
int modindex,modtext;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* files for general public to read */
sprintf(fullpath,"%s/%s%s",STATEDIR,fold->name,INDEX_END);
if ((modindex=open(fullpath,O_WRONLY|O_APPEND|O_CREAT,0600))<0)
<span style="color: #aaaaaa">@@ -35,7 +35,7 @@ static void add_message(struct folder *fold, struct Header *head, char *text)
</span> head->datafield=lseek(modtext,0,2);
if (write(modindex,head,sizeof(*head))<0) {perror("mod: writehead");}
if (write(modtext,text,head->size)<0) {perror("mod: write text");}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> Unlock_File(modtext);
Unlock_File(modindex);
close(modtext);
<span style="color: #aaaaaa">@@ -46,7 +46,7 @@ static void put_back(struct folder *fold, struct Header *head, char *text)
</span> {
char fullpath[PATHSIZE];
int newindex,newtext;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* files to put messages to be approved later */
sprintf(fullpath,"%s/%s%s%s",STATEDIR,fold->name,INDEX_END,MOD_END);
if ((newindex=open(fullpath,O_WRONLY|O_APPEND|O_CREAT,0600))<0)
<span style="color: #aaaaaa">@@ -72,12 +72,12 @@ static void store(struct folder *fold, struct Header *head, char *text)
</span> char buff[128];
char fullpath[PATHSIZE];
time_t head_date;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> sprintf(fullpath,"%s/%s",STATEDIR,"mod.save");
head_date = (time_t)head->date;
if ((afile=open(fullpath,O_WRONLY|O_APPEND|O_CREAT,0600))<0)
{perror(fullpath);exit(-1);}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> Lock_File(afile);
sprintf(buff,_("\nMessage in folder %s\nFrom: %s\nTo: %s\nSubject: %s\nDate: %s"),
fold->name, head->from, head->to, head->subject, ctime(&head_date));
<span style="color: #aaaaaa">@@ -94,11 +94,11 @@ void moderate(void)
</span> struct Header head;
char *text;
char answer[11];
-
<span style="color: #000000;background-color: #ddffdd">+
</span> int f_file;
int tmpindex,tmptext;
-
- if ((f_file=open(FOLDERFILE,O_RDWR))<0)
<span style="color: #000000;background-color: #ddffdd">+
+ if ((f_file=open(FOLDERFILE,O_RDWR))<0)
</span> {perror(FOLDERFILE);exit(-1);}
while (get_folder_entry(f_file,&fold))
{
<span style="color: #aaaaaa">@@ -112,10 +112,10 @@ void moderate(void)
</span> sprintf(oldpath,"%s/%s%s%s",STATEDIR,fold.name,TEXT_END,MOD_END);
sprintf(fullpath,"%s/%s%s%s",STATEDIR,fold.name,TEXT_END,".tmp");
rename(oldpath,fullpath);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* files containing messages to be approved */
sprintf(fullpath,"%s/%s%s%s",STATEDIR,fold.name,INDEX_END,".tmp");
- if ((tmpindex=open(fullpath,O_RDONLY))<0)
<span style="color: #000000;background-color: #ddffdd">+ if ((tmpindex=open(fullpath,O_RDONLY))<0)
</span> {perror(fullpath);exit(-1);}
sprintf(fullpath,"%s/%s%s%s",STATEDIR,fold.name,TEXT_END,".tmp");
if ((tmptext=open(fullpath,O_RDONLY))<0)
</code></pre>
<br>
</li>
<li id='diff-18'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-18'>
<strong>
src/client/new.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/new.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/new.c
</span><span style="color: #aaaaaa">@@ -35,16 +35,16 @@ void list_new_items(struct person *user, int flag)
</span> struct folder folstuff;
struct folder *fol=&folstuff;
int screen_height=screen_h();
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (nofolders())
- {printf(_("There are no folders to read !\n")); return;}
<span style="color: #000000;background-color: #ddffdd">+ {printf(_("There are no folders to read !\n")); return;}
</span> file=openfolderfile(O_RDONLY);
while (get_folder_entry(file,fol))
{
- if (f_active(fol->status)
<span style="color: #000000;background-color: #ddffdd">+ if (f_active(fol->status)
</span> && (allowed_r(fol,user)
|| allowed_w(fol,user))) /*allowed*/
- if (!flag || (flag && (fol->last-user->lastread[count])>0
<span style="color: #000000;background-color: #ddffdd">+ if (!flag || (flag && (fol->last-user->lastread[count])>0
</span> && allowed_r(fol,user)
&& get_subscribe(user,count))) /* subscribed */
{
<span style="color: #aaaaaa">@@ -87,16 +87,16 @@ static int read_new(struct person *user, struct folder *data, int folnum)
</span> struct Header head;
char tmp[80];
- if (access(buildpath(STATEDIR,data->name,INDEX_END,""),0))
<span style="color: #000000;background-color: #ddffdd">+ if (access(buildpath(STATEDIR,data->name,INDEX_END,""),0))
</span> {printf(_("Error: cannot find index file for folder %s\n"),data->name);return(-1);}
- if (access(buildpath(STATEDIR,data->name,TEXT_END,""),0))
<span style="color: #000000;background-color: #ddffdd">+ if (access(buildpath(STATEDIR,data->name,TEXT_END,""),0))
</span> {printf(_("Error: cannot find text file for folder %s\n"),data->name); return(-1);}
if ((indexfile=err_open(buildpath(STATEDIR,data->name,INDEX_END,""),O_RDONLY,0))<0)
{exit(-1);}
if ((datafile=err_open(buildpath(STATEDIR,data->name,TEXT_END,""),O_RDONLY,0))<0)
{exit(-1);}
- /* try jumping to expected location */
<span style="color: #000000;background-color: #ddffdd">+ /* try jumping to expected location */
</span> posn=(user->lastread[folnum]-data->first+1)*sizeof(struct Header);
lseek(indexfile,posn,0);
/* read the article, if failed, or overshot then rewind to start */
<span style="color: #aaaaaa">@@ -158,7 +158,7 @@ static int read_new(struct person *user, struct folder *data, int folnum)
</span> printf(_("Unsubscribing from %s.\n"),data->name);
break;
}else
- if (strlen(tmp))
<span style="color: #000000;background-color: #ddffdd">+ if (strlen(tmp))
</span> {
extern int last_mesg,currentfolder;
close(datafile);
<span style="color: #aaaaaa">@@ -177,11 +177,11 @@ static int read_new(struct person *user, struct folder *data, int folnum)
</span> }
void show_new(struct person *user)
-{
- struct folder *data;
<span style="color: #000000;background-color: #ddffdd">+{
+ struct folder *data;
</span> int folderfile;
int folnum=0;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> data=(struct folder *)malloc(sizeof(*data));
if (nofolders())
<span style="color: #aaaaaa">@@ -189,15 +189,15 @@ void show_new(struct person *user)
</span> printf(_("There are no folders to read !\n"));
free(data);
return;
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> folderfile=openfolderfile(O_RDONLY);
while (get_folder_entry(folderfile,data))
{
if (data->status&1 /*active*/
- && allowed_r(data,user) /* allowed to read */
<span style="color: #000000;background-color: #ddffdd">+ && allowed_r(data,user) /* allowed to read */
</span> && get_subscribe(user,folnum) /* currently subscribed */
&& !(data->last<data->first || data->last==0)
- && !(data->last<=user->lastread[folnum]))
<span style="color: #000000;background-color: #ddffdd">+ && !(data->last<=user->lastread[folnum]))
</span> {
if (!remote)
{
<span style="color: #aaaaaa">@@ -217,7 +217,7 @@ void latest(struct person *user)
</span> int ffile,ifile;
struct folder fold;
char datestr[30],sub[40];
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (nofolders())
{
printf(_("There are no folders to read !\n"));
</code></pre>
<br>
</li>
<li id='diff-19'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-19'>
<strong>
src/client/newmain.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/newmain.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/newmain.c
</span><span style="color: #aaaaaa">@@ -47,7 +47,7 @@ extern unsigned long rights;
</span> extern struct person *user;
extern struct folder *fold;
extern long userposn;
-extern unsigned long loggedin;
<span style="color: #000000;background-color: #ddffdd">+extern unsigned long loggedin;
</span> extern CommandList table[];
extern void help_list(CommandList *cm, unsigned int hidestuff);
<span style="color: #aaaaaa">@@ -280,7 +280,7 @@ void c_colouroff(CommandList *cm, int argc, const char **argv, char *args)
</span> if (get_colour()==NULL)
printf(_("No colour scheme loaded.\n"));
printf(_("Current colour scheme: %d: %s\n"),user->colour,get_colour());
-
<span style="color: #000000;background-color: #ddffdd">+
</span> return;
}
<span style="color: #aaaaaa">@@ -337,7 +337,7 @@ void c_colouroff(CommandList *cm, int argc, const char **argv, char *args)
</span> i=atoi(argv[1]);
snprintf(path, 1023, COLOURDIR"/%d.col", i);
if (access(path, R_OK))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> printf(_("ERROR: Cannot open colour scheme '%d'\n"),i);
return;
}
<span style="color: #aaaaaa">@@ -444,7 +444,7 @@ void c_autosub(CommandList *cm, int argc, const char **argv, char *args)
</span> void c_su(CommandList *cm, int argc, const char **argv, char *args)
{
int z=BoolOpt(argv[1]);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (z==1)
{
if (!u_god(user->status))
<span style="color: #aaaaaa">@@ -674,7 +674,7 @@ void c_tidyup(CommandList *cm, int argc, const char **argv, char *args)
</span>
char fullpath[PATHSIZE];
char fullpath2[PATHSIZE];
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (argc!=3)
{
printf("Usage: tidyup <foldername> <mesg no>\n");
<span style="color: #aaaaaa">@@ -687,7 +687,7 @@ void c_tidyup(CommandList *cm, int argc, const char **argv, char *args)
</span> perror("folders");
exit(-1);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> do {
i=read(ffile,&info,sizeof(info));
}while (i==sizeof(info) && !stringcmp(info.name,argv[1],-1));
<span style="color: #aaaaaa">@@ -852,7 +852,7 @@ void c_mod(CommandList *cm, int argc, const char **argv, char *args)
</span> void c_passwd(CommandList *cm, int argc, const char **argv, char *args)
{
char pw1[PASSWDSIZE], pw2[PASSWDSIZE], salt[3];
-
<span style="color: #000000;background-color: #ddffdd">+
</span> salt[2]=0;
strncpy(salt,user->passwd,2);
if (strcmp(user->passwd,crypt(get_pass(_("Enter old password: ")),salt)))
<span style="color: #aaaaaa">@@ -963,10 +963,10 @@ void c_status(CommandList *cm, int argc, const char **argv, char *args)
</span> printf(_("You are currently in folder %s, which you "),fold->name);
printf(get_subscribe(user,currentfolder)?_("are"):_("are not"));
printf(_(" subscribed to.\n"));
- if (user->timeout==0)
<span style="color: #000000;background-color: #ddffdd">+ if (user->timeout==0)
</span> printf(_("You will not be timed out for being idle.\n"));
- else
- printf(_("You will be timed out after being idle for %s.\n"),itime(user->timeout));
<span style="color: #000000;background-color: #ddffdd">+ else
+ printf(_("You will be timed out after being idle for %s.\n"),itime(user->timeout));
</span> time_on(user->timeused+(time(0) - loggedin));
}
<span style="color: #aaaaaa">@@ -1052,7 +1052,7 @@ void c_catchup(CommandList *cm, int argc, const char **argv, char *args)
</span> if(!f_active(fold->status) || (!allowed_r(fold,user) && !allowed_w(fold,user)))
{
printf(_("There is no folder %s\n"), argv[1]);
- get_folder_number(fold,currentfolder);
<span style="color: #000000;background-color: #ddffdd">+ get_folder_number(fold,currentfolder);
</span> return;
}
}else
<span style="color: #aaaaaa">@@ -1063,7 +1063,7 @@ void c_catchup(CommandList *cm, int argc, const char **argv, char *args)
</span> user->lastread[i]=fold->last;
update_user(user,userposn);
printf(_("Marking folder %s as read.\n"),fold->name);
- get_folder_number(fold,currentfolder);
<span style="color: #000000;background-color: #ddffdd">+ get_folder_number(fold,currentfolder);
</span> }
void c_date(CommandList *cm, int argc, const char **argv, char *args)
<span style="color: #aaaaaa">@@ -1083,10 +1083,10 @@ void c_save(CommandList *cm, int argc, const char **argv, char *args)
</span> int msg=atoi(argv[1]);
char buff[128],file[128];
FILE *f;
-
- int i,len,x;
- len=strlen(argv[2]);
<span style="color: #000000;background-color: #ddffdd">+ int i,len,x;
+
+ len=strlen(argv[2]);
</span> for(i=0;i<len;i++)
{
if (argv[2][i]=='/') file[i]='_';
<span style="color: #aaaaaa">@@ -1127,7 +1127,7 @@ void c_save(CommandList *cm, int argc, const char **argv, char *args)
</span> if (x==-1)
perror("wait");
}
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
void c_timeout(CommandList *cm, int argc, const char **argv, char *args)
{
</code></pre>
<br>
</li>
<li id='diff-20'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-20'>
<strong>
src/client/read.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/read.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/read.c
</span><span style="color: #aaaaaa">@@ -36,14 +36,14 @@ int get_data(int afile, struct Header *tmp)
</span> }
return(true);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> void display_article(struct Header *tmp, int datafile)
{
int i,length;
char *buff,*ptr;
char title[80];
time_t when;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> buff=(char *)malloc(tmp->size);
if (!remote)
<span style="color: #aaaaaa">@@ -61,9 +61,9 @@ void display_article(struct Header *tmp, int datafile)
</span> printf("Message: %d\nFrom: %s\nDate: %ld\n",tmp->Ref,tmp->from,(long)tmp->date);
show_mesg_stats(tmp->status,title,false);
printf("Flags: %s\n",title);
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> fprintf(output,"To: %s\nSubject: %s\n",tmp->to,tmp->subject);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (tmp->replyto>0)
fprintf(output,"In reply to message %d.\n",tmp->replyto);
if (tmp->status&(1<<2))
<span style="color: #aaaaaa">@@ -91,7 +91,7 @@ void display_article(struct Header *tmp, int datafile)
</span> putchar(*p);
if (*p=='\n' && p[1]=='.') putchar('.');
p++;
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> printf("\n.\n");
}
free(buff);
<span style="color: #aaaaaa">@@ -104,7 +104,7 @@ int read_msg(int folnum, int msgnum, struct person *user)
</span> struct Header head;
int posn;
long tmppos;
- char *x;
<span style="color: #000000;background-color: #ddffdd">+ char *x;
</span>
if (nofolders())
{printf("There are no folders to read.\n");return(false);}
<span style="color: #aaaaaa">@@ -114,7 +114,7 @@ int read_msg(int folnum, int msgnum, struct person *user)
</span> for (i=0;i<=folnum;i++) get_folder_entry(file,&data);
close(file);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (!(data.status&1))
{printf("That folder does not exist.\n");return(false);}
if (msgnum>data.last || msgnum<data.first)
<span style="color: #aaaaaa">@@ -123,9 +123,9 @@ int read_msg(int folnum, int msgnum, struct person *user)
</span> {printf("Folder %s is empty.\n",data.name);return(false);}
if ( !u_god(user->status) && !allowed_r(&data,user))
{printf("You are not permitted to read this folder.\n");return(false);}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> x=buildpath(STATEDIR,data.name,INDEX_END,"");
- if (access(x,0))
<span style="color: #000000;background-color: #ddffdd">+ if (access(x,0))
</span> {
printf("Error: cannot find index file for folder %s\n",data.name);
return(false);
<span style="color: #aaaaaa">@@ -134,7 +134,7 @@ int read_msg(int folnum, int msgnum, struct person *user)
</span> {exit(-1);}
x=buildpath(STATEDIR,data.name,TEXT_END,"");
- if (access(x,0))
<span style="color: #000000;background-color: #ddffdd">+ if (access(x,0))
</span> {
printf("Error: cannot find text file for folder %s\n",data.name);
close(headfile);
<span style="color: #aaaaaa">@@ -158,7 +158,7 @@ int read_msg(int folnum, int msgnum, struct person *user)
</span> {
printf("Message has been marked for deletion.\n");
}else
- if (is_private(&data,user) &&
<span style="color: #000000;background-color: #ddffdd">+ if (is_private(&data,user) &&
</span> (!stringcmp(head.to,user->name,-1)&&!stringcmp(head.from,user->name,-1)))
{
printf("This message is not addressed to you !\n");
<span style="color: #aaaaaa">@@ -179,7 +179,7 @@ void ls(int folnum, struct person *user, int many)
</span> int afile;
struct folder fold;
struct Header head;
- char buff[SUBJECTSIZE+1];
<span style="color: #000000;background-color: #ddffdd">+ char buff[SUBJECTSIZE+1];
</span> int linecount=0;
int listpoint;
int screen_height = screen_h();
<span style="color: #aaaaaa">@@ -220,7 +220,7 @@ void ls(int folnum, struct person *user, int many)
</span> ||stringcmp(head.to,user->name,-1))))) /*marked for deletion*/
{
strncpy(buff,head.to,NAMESIZE);
- buff[NAMESIZE]=0;
<span style="color: #000000;background-color: #ddffdd">+ buff[NAMESIZE]=0;
</span> printf("%4d %*s -> %*s ",
head.Ref,NAMESIZE,head.from,NAMESIZE,buff);
if (strlen(head.subject)>40)
<span style="color: #aaaaaa">@@ -243,10 +243,10 @@ void ls(int folnum, struct person *user, int many)
</span> printf(" \r");
linecount=0;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
}
- close(afile);
<span style="color: #000000;background-color: #ddffdd">+ close(afile);
</span> }
void more(char *buff, int size)
<span style="color: #aaaaaa">@@ -255,7 +255,7 @@ void more(char *buff, int size)
</span> int len=0,found=5;
char tmp[2];
int scr_h = screen_h();
-
<span style="color: #000000;background-color: #ddffdd">+
</span> ptr=buff;
while ((ptr+len)<(buff+size))
{
<span style="color: #aaaaaa">@@ -289,7 +289,7 @@ int get_mesg_header(struct folder *data, int msgnum, struct Header *head)
</span> int headfile;
int posn;
long tmppos;
- char *x;
<span style="color: #000000;background-color: #ddffdd">+ char *x;
</span>
/* folder data doesnt exist */
if (!data) return(false);
</code></pre>
<br>
</li>
<li id='diff-21'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-21'>
<strong>
src/client/script.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/script.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/script.c
</span><span style="color: #aaaaaa">@@ -84,7 +84,7 @@ char ** makeargs(int argc, const char **argv, int offset)
</span> new[i]=strdup(argv[offset+i]);
}
new[num]=NULL;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> return (new);
}
<span style="color: #aaaaaa">@@ -99,7 +99,7 @@ static int endchar(const char *haystack, char needle)
</span> {
int len;
len=strlen(haystack);
- if (haystack[len-1] == needle) return (1);
<span style="color: #000000;background-color: #ddffdd">+ if (haystack[len-1] == needle) return (1);
</span> else return(0);
}
<span style="color: #aaaaaa">@@ -387,7 +387,7 @@ void DestroyFunction(const char *funcname)
</span>
func=function_list;
funcold=NULL;
- while (func!=NULL && strcasecmp(funcname, func->name))
<span style="color: #000000;background-color: #ddffdd">+ while (func!=NULL && strcasecmp(funcname, func->name))
</span> {
funcold=func;
func=func->next;
<span style="color: #aaaaaa">@@ -396,12 +396,12 @@ void DestroyFunction(const char *funcname)
</span> printf("Cant find function %s to destroy.\n", funcname);
return;
}
- if (funcold==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if (funcold==NULL)
</span> function_list=func->next;
else
funcold->next=func->next;
free(func->name);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> label=func->jump;
while (label!=NULL) {
struct label *oldlabel;
<span style="color: #aaaaaa">@@ -411,13 +411,13 @@ void DestroyFunction(const char *funcname)
</span> free (label);
label=oldlabel;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> fcode=func->code;
while (fcode!=NULL) {
int i;
struct code *oldcode;
free(fcode->debug);
- for (i=0;i<fcode->argc;i++)
<span style="color: #000000;background-color: #ddffdd">+ for (i=0;i<fcode->argc;i++)
</span> free(fcode->argv[i]);
free(fcode->argv);
oldcode=fcode->next;
<span style="color: #aaaaaa">@@ -458,7 +458,7 @@ void DestroyAllFunctions(int debug)
</span> int i;
struct code *oldcode;
free(fcode->debug);
- for (i=0;i<fcode->argc;i++)
<span style="color: #000000;background-color: #ddffdd">+ for (i=0;i<fcode->argc;i++)
</span> free(fcode->argv[i]);
free(fcode->argv);
oldcode=fcode->next;
<span style="color: #aaaaaa">@@ -488,7 +488,7 @@ void scr_helpfile(const char *args)
</span> printf("Sorry, no help available on that subject. *:-)\n");
return;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (args==NULL)
{
x=makepath(SCRIPTHELP,"/","general");
<span style="color: #aaaaaa">@@ -588,7 +588,7 @@ void ListVars(const char *srch)
</span> }
VAR_LIST_NEXT(&op);
}
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
/***************
** Runtime...
<span style="color: #aaaaaa">@@ -865,14 +865,14 @@ int ExecEvent(char *script, const char *text, const char *event, char *who, int
</span> if (event_body_text!=NULL) free(event_body_text);
event_body_text = strdup(text+pre);
/*ARG_STR_FORCE(&args, 3, strdup(event_body_text)); */
-
<span style="color: #000000;background-color: #ddffdd">+
</span> busy++;
retval = ExecScript(script, &args, 0);
VAR_FREELIST(&args);
busy--;
return(retval);
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
int ExecEvent2(char *script, const char *event, char *who, int pre, int numargs, char *aargs[])
<span style="color: #aaaaaa">@@ -931,7 +931,7 @@ int ExecEvent2(char *script, const char *event, char *who, int pre, int numargs,
</span> busy--;
return(retval);
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
void ListScript(const char *name)
{
<span style="color: #aaaaaa">@@ -970,7 +970,7 @@ char *eval_arg(char *arg, int argc, char **argv)
</span> return strdup("{error}");
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> char ** argv_shift(int argc, char **argv, int offset, int *newsize)
{
char **new;
<span style="color: #aaaaaa">@@ -1057,7 +1057,7 @@ void ScriptCleanup(void)
</span> if (homedir) free (homedir);
}
-void scr_devel_msg(struct code *pc, const char *fmt, ...)
<span style="color: #000000;background-color: #ddffdd">+void scr_devel_msg(struct code *pc, const char *fmt, ...)
</span> {
va_list va;
char text[MAXTEXTLENGTH];
<span style="color: #aaaaaa">@@ -1072,7 +1072,7 @@ void scr_devel_msg(struct code *pc, const char *fmt, ...)
</span> /* script function autocompletion for readline */
char *list_script(const char *text, int state)
{
- static int len;
<span style="color: #000000;background-color: #ddffdd">+ static int len;
</span> static struct function *fn = NULL;
char *name;
int hidden;
</code></pre>
<br>
</li>
<li id='diff-22'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-22'>
<strong>
src/client/script.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/script.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/script.h
</span><span style="color: #aaaaaa">@@ -94,7 +94,7 @@ do { \
</span>
#define ARG_RANGE(list1, min, max) VAR_INT_FORCE(list1, "#", (max)+1); \
-#define ARG_COUNT(list1)
<span style="color: #000000;background-color: #ddffdd">+#define ARG_COUNT(list1)
</span>
#define VAR_STR_FORCE(list1, name1, val1) \
do { \
<span style="color: #aaaaaa">@@ -202,7 +202,7 @@ struct code {
</span> struct label {
char *name;
struct code *where;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> char *debug;
struct label *next;
};
</code></pre>
<br>
</li>
<li id='diff-23'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-23'>
<strong>
src/client/script_inst.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/script_inst.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/script_inst.c
</span><span style="color: #aaaaaa">@@ -164,7 +164,7 @@ void scr_time( struct code *pc, int fargc, char **fargv )
</span> {
AUTOFREE_BUFFER uname = eval_arg(pc->argv[1], fargc, fargv);
- if (script_debug) escprintf("- %s: Getting idletime of user '%s'.\n", pc->inst->name, uname);
<span style="color: #000000;background-color: #ddffdd">+ if (script_debug) escprintf("- %s: Getting idletime of user '%s'.\n", pc->inst->name, uname);
</span>
json_t * wlist = grab_wholist();
if (wlist == NULL)
<span style="color: #aaaaaa">@@ -220,14 +220,14 @@ void scr_say( struct code *pc, int fargc, char **fargv )
</span> AUTOFREE_BUFFER p = NULL;
char utf8buff[MAXTEXTLENGTH];
int conversion_result;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (pc->argc==0) return;
if (!cm_flags(user->chatmode, CM_ONCHAT, CM_MODE_ANY)) return;
size=0;
for (i=0; i<pc->argc; i++)
size+=strlen(pc->argv[i])+1;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* overly generous allocation as later code isnt clean. */
size+=512;
tmp=(char *)malloc(size);
<span style="color: #aaaaaa">@@ -261,12 +261,12 @@ void scr_say( struct code *pc, int fargc, char **fargv )
</span> {
printf("Error: Your script produced invalid utf-8 which has not been sent.\n");
return;
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> if(conversion_result & WOUTPUTTOOSHORT)
{
printf("Warning: Your script produced too much text which has been truncated.\n");
- }
-
<span style="color: #000000;background-color: #ddffdd">+ }
+
</span>
if (!strcasecmp(pc->inst->name, "say"))
<span style="color: #aaaaaa">@@ -313,7 +313,7 @@ void scr_output( struct code *pc, int fargc, char **fargv )
</span> return;
}
what=eval_arg(pc->argv[0], fargc, fargv);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if ((i=BoolOpt(what))==-1)
{
if (script_debug) printf("- OUTPUT: Error, invalid argument\n");
<span style="color: #aaaaaa">@@ -325,7 +325,7 @@ void scr_wholist( struct code *pc, int fargc, char **fargv )
</span> {
AUTOFREE_BUFFER what = NULL;
AUTOFREE_BUFFER buff = NULL;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (pc->argc < 1) {
if (script_debug) printf("Error in %s at %s too few arguments.\n", pc->inst->name, pc->debug);
return;
<span style="color: #aaaaaa">@@ -349,7 +349,7 @@ void scr_wholist( struct code *pc, int fargc, char **fargv )
</span> }
}
json_decref(wlist);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> {
char *p;
if ((p=strrchr(buff,' '))!=NULL) *p=0;
<span style="color: #aaaaaa">@@ -367,9 +367,9 @@ void scr_roomnum( struct code *pc, int fargc, char **fargv )
</span> rn[0] = '-';
rn[1] = '1';
rn[2] = 0;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (pc->argc < pc->inst->args) {
- if (script_debug) printf("Error in %s at %s too few arguments.\n", pc->inst->name, pc->debug);
<span style="color: #000000;background-color: #ddffdd">+ if (script_debug) printf("Error in %s at %s too few arguments.\n", pc->inst->name, pc->debug);
</span> return;
}
what=eval_arg(pc->argv[0], fargc, fargv);
<span style="color: #aaaaaa">@@ -407,7 +407,7 @@ void scr_roomnum( struct code *pc, int fargc, char **fargv )
</span>
uname=eval_arg(pc->argv[1], fargc, fargv);
- if (script_debug) escprintf("- %s: Getting room of user '%s'.\n", pc->inst->name, uname);
<span style="color: #000000;background-color: #ddffdd">+ if (script_debug) escprintf("- %s: Getting room of user '%s'.\n", pc->inst->name, uname);
</span>
json_t * wlist = grab_wholist();
if (wlist == NULL) return;
<span style="color: #aaaaaa">@@ -472,7 +472,7 @@ void scr_quit( struct code *pc, int fargc, char **fargv )
</span> close_down(0, NULL, NULL);
}
-void scr_exec( struct code *pc, int fargc, char **fargv )
<span style="color: #000000;background-color: #ddffdd">+void scr_exec( struct code *pc, int fargc, char **fargv )
</span> {
char *p;
<span style="color: #aaaaaa">@@ -607,7 +607,7 @@ int isanumul(const char *a, unsigned long *result, int onlydecimal)
</span> }
}
-void scr_compare( struct code *pc, int fargc, char **fargv )
<span style="color: #000000;background-color: #ddffdd">+void scr_compare( struct code *pc, int fargc, char **fargv )
</span> {
AUTOFREE_BUFFER a = NULL;
AUTOFREE_BUFFER b = NULL;
<span style="color: #aaaaaa">@@ -621,7 +621,7 @@ void scr_compare( struct code *pc, int fargc, char **fargv )
</span>
compare_count++;
- a=eval_arg(pc->argv[0], fargc, fargv);
<span style="color: #000000;background-color: #ddffdd">+ a=eval_arg(pc->argv[0], fargc, fargv);
</span> b=eval_arg(pc->argv[1], fargc, fargv);
if (isanum(a, &aa, 0) && isanum(b, &bb, 0)) {
<span style="color: #aaaaaa">@@ -635,7 +635,7 @@ void scr_compare( struct code *pc, int fargc, char **fargv )
</span> }
if (!strcasecmp(pc->inst->name, "eq"))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> if (numeric) {
if (aa==bb) compare_match++;
} else {
<span style="color: #aaaaaa">@@ -643,7 +643,7 @@ void scr_compare( struct code *pc, int fargc, char **fargv )
</span> }
}else
if (!strcasecmp(pc->inst->name, "ne"))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> if (numeric) {
if (aa!=bb) compare_match++;
} else {
<span style="color: #aaaaaa">@@ -651,7 +651,7 @@ void scr_compare( struct code *pc, int fargc, char **fargv )
</span> }
}else
if (!strcasecmp(pc->inst->name, "lt"))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> if (numeric) {
if (aa<bb) compare_match++;
} else {
<span style="color: #aaaaaa">@@ -659,7 +659,7 @@ void scr_compare( struct code *pc, int fargc, char **fargv )
</span> }
}else
if (!strcasecmp(pc->inst->name, "gt"))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> if (numeric) {
if (aa>bb) compare_match++;
} else {
<span style="color: #aaaaaa">@@ -667,7 +667,7 @@ void scr_compare( struct code *pc, int fargc, char **fargv )
</span> }
}else
if (!strcasecmp(pc->inst->name, "le"))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> if (numeric) {
if (aa<=bb) compare_match++;
} else {
<span style="color: #aaaaaa">@@ -675,7 +675,7 @@ void scr_compare( struct code *pc, int fargc, char **fargv )
</span> }
}else
if (!strcasecmp(pc->inst->name, "ge"))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> if (numeric) {
if (aa>=bb) compare_match++;
} else {
<span style="color: #aaaaaa">@@ -721,7 +721,7 @@ void scr_math( struct code *pc, int fargc, char **fargv )
</span> }
if (script_debug) escprintf("- math operation on $%s (%d) and %d\n", aa, a, b);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (!strcasecmp(pc->inst->name, "add"))
result = a+b;
else
<span style="color: #aaaaaa">@@ -791,7 +791,7 @@ void scr_math2( struct code *pc, int fargc, char **fargv )
</span> }
if (script_debug) printf("- math operation on %d\n", a);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (!strcasecmp(pc->inst->name, "abs"))
{
if (a>0) result = a; else result = -a;
<span style="color: #aaaaaa">@@ -1180,7 +1180,7 @@ void scr_local(struct code *pc, int fargc, char **fargv )
</span> }
}
-void scr_return( struct code *pc, int fargc, char **fargv )
<span style="color: #000000;background-color: #ddffdd">+void scr_return( struct code *pc, int fargc, char **fargv )
</span> {
if (pc->argc >= 1)
{
<span style="color: #aaaaaa">@@ -1191,7 +1191,7 @@ void scr_return( struct code *pc, int fargc, char **fargv )
</span> {
VAR_STR_FORCE(local_vars, "?", "");
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> script_terminate=1;
}
<span style="color: #aaaaaa">@@ -1214,7 +1214,7 @@ void scr_jump( struct code *pc, int fargc, char **fargv )
</span> compare_count=0;
return;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (pc->argc<1) {
if (script_debug) printf("Error in %s at %s too few arguments.\n", pc->inst->name, pc->debug);
return;
<span style="color: #aaaaaa">@@ -1301,7 +1301,7 @@ void scr_jump( struct code *pc, int fargc, char **fargv )
</span> free(where);
}
-void scr_end( struct code *pc, int fargc, char **fargv )
<span style="color: #000000;background-color: #ddffdd">+void scr_end( struct code *pc, int fargc, char **fargv )
</span> {
script_terminate=2;
}
<span style="color: #aaaaaa">@@ -1526,7 +1526,7 @@ void scr_input( struct code *pc, int fargc, char **fargv )
</span> if (prompt!=NULL) free(prompt);
}
-void scr_regex( struct code *pc, int fargc, char **fargv )
<span style="color: #000000;background-color: #ddffdd">+void scr_regex( struct code *pc, int fargc, char **fargv )
</span> {
#define MAX_REGMATCHES 100
<span style="color: #aaaaaa">@@ -1740,7 +1740,7 @@ void scr_regex( struct code *pc, int fargc, char **fargv )
</span> #undef MAX_REGMATCHES
}
-void scr_string( struct code *pc, int fargc, char **fargv )
<span style="color: #000000;background-color: #ddffdd">+void scr_string( struct code *pc, int fargc, char **fargv )
</span> {
char *what=NULL;
char *part=NULL;
<span style="color: #aaaaaa">@@ -1870,7 +1870,7 @@ void scr_string( struct code *pc, int fargc, char **fargv )
</span> if (!strcasecmp(pc->inst->name, "strmid"))
{
int start, end, i, size;
- char *c, *frag;
<span style="color: #000000;background-color: #ddffdd">+ char *c, *frag;
</span>
frag=part;
size=strlen(text)-1;
<span style="color: #aaaaaa">@@ -1913,7 +1913,7 @@ void scr_string( struct code *pc, int fargc, char **fargv )
</span> text[end+1]=0;
value=strdup( &text[start] );
}
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span>
var_str_force_2(what, value);
<span style="color: #aaaaaa">@@ -1923,7 +1923,7 @@ void scr_string( struct code *pc, int fargc, char **fargv )
</span> if (text!=NULL) free(text);
}
-void scr_case( struct code *pc, int fargc, char **fargv )
<span style="color: #000000;background-color: #ddffdd">+void scr_case( struct code *pc, int fargc, char **fargv )
</span> {
char *what;
char *value=NULL;
<span style="color: #aaaaaa">@@ -1951,13 +1951,13 @@ void scr_case( struct code *pc, int fargc, char **fargv )
</span> value[i] = tolower(value[i]);
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> var_str_force_2(what, value);
free(value);
free(what);
}
-void scr_base( struct code *pc, int fargc, char **fargv )
<span style="color: #000000;background-color: #ddffdd">+void scr_base( struct code *pc, int fargc, char **fargv )
</span> {
char *what;
char *value=NULL;
<span style="color: #aaaaaa">@@ -1971,7 +1971,7 @@ void scr_base( struct code *pc, int fargc, char **fargv )
</span>
if (!strcasecmp(pc->inst->name, "toascii")) {
int i;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (!isanum(value, &i, 0)) {
if (script_debug) escprintf("- toascii: cant convert number '%s' to a char, cos its not a number\n", value);
free(what);
<span style="color: #aaaaaa">@@ -1990,7 +1990,7 @@ void scr_base( struct code *pc, int fargc, char **fargv )
</span> free(value);
value=strdup(buff);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> var_str_force_2(what, value);
free(value);
free(what);
<span style="color: #aaaaaa">@@ -2034,7 +2034,7 @@ void scr_user( struct code *pc, int fargc, char **fargv )
</span> free(value);
free(what);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> void scr_version( struct code *pc, int fargc, char **fargv )
{
char *what;
<span style="color: #aaaaaa">@@ -2282,7 +2282,7 @@ void scr_listvars( struct code *pc, int fargc, char **fargv )
</span> if (srch) free(srch);
free(text);
free(what);
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
void scr_logoninfo( struct code *pc, int fargc, char **fargv )
</code></pre>
<br>
</li>
<li id='diff-24'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-24'>
<strong>
src/client/sort.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/sort.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/sort.h
</span><span style="color: #aaaaaa">@@ -7,7 +7,7 @@ struct listing
</span> {
char name[NAMESIZE+1];
int count;
- int size;
<span style="color: #000000;background-color: #ddffdd">+ int size;
</span> struct listing *next;
};
</code></pre>
<br>
</li>
<li id='diff-25'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-25'>
<strong>
src/client/sqlite.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/sqlite.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/sqlite.c
</span><span style="color: #aaaaaa">@@ -74,16 +74,16 @@ struct js_db_result* js_db_query(char *dbname, char *query)
</span>
sqlite3 *db;
new = malloc(sizeof(struct js_db_result));
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(new == NULL) {
return NULL;
}
-
- new->error_text=NULL;
<span style="color: #000000;background-color: #ddffdd">+
+ new->error_text=NULL;
</span> new->query_error=0;
new->db_error=0;
-
-
<span style="color: #000000;background-color: #ddffdd">+
+
</span> if (dbname == NULL) {
new->error_text=strdup("Database name was NULL");
new->db_error=-1;
<span style="color: #aaaaaa">@@ -105,7 +105,7 @@ struct js_db_result* js_db_query(char *dbname, char *query)
</span> db_close(db);
return new;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> new->query_result->rows = -1;
new->query_result->cols = -1;
new->query_result->colNames = NULL;
</code></pre>
<br>
</li>
<li id='diff-26'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-26'>
<strong>
src/client/talker.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/talker.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/talker.c
</span><span style="color: #aaaaaa">@@ -50,7 +50,7 @@ extern unsigned long rights;
</span> extern struct person *user;
extern struct folder *fold;
extern int32_t userposn;
-extern unsigned long loggedin;
<span style="color: #000000;background-color: #ddffdd">+extern unsigned long loggedin;
</span> extern int quietmode;
static int runautoexec = 1;
<span style="color: #aaaaaa">@@ -106,7 +106,7 @@ void talk_send_emote(char * text, int channel, int plural){
</span> talk_send_to_room(text, channel, "emote", plural);
}
-void talk_sayto(char *text, const char *to, const char *type)
<span style="color: #000000;background-color: #ddffdd">+void talk_sayto(char *text, const char *to, const char *type)
</span> {
ipc_message_t * msg = ipcmsg_create(IPC_SAYTOUSER, userposn);
json_t * j = json_init(NULL);
<span style="color: #aaaaaa">@@ -228,10 +228,10 @@ void t_showvars(CommandList *cm, int argc, const char **argv, char *args)
</span> void t_event(CommandList *cm, int argc, const char **argv, char *args)
{
/* no arguments */
- if (argc < 2)
<span style="color: #000000;background-color: #ddffdd">+ if (argc < 2)
</span> {
char *event_text = NULL;
- int event_count = 0;
<span style="color: #000000;background-color: #ddffdd">+ int event_count = 0;
</span>
/* show list of events */
while((event_text = NextLink(event_list, event_text)) != NULL)
<span style="color: #aaaaaa">@@ -249,7 +249,7 @@ void t_event(CommandList *cm, int argc, const char **argv, char *args)
</span> else
printf("Event '%s' added!\n", argv[1]);
}
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> void t_unevent(CommandList *cm, int argc, const char **argv, char *args)
{
if (!strcasecmp("*", argv[1]))
<span style="color: #aaaaaa">@@ -258,7 +258,7 @@ void t_unevent(CommandList *cm, int argc, const char **argv, char *args)
</span> printf("All Events Destroyed!\n");
}
else
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> if (!DestroyLink(&event_list, argv[1]))
printf("Event '%s' was not found!\n", argv[1]);
else
<span style="color: #aaaaaa">@@ -350,7 +350,7 @@ void t_destroy(CommandList *cm, int argc, const char **argv, char *args)
</span> printf("Specify the function to destroy.\n");
return;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (!strcmp(argv[1],"*")) DestroyAllFunctions(1); else DestroyFunction(argv[1]);
}
<span style="color: #aaaaaa">@@ -388,10 +388,10 @@ void t_restart(CommandList *cm, int argc, const char **argv, char *args)
</span> DestroyAllLinks(&ipc_list); ipc_list = NULL;
DestroyAllLinks(&force_list); force_list = NULL;
DestroyAllLinks(&shutdown_list); shutdown_list = NULL;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> stop_js();
setup_js();
-
<span style="color: #000000;background-color: #ddffdd">+
</span> RoomDestroy(&myroom);
RoomInit(&myroom);
<span style="color: #aaaaaa">@@ -520,7 +520,7 @@ void t_emote(CommandList *cm, int argc, const char **argv, char *args)
</span> text[0] = 0;
strncat(text, args, MAXTEXTLENGTH - strlen(text) - 1);
- talk_send_emote(text,user->room,0);
<span style="color: #000000;background-color: #ddffdd">+ talk_send_emote(text,user->room,0);
</span> }
void t_emotes(CommandList *cm, int argc, const char **argv, char *args)
<span style="color: #aaaaaa">@@ -530,7 +530,7 @@ void t_emotes(CommandList *cm, int argc, const char **argv, char *args)
</span> text[0] = 0;
strncat(text, args, MAXTEXTLENGTH - strlen(text) - 1);
- talk_send_emote(text,user->room,1);
<span style="color: #000000;background-color: #ddffdd">+ talk_send_emote(text,user->room,1);
</span> }
void t_emotes2(CommandList *cm, int argc, const char **argv, char *args)
<span style="color: #aaaaaa">@@ -540,7 +540,7 @@ void t_emotes2(CommandList *cm, int argc, const char **argv, char *args)
</span> text[0] = 0;
strncat(text, args, MAXTEXTLENGTH - strlen(text) - 1);
- talk_send_emote(text,user->room,2);
<span style="color: #000000;background-color: #ddffdd">+ talk_send_emote(text,user->room,2);
</span> }
void t_emoted(CommandList *cm, int argc, const char **argv, char *args)
<span style="color: #aaaaaa">@@ -550,7 +550,7 @@ void t_emoted(CommandList *cm, int argc, const char **argv, char *args)
</span> text[0] = 0;
strncat(text, args, MAXTEXTLENGTH - strlen(text) - 1);
- talk_send_emote(text,user->room,3);
<span style="color: #000000;background-color: #ddffdd">+ talk_send_emote(text,user->room,3);
</span> }
void t_emotell(CommandList *cm, int argc, const char **argv, char *args)
<span style="color: #aaaaaa">@@ -560,7 +560,7 @@ void t_emotell(CommandList *cm, int argc, const char **argv, char *args)
</span> text[0] = 0;
strncat(text, args, MAXTEXTLENGTH - strlen(text) - 1);
- talk_send_emote(text,user->room,4);
<span style="color: #000000;background-color: #ddffdd">+ talk_send_emote(text,user->room,4);
</span> }
void t_global(CommandList *cm, int argc, const char **argv, char *args)
<span style="color: #aaaaaa">@@ -1015,7 +1015,7 @@ void t_room(CommandList *cm, int argc, const char **argv, char *args)
</span> case 4:
display_message("Invalid Room ID (0-65535 only)", 1, 1);
break;
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> }
void t_linewrap(CommandList *cm, int argc, const char **argv, char *args)
<span style="color: #aaaaaa">@@ -1056,7 +1056,7 @@ void t_topic(CommandList *cm, int argc, const char **argv, char *args)
</span> if (topic != NULL && *topic != 0) {
asprintf(&buff, "Topic: %s\n", topic);
} else {
- asprintf(&buff, "No Topic is set for channel %d.\n", user->room);
<span style="color: #000000;background-color: #ddffdd">+ asprintf(&buff, "No topic is set for channel %d.\n", user->room);
</span> }
display_message(buff, 0, 1);
if (topic != NULL) free(topic);
<span style="color: #aaaaaa">@@ -1088,17 +1088,17 @@ void t_uri(CommandList *cm, int argc, const char **argv, char *args)
</span> uriActionList *al = uritable;
int wiz=0, num;
char c;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(argc == 1) {
// default action - list last 10 uris
uri_list_display(10, NULL);
return;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (u_god(user->status)) {
wiz=1;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> while(al->action)
{
if( strcasecmp(al->action, argv[1]) == 0 // we have a valid action
<span style="color: #aaaaaa">@@ -1111,17 +1111,17 @@ void t_uri(CommandList *cm, int argc, const char **argv, char *args)
</span> }
al++;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(argc == 2) // check for the posibility we have ".uri n" (same as .uri list * n)
{
if(sscanf(argv[1], "%d%c", &num, &c) == 1) { // check the arg is an int
- if(num > 0) {
<span style="color: #000000;background-color: #ddffdd">+ if(num > 0) {
</span> uri_list_display(num, NULL);
return;
}
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> printf("%s\n", cm->ArgError);
}
<span style="color: #aaaaaa">@@ -1200,13 +1200,13 @@ void set_talk_rights(void)
</span> if (cp_flags(user->chatprivs,CP_DEVEL,CM_MODE_ANY)) rights|=0x2000;
current_rights = RIGHTS_TALK;
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
-void sendipc(char *to, char *text, int bcast)
<span style="color: #000000;background-color: #ddffdd">+void sendipc(char *to, char *text, int bcast)
</span> {
int count;
- if (bcast)
<span style="color: #000000;background-color: #ddffdd">+ if (bcast)
</span> {
count = ipc_send_to_all(IPC_SCRIPTIPC, text);
}
<span style="color: #aaaaaa">@@ -1226,7 +1226,7 @@ void sendipc(char *to, char *text, int bcast)
</span> }
}
-void sendrpc(char *to, char *type, char *text, int bcast)
<span style="color: #000000;background-color: #ddffdd">+void sendrpc(char *to, char *type, char *text, int bcast)
</span> {
char buff[MAXTEXTLENGTH];
int count;
<span style="color: #aaaaaa">@@ -1234,7 +1234,7 @@ void sendrpc(char *to, char *type, char *text, int bcast)
</span> snprintf(buff, MAXTEXTLENGTH, "%s %s", type, text);
if(bcast)
{
- count = ipc_send_to_all(IPC_SCRIPTRPC, buff);
<span style="color: #000000;background-color: #ddffdd">+ count = ipc_send_to_all(IPC_SCRIPTRPC, buff);
</span> }
else
{
</code></pre>
<br>
</li>
<li id='diff-27'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-27'>
<strong>
src/client/talker_privs.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/talker_privs.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/talker_privs.c
</span><span style="color: #aaaaaa">@@ -194,8 +194,8 @@ unsigned long chatmode_describe(unsigned long old, unsigned long new, int ourapl
</span> enter_talker(3);
}
- return(new);
-}
<span style="color: #000000;background-color: #ddffdd">+ return(new);
+}
</span>
/***************************/
<span style="color: #aaaaaa">@@ -212,7 +212,7 @@ char *part_gag_filter(const char *text, int state)
</span> ptr=0;
len=strlen(text);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> while (gaglist[ptr].name!=NULL)
{
if ((len==0 || !strncasecmp(gaglist[ptr].name, text, len)) && strcmp(gaglist[ptr].name, ""))
</code></pre>
<br>
</li>
<li id='diff-28'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-28'>
<strong>
src/client/uri.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/uri.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/uri.c
</span><span style="color: #aaaaaa">@@ -47,7 +47,7 @@ uriFlagList uriflagtable[] = {
</span> { URLFLAG_SUCS, "sucs", "members-only", "(Members Only)" },
{ 0, NULL, NULL, NULL }
};
-
<span style="color: #000000;background-color: #ddffdd">+
</span> // turns the db flag string into a bitwise flag field
static int uri_parse_flags(const char *flagstr)
{
<span style="color: #aaaaaa">@@ -108,7 +108,7 @@ static void uri_make_flags_description(char *shortflags, char *flagstr, int len)
</span> static const char *uri_get_flag_description(int flag)
{
uriFlagList *fl = uriflagtable;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> while(fl->flag)
{
if(flag == fl->flag)
<span style="color: #aaaaaa">@@ -123,7 +123,7 @@ static const char *uri_get_flag_description(int flag)
</span> // display <number> uris posted by <username> (or all users if username is NULL)
void uri_list_display(int number, const char * username)
{
- char *query;
<span style="color: #000000;background-color: #ddffdd">+ char *query;
</span> struct db_result *res;
struct db_data *node;
int width, i, len;
<span style="color: #aaaaaa">@@ -131,13 +131,13 @@ void uri_list_display(int number, const char * username)
</span> char *mode;
int disp_mode=0;
char flagstr[1024]="";
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(username == NULL) {
query = sqlite3_mprintf("SELECT id,datetime(added, 'localtime'),user,url,title,flags FROM mwuri ORDER BY id DESC LIMIT %d", number);
} else {
query = sqlite3_mprintf("SELECT id,datetime(added, 'localtime'),user,url,title,flags FROM mwuri WHERE user=%Q ORDER BY id DESC LIMIT %d", username, number);
}
- res = db_query(MWURI_DB, query, 1);
<span style="color: #000000;background-color: #ddffdd">+ res = db_query(MWURI_DB, query, 1);
</span> fflush(stdout);
if(res == NULL) {
printf(".uri database lookup failed\n");
<span style="color: #aaaaaa">@@ -155,11 +155,11 @@ void uri_list_display(int number, const char * username)
</span> }
else if(res->rows < number)
{
- printf("Displaying all uris posted to milliways%s%s:\n", username ? " by user " : "", username ? username : "");
<span style="color: #000000;background-color: #ddffdd">+ printf("Displaying all uris posted to milliways%s%s:\n", username ? " by user " : "", username ? username : "");
</span> }
else
{
- printf("Displaying the last %d uri%s posted to milliways%s%s:\n", res->rows, res->rows==1? "s":"", username ? " by user " : "", username ? username : "");
<span style="color: #000000;background-color: #ddffdd">+ printf("Displaying the last %d uri%s posted to milliways%s%s:\n", res->rows, res->rows==1? "s":"", username ? " by user " : "", username ? username : "");
</span> }
// pick up the display mode from the private db
// we default to short if we don't get anything from the db
<span style="color: #aaaaaa">@@ -184,10 +184,10 @@ void uri_list_display(int number, const char * username)
</span> char *url = node->field[3];
char *title = node->field[4];
uri_make_flags_description(node->field[5], flagstr, sizeof(flagstr)); // flags = node->field[5]
-
<span style="color: #000000;background-color: #ddffdd">+
</span> snprintf(url_line, width, "#\033G-%s\033-- [%s] <%s>%s\n", id, added, usr, flagstr );
display_message(url_line, 0, 1);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(title != NULL) {
len = strlen(title);
for(i = 0; i<len; i++) {
<span style="color: #aaaaaa">@@ -198,7 +198,7 @@ void uri_list_display(int number, const char * username)
</span> {
// in full display mode we just show the whole url + title
snprintf(url_line, MAXTEXTLENGTH-1, " %s%s%s", url, title ? " | ":"", title ? title:"");
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
else
{
<span style="color: #aaaaaa">@@ -233,8 +233,8 @@ void uri_list(int argc, const char **argv, int wiz)
</span> char *username = NULL; // default is to display everyone's uris
int number = 10; // default is to display 10 uris
struct person *list_user = NULL;
- char c;
-
<span style="color: #000000;background-color: #ddffdd">+ char c;
+
</span> if(argc == 1) // just '.uri list'
{
username = user->name;
<span style="color: #aaaaaa">@@ -242,10 +242,10 @@ void uri_list(int argc, const char **argv, int wiz)
</span> else if(strcasecmp(argv[1], "*") == 0) // wants all uris
{
// username is already NULL and will thus select everyone
- if(argc==3)
<span style="color: #000000;background-color: #ddffdd">+ if(argc==3)
</span> {
- if(sscanf(argv[2], "%d%c", &number, &c) == 1)
- {
<span style="color: #000000;background-color: #ddffdd">+ if(sscanf(argv[2], "%d%c", &number, &c) == 1)
+ {
</span> if(number < 1)
{
printf(".uri list * - can't list <1 uris\n");
<span style="color: #aaaaaa">@@ -257,22 +257,22 @@ void uri_list(int argc, const char **argv, int wiz)
</span> printf(".uri list * - last parameter was not a positive integer\n");
return;
}
-
- }
<span style="color: #000000;background-color: #ddffdd">+
+ }
</span> if(argc>3)
{
printf(".uri list * - too many parameters\n");
return;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
else if( (list_user = user_get(argv[1])) != NULL) // is a real user
{
username = list_user->name;
- if(argc==3)
<span style="color: #000000;background-color: #ddffdd">+ if(argc==3)
</span> {
- if(sscanf(argv[2], "%d%c", &number, &c) == 1)
- {
<span style="color: #000000;background-color: #ddffdd">+ if(sscanf(argv[2], "%d%c", &number, &c) == 1)
+ {
</span> if(number < 1)
{
free(list_user);
<span style="color: #aaaaaa">@@ -293,13 +293,13 @@ void uri_list(int argc, const char **argv, int wiz)
</span> printf(".uri list %s - too many parameters\n", argv[1]);
return;
}
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> else // possibly we have '.uri list n' or we might have garbage
{
- if(argc==2)
<span style="color: #000000;background-color: #ddffdd">+ if(argc==2)
</span> {
- if(sscanf(argv[1], "%d%c", &number, &c) == 1)
- {
<span style="color: #000000;background-color: #ddffdd">+ if(sscanf(argv[1], "%d%c", &number, &c) == 1)
+ {
</span> if(number < 1)
{
printf(".uri list - can't list <1 uris\n");
<span style="color: #aaaaaa">@@ -319,11 +319,11 @@ void uri_list(int argc, const char **argv, int wiz)
</span> printf(".uri list - invalid parameters\n");
return;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
-
<span style="color: #000000;background-color: #ddffdd">+
</span> uri_list_display(number, username);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(list_user) {
free(list_user);
}
<span style="color: #aaaaaa">@@ -336,9 +336,9 @@ static unsigned int uri_get_id(const char *idstr, int wiz)
</span> {
unsigned int id;
char c;
- char *query;
<span style="color: #000000;background-color: #ddffdd">+ char *query;
</span> struct db_result *res;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if( strcasecmp( "last", idstr ) == 0)
{
id=0;
<span style="color: #aaaaaa">@@ -350,7 +350,7 @@ static unsigned int uri_get_id(const char *idstr, int wiz)
</span> {
query = sqlite3_mprintf("SELECT id FROM mwuri WHERE user=%Q ORDER BY id DESC LIMIT 1", user->name );
}
- res = db_query(MWURI_DB, query, 0);
<span style="color: #000000;background-color: #ddffdd">+ res = db_query(MWURI_DB, query, 0);
</span> sqlite3_free(query);
if(res)
{
<span style="color: #aaaaaa">@@ -378,7 +378,7 @@ static unsigned int uri_get_id(const char *idstr, int wiz)
</span> void uri_delete(int argc, const char **argv, int wiz)
{
unsigned int id;
- char *query;
<span style="color: #000000;background-color: #ddffdd">+ char *query;
</span> struct db_result *res;
char mesg[MAXTEXTLENGTH];
char *del_query;
<span style="color: #aaaaaa">@@ -386,11 +386,11 @@ void uri_delete(int argc, const char **argv, int wiz)
</span> int owner;
char answer[10];
char *username, *uri, *added;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if((id = uri_get_id(argv[1], wiz)) > 0 )
{
query = sqlite3_mprintf("SELECT user,url,added FROM mwuri WHERE id=%d", id);
- res = db_query(MWURI_DB, query, 1);
<span style="color: #000000;background-color: #ddffdd">+ res = db_query(MWURI_DB, query, 1);
</span> if(res)
{
if(res->rows > 0)
<span style="color: #aaaaaa">@@ -399,7 +399,7 @@ void uri_delete(int argc, const char **argv, int wiz)
</span> uri = res->data->field[1];
added = res->data->field[2];
owner = (strcmp(user->name, username)==0);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(owner || wiz)
{
snprintf(mesg, MAXTEXTLENGTH-1, "Are you sure you want to delete %s%s uri %s from mwuri?", owner? "your":username, owner? "":"'s", uri);
<span style="color: #aaaaaa">@@ -408,8 +408,8 @@ void uri_delete(int argc, const char **argv, int wiz)
</span> if (answer[0]=='y' || answer[0]=='Y')
{
del_query = sqlite3_mprintf("DELETE FROM mwuri WHERE id=%d", id);
- del_res = db_query(MWURI_DB, del_query, 1);
-
<span style="color: #000000;background-color: #ddffdd">+ del_res = db_query(MWURI_DB, del_query, 1);
+
</span> if(del_res)
{
free(del_res);
<span style="color: #aaaaaa">@@ -455,8 +455,8 @@ void uri_delete(int argc, const char **argv, int wiz)
</span> static void uri_set_flag(int argc, const char **argv, int wiz, int flag)
{
unsigned int id;
- char mesg[MAXTEXTLENGTH];
- char *query, *update_query;
<span style="color: #000000;background-color: #ddffdd">+ char mesg[MAXTEXTLENGTH];
+ char *query, *update_query;
</span> struct db_result *res, *update_res;
int owner;
char answer[10];
<span style="color: #aaaaaa">@@ -464,16 +464,16 @@ static void uri_set_flag(int argc, const char **argv, int wiz, int flag)
</span> int flags;
char flagstr[1024];
const char *desc_str = uri_get_flag_description(flag);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(desc_str == NULL) {
printf("uri: whoops, someone needs to debug\n");
return;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if((id = uri_get_id(argv[1], wiz)) > 0 )
{
query = sqlite3_mprintf("SELECT user,url,flags,datetime(added, 'localtime') FROM mwuri WHERE id=%d", id);
- res = db_query(MWURI_DB, query, 1);
<span style="color: #000000;background-color: #ddffdd">+ res = db_query(MWURI_DB, query, 1);
</span> if(res)
{
if(res->rows > 0)
<span style="color: #aaaaaa">@@ -483,7 +483,7 @@ static void uri_set_flag(int argc, const char **argv, int wiz, int flag)
</span> flags = uri_parse_flags(res->data->field[2]);
added = res->data->field[3];
owner = (strcmp(user->name, username)==0);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(owner || wiz)
{
if(flags & flag)
<span style="color: #aaaaaa">@@ -499,12 +499,12 @@ static void uri_set_flag(int argc, const char **argv, int wiz, int flag)
</span> if (answer[0]=='y' || answer[0]=='Y')
{
flags ^= flag; // toggle flag
-
<span style="color: #000000;background-color: #ddffdd">+
</span> uri_make_flags_str(flags, flagstr, sizeof(flagstr));
-
<span style="color: #000000;background-color: #ddffdd">+
</span> update_query = sqlite3_mprintf("UPDATE mwuri SET flags=%Q WHERE id=%d", flagstr, id);
- update_res = db_query(MWURI_DB, update_query, 1);
-
<span style="color: #000000;background-color: #ddffdd">+ update_res = db_query(MWURI_DB, update_query, 1);
+
</span> if(update_res)
{
free(update_res);
<span style="color: #aaaaaa">@@ -539,7 +539,7 @@ static void uri_set_flag(int argc, const char **argv, int wiz, int flag)
</span> snprintf(mesg, MAXTEXTLENGTH-1, "uri %s: %s is not a valid uri id", argv[0], argv[1]);
display_message(mesg, 0, 1);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
// these 3 flag functions call the man set_flag with the right flag
<span style="color: #aaaaaa">@@ -567,7 +567,7 @@ void uri_display_mode(int argc, const char **argv, int wiz)
</span> {
mode = default_mode;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(argc == 1)
{
printf("Current uri list mode is: %s\n", mode ? mode:"short");
<span style="color: #aaaaaa">@@ -603,7 +603,7 @@ void uri_display_mode(int argc, const char **argv, int wiz)
</span> printf("Usage: uri displaymode [full|short]\n");
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(mode != default_mode)
{
free(mode);
<span style="color: #aaaaaa">@@ -621,39 +621,39 @@ char *uri_action_tc(const char *text, int state)
</span>
if (state==0)
{
- i=0;
- len=strlen(text);
- wiz = u_god(user->status);
<span style="color: #000000;background-color: #ddffdd">+ i=0;
+ len=strlen(text);
+ wiz = u_god(user->status);
</span> }
-
<span style="color: #000000;background-color: #ddffdd">+
</span> while (uritable[i].action!=NULL)
{
- if(len==0 && uritable[i].tc_mode==1)
- {
- // if len is 0 we tc all actions with a tc_mode 1 - tc_mode 2 are the su !edit functions for altering others uris
- do_tc = 1;
- }
- if(len > 0 && (!strncasecmp(uritable[i].action, text, len)) && uritable[i].tc_mode )
- {
- // if we have the first char(s) then all non hidden actions can be shown
- do_tc = 1;
- }
- if(!strcmp(uritable[i].action, ""))
- {
- do_tc = 0;
- }
- if(uritable[i].needs_wiz && !wiz)
- {
- // if the action needs wiz and we haven't got wiz we don't tc
- do_tc = 0;
- }
- if(do_tc)
- {
- c=dupstr(uritable[i].action,"");
- i++;
- return(c);
- }
- i++;
<span style="color: #000000;background-color: #ddffdd">+ if(len==0 && uritable[i].tc_mode==1)
+ {
+ // if len is 0 we tc all actions with a tc_mode 1 - tc_mode 2 are the su !edit functions for altering others uris
+ do_tc = 1;
+ }
+ if(len > 0 && (!strncasecmp(uritable[i].action, text, len)) && uritable[i].tc_mode )
+ {
+ // if we have the first char(s) then all non hidden actions can be shown
+ do_tc = 1;
+ }
+ if(!strcmp(uritable[i].action, ""))
+ {
+ do_tc = 0;
+ }
+ if(uritable[i].needs_wiz && !wiz)
+ {
+ // if the action needs wiz and we haven't got wiz we don't tc
+ do_tc = 0;
+ }
+ if(do_tc)
+ {
+ c=dupstr(uritable[i].action,"");
+ i++;
+ return(c);
+ }
+ i++;
</span> }
return(NULL);
}
<span style="color: #aaaaaa">@@ -669,13 +669,13 @@ char *uri_arg_tc(const char *text, int state)
</span> static int ptr=0;
static int len=0;
char *c;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (state==0)
{
type = 0;
ptr = 0;
len = strlen(text);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(strcasestr(rl_line_buffer, " list "))
{
type = 1;
<span style="color: #aaaaaa">@@ -685,7 +685,7 @@ char *uri_arg_tc(const char *text, int state)
</span> type = 2;
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(type == 1)
{
// tab complete .uri list. part_user function handles it
<span style="color: #aaaaaa">@@ -704,8 +704,8 @@ char *uri_arg_tc(const char *text, int state)
</span> }
ptr++;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
return(NULL);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span></code></pre>
<br>
</li>
<li id='diff-29'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-29'>
<strong>
src/client/user.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/user.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/user.c
</span><span style="color: #aaaaaa">@@ -50,7 +50,7 @@ char *getmylogin(void)
</span> void update_user(struct person *record, int32_t userposn)
{
int outfile;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> outfile=userdb_open(O_RDWR|O_CREAT);
/*Lock_File(outfile); */
lseek(outfile,userposn,0);
<span style="color: #aaaaaa">@@ -95,7 +95,7 @@ void strip_name(char *string)
</span> char *array;
int i,ptr=0;
int len;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> len=strlen(string);
array=(char *)malloc(len+1);
for (i=0;i<len;i++)
<span style="color: #aaaaaa">@@ -112,7 +112,7 @@ void get_login(char *name, int autochat)
</span> {
char *lname = getmylogin();
fflush(stdin);
-gstart:
<span style="color: #000000;background-color: #ddffdd">+gstart:
</span> if (lname == NULL) {
/* cant find you, or you are bbs, MUST tell us name */
printf(_("Please enter username: "));
<span style="color: #aaaaaa">@@ -145,7 +145,7 @@ gstart:
</span> strncpy(name,lname,NAMESIZE);
name[NAMESIZE]=0;
}
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> }
int get_person(int file, struct person *tmp)
<span style="color: #aaaaaa">@@ -156,7 +156,7 @@ int get_person(int file, struct person *tmp)
</span> return(false);
}else
if (no<sizeof(*tmp))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> printf(_("Problem in get_person: my uid=%d my euid=%d"), getuid(), geteuid());
perror("userfile");
SAFE_FREE(user);
<span style="color: #aaaaaa">@@ -332,7 +332,7 @@ static int new_usr(struct person *usr, char *name, int32_t *userposn)
</span> userdb_write(usr,userposn);
return(true);
}
- else return(false);
<span style="color: #000000;background-color: #ddffdd">+ else return(false);
</span> }
int is_old(struct person *usr, const char *name, int32_t *userposn)
<span style="color: #aaaaaa">@@ -351,7 +351,7 @@ int is_old(struct person *usr, const char *name, int32_t *userposn)
</span> }
void login_ok(struct person *usr, int32_t *userposn, int *autochat)
-{
<span style="color: #000000;background-color: #ddffdd">+{
</span> /* main function */
char name[NAMESIZE+1];
int okay;
<span style="color: #aaaaaa">@@ -364,7 +364,7 @@ void login_ok(struct person *usr, int32_t *userposn, int *autochat)
</span> }while (!okay);
}
-void list_users(int newonly)
<span style="color: #000000;background-color: #ddffdd">+void list_users(int newonly)
</span> {
int file;
struct person usr;
<span style="color: #aaaaaa">@@ -372,7 +372,7 @@ void list_users(int newonly)
</span> int linecount=0;
int screen_height = screen_h();
long logout_time;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> file=userdb_open(O_RDONLY);
while (get_person(file,&usr))
{
<span style="color: #aaaaaa">@@ -403,7 +403,7 @@ void list_users(int newonly)
</span> close(file);
}
-void list_users_since(long date)
<span style="color: #000000;background-color: #ddffdd">+void list_users_since(long date)
</span> {
int file;
struct person usr;
<span style="color: #aaaaaa">@@ -411,7 +411,7 @@ void list_users_since(long date)
</span> int linecount=0;
int screen_height = screen_h();
long logout_time;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> file=userdb_open(O_RDONLY);
while (get_person(file,&usr))
{
<span style="color: #aaaaaa">@@ -453,7 +453,7 @@ static void list_users_flags(int flags, int type, int inv)
</span> int check=0;
long logout_time;
int screen_height=screen_h();
-
<span style="color: #000000;background-color: #ddffdd">+
</span> file=userdb_open(O_RDONLY);
while (get_person(file,&usr))
{
<span style="color: #aaaaaa">@@ -485,7 +485,7 @@ static void list_users_flags(int flags, int type, int inv)
</span> if (!u_del(usr.status))
{
linecount++;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (type < 3)
printf("%*s [%s] [%s] [%s] %s", NAMESIZE, usr.name,
stats, spec, gr, ctime(&logout_time));
<span style="color: #aaaaaa">@@ -515,7 +515,7 @@ void search(const char *args, const char *ptr)
</span> int data;
int inv=0;
int i;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (ptr[0]=='!')
{
inv=1;
</code></pre>
<br>
</li>
<li id='diff-30'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-30'>
<strong>
src/client/userio.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/userio.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/userio.c
</span><span style="color: #aaaaaa">@@ -78,7 +78,7 @@ void get_str(char *string, int size)
</span> else
{
fflush(stdout);
- if (mw_fgets(string,size+1,stdin)==NULL || feof(stdin))
<span style="color: #000000;background-color: #ddffdd">+ if (mw_fgets(string,size+1,stdin)==NULL || feof(stdin))
</span> {
eof_caught++;
if (eof_caught>=3)
<span style="color: #aaaaaa">@@ -90,7 +90,7 @@ void get_str(char *string, int size)
</span> }else
eof_caught=0;
- if ((ptr=(char *)strchr(string,'\n'))!=NULL)
<span style="color: #000000;background-color: #ddffdd">+ if ((ptr=(char *)strchr(string,'\n'))!=NULL)
</span> *ptr=0;
else
{
<span style="color: #aaaaaa">@@ -105,7 +105,7 @@ void read2cr(void)
</span> {
int c;
while ((c=getachar())!=EOF && c!='\n');
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
int getachar(void)
{
</code></pre>
<br>
</li>
<li id='diff-31'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-31'>
<strong>
src/folders.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/folders.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/folders.c
</span><span style="color: #aaaaaa">@@ -41,12 +41,12 @@ void create_folder_file(void)
</span> {
int file,i;
struct folder *record;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> record=(struct folder *)malloc(sizeof(*record));
record->status=0;
file=open(FOLDERFILE,O_WRONLY|O_CREAT,0600);
Lock_File(file);
- for (i=0;i<64;i++)
<span style="color: #000000;background-color: #ddffdd">+ for (i=0;i<64;i++)
</span> if (write(file,record,sizeof(*record))<0)
{
perror("creating blank folders");
<span style="color: #aaaaaa">@@ -73,7 +73,7 @@ int foldernumber(const char *name)
</span> number++;
}while (no!=0 && strncasecmp(name,fold.name,len));
close(file);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (no==0) return(-1); else return(number-1);
}
</code></pre>
<br>
</li>
<li id='diff-32'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-32'>
<strong>
src/gags.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/gags.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/gags.c
</span><span style="color: #aaaaaa">@@ -161,7 +161,7 @@ char * apply_gag(struct person *speaker, const char *text)
</span> {
GagInfo *gi = gaglist;
- /* this never changes at runtime,
<span style="color: #000000;background-color: #ddffdd">+ /* this never changes at runtime,
</span> * count how many for fast lookups
*/
if (gag_count == -1) {
<span style="color: #aaaaaa">@@ -243,7 +243,7 @@ void gag_normal(char *text)
</span> while (i<len)
{
if (text[i]==033) { i+=3; continue; }
- if (isupper(text[i]))
<span style="color: #000000;background-color: #ddffdd">+ if (isupper(text[i]))
</span> text[i]='M';
else
if (islower(text[i]))
<span style="color: #aaaaaa">@@ -409,7 +409,7 @@ static char *duplstr(char *text)
</span> const char *gag_type(int type)
{
GagInfo *gi = gag_find(type);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (gi != NULL) return(gi->text);
return("Unknown");
}
<span style="color: #aaaaaa">@@ -645,7 +645,7 @@ void gag_ack(char *text)
</span> do
{
tok = strsep(&p, " \t");
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> if(p && *p)
{
words[i] = tok;
<span style="color: #aaaaaa">@@ -653,7 +653,7 @@ void gag_ack(char *text)
</span> }
} while((i < MAX_WORDS) && (tok));
}
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> /* Convert to martian. */
{
char tmp_text[MAXTEXTLENGTH];
<span style="color: #aaaaaa">@@ -664,39 +664,39 @@ void gag_ack(char *text)
</span> while((i < MAX_WORDS) && words[i])
{
char tmp_buf[MAXTEXTLENGTH]; /*No good reason to be this big.*/
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> if((*words[i]))
<span style="color: #000000;background-color: #ffdddd">- {
</span><span style="color: #000000;background-color: #ddffdd">+ {
</span> int word_len;
int punctuation;
int shouting;
<span style="color: #000000;background-color: #ffdddd">-
- punctuation = shouting = 0;
-
</span><span style="color: #000000;background-color: #ddffdd">+
+ punctuation = shouting = 0;
+
</span> word_len = strlen(words[i]);
word_len = (word_len / 4) + 1; /* cheap syllable count */
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> if(word_len > (MAXTEXTLENGTH / 6))
{
word_len = MAXTEXTLENGTH / 6;
}
<span style="color: #000000;background-color: #ffdddd">-
- if(strrchr(words[i], '.') ||
</span><span style="color: #000000;background-color: #ddffdd">+
+ if(strrchr(words[i], '.') ||
</span> strrchr(words[i], ',') ||
strrchr(words[i], '!'))
{
punctuation = 1;
word_len++;
}
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> if(strrchr(words[i], '!') ||
(!first && isupper(*(words[i]))))
<span style="color: #000000;background-color: #ffdddd">- {
</span><span style="color: #000000;background-color: #ddffdd">+ {
</span> shouting = 1;
}
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> tmp_buf[0] = 0;
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> while(word_len)
{
if(shouting)
<span style="color: #aaaaaa">@@ -718,19 +718,19 @@ void gag_ack(char *text)
</span> word_len--;
}
strcat(tmp_buf, "! ");
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> if(punctuation)
{
first = 1;
}
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> /* Crap range check. Rewrite! */
if((strlen(tmp_text) + strlen(tmp_buf)) >= MAXTEXTLENGTH)
{
break;
}
else
<span style="color: #000000;background-color: #ffdddd">- {
</span><span style="color: #000000;background-color: #ddffdd">+ {
</span> strcat(tmp_text, tmp_buf);
}
}
<span style="color: #aaaaaa">@@ -796,34 +796,34 @@ char *apply_bork(char *text, const gag_pattern_t *list, int caps)
</span> #ifdef DEBUG
printf("Trying rule %d 0x%p '%s' at posn %d (%c): ",rule,p,p->from,tp,text[tp]);
#endif
-
<span style="color: #000000;background-color: #ddffdd">+
</span> while (i<l)
{
if (p->from[i]=='%')
{
char c;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (i==0 && tp!=0) c=text[tp+j-1];
else
c=text[tp+j];
if (tp+i==0 || !isalpha(c))
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> #ifdef DEBUG
printf("Failed any-char (%c)\n",c);
#endif
break;
}
#ifdef DEBUG
- else
<span style="color: #000000;background-color: #ddffdd">+ else
</span> printf("%% match i=%d tp=%d j=%d c=%c ",i,tp,j,c);
#endif
}else
if (p->from[i]=='^')
{
if (tp+j!=0 && !isspace(text[tp+j-1])
- && !ispunct(text[tp+j-1]))
- {
<span style="color: #000000;background-color: #ddffdd">+ && !ispunct(text[tp+j-1]))
+ {
</span> #ifdef DEBUG
printf("Failed ^\n");
#endif
<span style="color: #aaaaaa">@@ -832,11 +832,11 @@ printf("Trying rule %d 0x%p '%s' at posn %d (%c): ",rule,p,p->from,tp,text[tp])
</span> }else
if (p->from[i]=='$')
{
- if (tp+j<len &&
<span style="color: #000000;background-color: #ddffdd">+ if (tp+j<len &&
</span> !isspace(text[tp+j]) &&
!ispunct(text[tp+j]))
{
-#ifdef DEBUG
<span style="color: #000000;background-color: #ddffdd">+#ifdef DEBUG
</span> printf("Failed $\n");
#endif
break;
<span style="color: #aaaaaa">@@ -845,7 +845,7 @@ printf("Trying rule %d 0x%p '%s' at posn %d (%c): ",rule,p,p->from,tp,text[tp])
</span> if (tolower(p->from[i]) != tolower(text[tp+j]))
{
#ifdef DEBUG
- printf (" %c != %c\n",p->from[i],text[tp+j]);
<span style="color: #000000;background-color: #ddffdd">+ printf (" %c != %c\n",p->from[i],text[tp+j]);
</span> #endif
break;
}else
<span style="color: #aaaaaa">@@ -859,7 +859,7 @@ printf("Trying rule %d 0x%p '%s' at posn %d (%c): ",rule,p,p->from,tp,text[tp])
</span> */
/* dont let it overflow */
- if (bp+strlen(p->to) > MAXTEXTLENGTH-2)
<span style="color: #000000;background-color: #ddffdd">+ if (bp+strlen(p->to) > MAXTEXTLENGTH-2)
</span> {
#ifdef DEBUG
printf("Too Long\n");
<span style="color: #aaaaaa">@@ -869,7 +869,7 @@ printf("Trying rule %d 0x%p '%s' at posn %d (%c): ",rule,p,p->from,tp,text[tp])
</span> }
if (j==strlen(p->to))
- { /* same length, copy case */
<span style="color: #000000;background-color: #ddffdd">+ { /* same length, copy case */
</span> #ifdef DEBUG
printf("Keep case. j=%d\n",j);
#endif
<span style="color: #aaaaaa">@@ -886,9 +886,9 @@ printf("Trying rule %d 0x%p '%s' at posn %d (%c): ",rule,p,p->from,tp,text[tp])
</span> for (i=0;i<j;i++)
{ if (isupper(text[tp+i])) cas++; }
if (cas==j) /* all upper ? */
- cas=1;
<span style="color: #000000;background-color: #ddffdd">+ cas=1;
</span> else cas=0;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> #ifdef DEBUG
printf("Ignore case. j=%d len=%d\n",j,strlen(p->to));
#endif
<span style="color: #aaaaaa">@@ -907,7 +907,7 @@ printf("Matched.\n");
</span> p++;
rule++;
}
- if (p->from==NULL)
<span style="color: #000000;background-color: #ddffdd">+ if (p->from==NULL)
</span> {
buff[bp++]=text[tp++];
#ifdef DEBUG
</code></pre>
<br>
</li>
<li id='diff-33'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-33'>
<strong>
src/gagtable.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/gagtable.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/gagtable.c
</span><span style="color: #aaaaaa">@@ -1134,18 +1134,18 @@ const gag_pattern_t nosport[]={
</span> * Campaign */
{ "^cheer leader","pom-pom waver"},
{ "^cheer leading","pom-pom waving"},
-{ "^club$","big stick"},
<span style="color: #000000;background-color: #ddffdd">+{ "^club$","big stick"},
</span> { "^coach$","bus"},
{ "^conversion","algorithm"},
{ "course","smooth"}, /* to get things like racecourse, golf course */
{ "^formula$","recipe"},
{ "^goal","g**l"},
{ "^golfer","fashon victims"},
-{ "^grand prix","great pricks"},
<span style="color: #000000;background-color: #ddffdd">+{ "^grand prix","great pricks"},
</span> { "^grand national","1000 imigrants"},
{ "^hiker","hic-cougher"},
{ "^jockey","j-key"},
-{ "^manager$","p*ss artist"},
<span style="color: #000000;background-color: #ddffdd">+{ "^manager$","p*ss artist"},
</span> { "^mountineer","mole hill climber"},
{ "^olympic$","Greek thingy"},
{ "^olympics$","Greek thingies"},
<span style="color: #aaaaaa">@@ -1160,7 +1160,7 @@ const gag_pattern_t nosport[]={
</span> * caught. */
{ "^referee","w**ker"},
{ "^running$","moving quickly"},
-{ "^sport","sp***"},
<span style="color: #000000;background-color: #ddffdd">+{ "^sport","sp***"},
</span> { "^stump","st*mp"},
{ "^tackle$","fishing apparatus"},
{ "^team$","associates"},
<span style="color: #aaaaaa">@@ -1172,22 +1172,22 @@ const gag_pattern_t nosport[]={
</span>
/* sports */
{ "^angling","geometry"},
-{ "^archery$","pointed stick throwing"},
<span style="color: #000000;background-color: #ddffdd">+{ "^archery$","pointed stick throwing"},
</span> { "^athletic$","non-spod"},
-{ "^athletics","running round in circles"},
<span style="color: #000000;background-color: #ddffdd">+{ "^athletics","running round in circles"},
</span> { "^badminton","good mint off"},
{ "^boxing$","professional thuggery"},
{ "^cricket$","cri****"},
{ "^cross country","angry city"},
{ "^extra time$","play time"},
-{ "^fencing","walling"},
-{ "^fishing","wibbleing"},
<span style="color: #000000;background-color: #ddffdd">+{ "^fencing","walling"},
+{ "^fishing","wibbleing"},
</span> { "^free kick","keep fit"},
{ "^football","foo*****"},
{ "^footie$","foo***"},
{ "^golf$","a good walk ruined"},
{ "^grid iron","steel table"}, /* this is a name for American Football */
-{ "^hiking$","hello Queen"},
<span style="color: #000000;background-color: #ddffdd">+{ "^hiking$","hello Queen"},
</span> { "^hockey","bashing people with big sticks"},
{ "^indy","Native American"}, /* as in indycar racing and the Indy 500 */
{ "^injury$","Doctor Doctor"},
<span style="color: #aaaaaa">@@ -1197,9 +1197,9 @@ const gag_pattern_t nosport[]={
</span> { "^motorsport$","driving round in circles"},
{ "^mountineering","mole hill climbing"},
{ "^polo","the mint with the hole"},
-{ "^pool$","puddle"},
<span style="color: #000000;background-color: #ddffdd">+{ "^pool$","puddle"},
</span> { "^racing$","see who is the fastest"},
-{ "^rugby$","a game played by men with funny shaped b*lls"},
<span style="color: #000000;background-color: #ddffdd">+{ "^rugby$","a game played by men with funny shaped b*lls"},
</span> { "^sailing$","boring thing with boats"},
{ "^snooker$","sn**ker"},
{ "^speedway","slow-way"},
<span style="color: #aaaaaa">@@ -1232,7 +1232,7 @@ const gag_pattern_t nosport[]={
</span> { "^Birmingham","Brummyport"},
{ "^Cambridge","Cam-shaftbridge"},
{ "^Cardiff","C****ff"},
-{ "^Chelsea","pensioners"},
<span style="color: #000000;background-color: #ddffdd">+{ "^Chelsea","pensioners"},
</span> { "^Cheltenham","Gloucester"},
{ "^Chepstow","Cheap-stow"},
{ "^Essex","EasySex"},
<span style="color: #aaaaaa">@@ -1242,11 +1242,11 @@ const gag_pattern_t nosport[]={
</span> { "^Indianapolis","Native American City"},
{ "^Kent","C*nt"},
{ "^Lancashire","Red Rose Land"},
-{ "^Leeds$","Follows"},
<span style="color: #000000;background-color: #ddffdd">+{ "^Leeds$","Follows"},
</span> { "^Liverpool$","Kidneypuddle"},
{ "^Llanelli$","Turks"},
{ "^Lords$","Satan's"},
-{ "^Manchester$","W**kchester"},
<span style="color: #000000;background-color: #ddffdd">+{ "^Manchester$","W**kchester"},
</span> { "^Middlesex$","Transvestite"},
{ "^Newcastle$","Oldfort"},
{ "^Northamptonshire$","North Porktownshite"},
<span style="color: #aaaaaa">@@ -1261,7 +1261,7 @@ const gag_pattern_t nosport[]={
</span> { "^Wembley","Chaosville"},
{ "^Wimbledon","Wombleland"},
{ "^Yorkshire","White Rose Land"},
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* Countries & Nationalities.
* note: please try not to be too offensive here!
*/
<span style="color: #aaaaaa">@@ -1273,7 +1273,7 @@ const gag_pattern_t nosport[]={
</span> { "^Irish$","Leprechauns"},
{ "^New Zealand$","Kiwiland"},
{ "^New Zealander","Kiwi"},
-{ "^Scotland$","Thistle"},
<span style="color: #000000;background-color: #ddffdd">+{ "^Scotland$","Thistle"},
</span> { "^Scot$","Angus"},
{ "^Scottish","Anguses"},
{ "^valleys","Ar*e end of nowhere"},
</code></pre>
<br>
</li>
<li id='diff-34'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-34'>
<strong>
src/iconv.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/iconv.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/iconv.c
</span><span style="color: #aaaaaa">@@ -18,11 +18,11 @@
</span> static char * local_charset = NULL;
/**** convert_string_charset ****
- a generic iconv function to convert a string from any charset to another
- expects memory to be allocated for output_buffer
<span style="color: #000000;background-color: #ffdddd">-
</span>- returns: 0 if successful.
- +ve if something was converted but errors occured in the conversion
<span style="color: #000000;background-color: #ddffdd">+ a generic iconv function to convert a string from any charset to another
+ expects memory to be allocated for output_buffer
+
+ returns: 0 if successful.
+ +ve if something was converted but errors occured in the conversion
</span> -ve if the conversion fails.
input_buffer: pointer to the string you want to convert.
input_charset: the iconv encoding description string of the input string
<span style="color: #aaaaaa">@@ -36,13 +36,13 @@ static char * local_charset = NULL;
</span> invalid_count: on invalchars the number of invalid chars that were discovered in the string
substitute: if an invalid char is discovered replace it with this ***UTF-8*** string
(the utf8 string is converted into your desired charset)
-
<span style="color: #000000;background-color: #ddffdd">+
</span> for sanities sake this function always attempts to put '\0' (in the converted charset)
at the end of the output buffer even if there was not a '\0' in the input string.
-
<span style="color: #000000;background-color: #ddffdd">+
</span> it is assumed this function is used on a system that understands UTF-8!
if not you will get EOUTPUTNOTSUPPORTED.
-*/
<span style="color: #000000;background-color: #ddffdd">+*/
</span> int convert_string_charset(char *input_buffer, const char *input_charset, size_t input_length,
char *output_buffer, const char *output_charset, size_t output_buffer_length,
size_t *output_bytes_used, size_t *irreversible_count,
<span style="color: #aaaaaa">@@ -52,7 +52,7 @@ int convert_string_charset(char *input_buffer, const char *input_charset, size_t
</span> char *output_ptr;
iconv_t conversion_descriptor;
size_t input_bytes_left, output_bytes_left, not_conv_count=0;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> char converted_null[8], null_string[1]="";
char *converted_substitute=NULL;
size_t converted_substitute_length=output_buffer_length, converted_null_length;
<span style="color: #aaaaaa">@@ -60,7 +60,7 @@ int convert_string_charset(char *input_buffer, const char *input_charset, size_t
</span> int local_invalid_count=0;
int i, too_big=0, iconv_failed=0, retval=0;
char output_charset_ignore[50];
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(output_charset==NULL) {
return ENOOUTPUTCS;
}
<span style="color: #aaaaaa">@@ -76,7 +76,7 @@ int convert_string_charset(char *input_buffer, const char *input_charset, size_t
</span> /* if(input_length<1) {
return EZEROLENTGHINPUT;
}*/ //thinking about it this isn't really an error. if you do this you will still get a null string back in your chosen encoding.
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if( strcmp(output_charset,"LOCAL")==0 ) {
if(local_charset!=NULL) {
output_charset = local_charset;
<span style="color: #aaaaaa">@@ -89,12 +89,12 @@ int convert_string_charset(char *input_buffer, const char *input_charset, size_t
</span> output_charset = output_charset_ignore;
snprintf(output_charset_ignore, 50, "%s//TRANSLIT", local_charset);
output_charset_ignore[49]='\0';
-
<span style="color: #000000;background-color: #ddffdd">+
</span> } else {
output_charset = null_string;
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if( strcmp(input_charset,"LOCAL")==0 ) {
if(local_charset!=NULL) {
input_charset = local_charset;
<span style="color: #aaaaaa">@@ -128,7 +128,7 @@ int convert_string_charset(char *input_buffer, const char *input_charset, size_t
</span> iconv_close(conversion_descriptor);
return EOUTPUTBUFFMUCHTOOSHORT;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* if the caller specified a invalid char substitute string convert that to the output format */
if(substitute!=NULL) {
output_bytes_left = sizeof(char) * strlen(substitute) * converted_null_length;
<span style="color: #aaaaaa">@@ -151,7 +151,7 @@ int convert_string_charset(char *input_buffer, const char *input_charset, size_t
</span> converted_substitute_length = (size_t)(output_ptr - converted_substitute);
}
iconv_close(conversion_descriptor);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* open an iconv convertor for the main conversion */
conversion_descriptor = iconv_open(output_charset, input_charset);
if(conversion_descriptor == (iconv_t)-1) {
<span style="color: #aaaaaa">@@ -163,13 +163,13 @@ int convert_string_charset(char *input_buffer, const char *input_charset, size_t
</span> return EOPENCONVERTFAILED;
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> input_ptr = input_buffer;
output_ptr = output_buffer;
input_bytes_left = input_length;
/* we tell iconv the buffer is shorter than it really is so we always have space to put a null on the end of it */
output_bytes_left = output_buffer_length - converted_null_length;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> while(input_bytes_left > 0) {
nconv = iconv(conversion_descriptor,
(char **)&input_ptr, &input_bytes_left,
<span style="color: #aaaaaa">@@ -187,12 +187,12 @@ int convert_string_charset(char *input_buffer, const char *input_charset, size_t
</span> output_ptr[0]=converted_substitute[i];
output_ptr++;
output_bytes_left--;
- }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> } else {
too_big=1;
}
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> } else if (errno == E2BIG) {
/* this happens if the output buffer if not big enough, we truncate to this point but warn the caller */
too_big=1;
<span style="color: #aaaaaa">@@ -204,7 +204,7 @@ int convert_string_charset(char *input_buffer, const char *input_charset, size_t
</span> iconv_failed=1;
not_conv_count=input_bytes_left;
input_bytes_left=0;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> }
errno=0;
}
<span style="color: #aaaaaa">@@ -225,19 +225,19 @@ int convert_string_charset(char *input_buffer, const char *input_charset, size_t
</span> if(too_big) {
retval += WOUTPUTTOOSHORT;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(unconverted_bytes!=NULL) {
*unconverted_bytes=not_conv_count;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(iconv_failed) {
retval += WICONVFAIL;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(output_bytes_used!=NULL) {
*output_bytes_used = output_buffer_length - output_bytes_left;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if(irreversible_count!=NULL) {
if(retval==0) {
*irreversible_count=nconv;
<span style="color: #aaaaaa">@@ -248,7 +248,7 @@ int convert_string_charset(char *input_buffer, const char *input_charset, size_t
</span>
free(converted_substitute);
iconv_close(conversion_descriptor);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> return retval;
}
<span style="color: #aaaaaa">@@ -257,13 +257,13 @@ int utf8_cleanup(char *buff)
</span> // useful after various dirty things (snprintf/gags etc.) might have been employed.
char *buffcpy;
int conversion_result=-1;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> buffcpy=malloc(strlen(buff)+1);
if(buffcpy!=NULL)
{
strcpy(buffcpy, buff);
conversion_result=convert_string_charset(buffcpy, "UTF-8", strlen(buffcpy), buff, "UTF-8", strlen(buff)+1, NULL, NULL, NULL, NULL, NULL);
- free(buffcpy);
<span style="color: #000000;background-color: #ddffdd">+ free(buffcpy);
</span> }
return conversion_result;
}
</code></pre>
<br>
</li>
<li id='diff-35'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-35'>
<strong>
src/ipc.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/ipc.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/ipc.c
</span><span style="color: #aaaaaa">@@ -11,7 +11,7 @@
</span> #include "bb.h"
/* client mode uses this as its connection */
-ipc_connection_t * ipcsock = NULL;
<span style="color: #000000;background-color: #ddffdd">+ipc_connection_t * ipcsock = NULL;
</span> char *ipc_parent = NULL;
extern int32_t userposn;
<span style="color: #aaaaaa">@@ -34,7 +34,7 @@ void ipc_connect(const char *target)
</span> {
const char * host = target;
- if (ipcsock == NULL)
<span style="color: #000000;background-color: #ddffdd">+ if (ipcsock == NULL)
</span> ipcsock = ipcconn_create();
if (target == NULL) host = ipc_parent;
<span style="color: #aaaaaa">@@ -138,7 +138,7 @@ unsigned int ipc_send_to_username(const char * dest, enum ipc_types msgtype, con
</span> ipcmsg_append(msg, buff, dgram_len);
ipcmsg_send(msg, ipcsock);
} else {
- fprintf(stderr, "Failed to utf8_cleanup the message\n");
<span style="color: #000000;background-color: #ddffdd">+ fprintf(stderr, "Failed to utf8_cleanup the message\n");
</span> }
return ret;
}
<span style="color: #aaaaaa">@@ -154,7 +154,7 @@ unsigned int ipc_send_to_all(enum ipc_types msgtype, const char * data) {
</span> }
-/*
<span style="color: #000000;background-color: #ddffdd">+/*
</span> * most of the mw code should use this to send a message object
* fourcc and destination will control what happens when it
* gets to the server
</code></pre>
<br>
</li>
<li id='diff-36'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-36'>
<strong>
src/list.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/list.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/list.h
</span><span style="color: #aaaaaa">@@ -25,7 +25,7 @@ struct list_head {
</span> } while (0)
/*
<span style="color: #000000;background-color: #ffdddd">- * Insert a new entry between two known consecutive entries.
</span><span style="color: #000000;background-color: #ddffdd">+ * Insert a new entry between two known consecutive entries.
</span> *
* This is only for internal list manipulation where we know
* the prev/next entries already!
<span style="color: #aaaaaa">@@ -98,7 +98,7 @@ static inline void list_del(struct list_head *entry)
</span> static inline void list_del_init(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
- INIT_LIST_HEAD(entry);
<span style="color: #000000;background-color: #ddffdd">+ INIT_LIST_HEAD(entry);
</span> }
/**
<span style="color: #aaaaaa">@@ -202,7 +202,7 @@ static inline void list_splice_init(struct list_head *list,
</span> #define list_for_each_prev(pos, head) \
for (pos = (head)->prev; pos != (head); \
pos = pos->prev)
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> /**
* list_for_each_safe - iterate over a list safe against removal of list entry
* @pos: the &struct list_head to use as a loop counter.
</code></pre>
<br>
</li>
<li id='diff-37'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-37'>
<strong>
src/perms.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/perms.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/perms.c
</span><span style="color: #aaaaaa">@@ -130,7 +130,7 @@ char mesg_stats(char *string, char mstat)
</span> else if (mode==1) return(mstat&(~p));
else return(p);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> char folder_stats(char *string, char st)
{
int mode=0;
<span style="color: #aaaaaa">@@ -180,7 +180,7 @@ char folder_groups(const char *string, char st)
</span> else if (mode==-1) return(st|p);
else if (mode==1) return(st&~p);
return(p);
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
static void show_stats(unsigned char st, char *tmp, size_t tmpsize, const char *map, int flag)
{
<span style="color: #aaaaaa">@@ -204,7 +204,7 @@ void show_user_stats(unsigned char ustat, char *tmp, int flag)
</span> void show_mesg_stats(unsigned char mstat, char *tmp, int flag)
{
int i=0;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (mstat&(1<<0)) tmp[i++]='m'; else if (flag) tmp[i++]='-';
if (mstat&(1<<1)) tmp[i++]='d'; else if (flag) tmp[i++]='-';
if (mstat&(1<<2)) tmp[i++]='r'; else if (flag) tmp[i++]='-';
<span style="color: #aaaaaa">@@ -216,7 +216,7 @@ void show_fold_stats(char st, char *tmp, int flag)
</span> {
show_stats(st, tmp, MWFOLDR_SIZE, folder_stat_chars, flag);
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span> void show_fold_groups(char st, char *tmp, int flag)
{
int pos = 0;
</code></pre>
<br>
</li>
<li id='diff-38'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-38'>
<strong>
src/server/mwserv.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/server/mwserv.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/server/mwserv.c
</span><span style="color: #aaaaaa">@@ -17,7 +17,7 @@ int internet = 0;
</span> int userposn = 0;
#define MWUSER "mw"
-
<span style="color: #000000;background-color: #ddffdd">+
</span> time_t uptime = 0;
struct servopts {
</code></pre>
<br>
</li>
<li id='diff-39'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-39'>
<strong>
src/server/replay.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/server/replay.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/server/replay.c
</span><span style="color: #aaaaaa">@@ -56,12 +56,12 @@ void store_message(ipc_message_t *msg)
</span> }
/* only store info/message, not actions */
- if (msg->head.type <= 26 &&
<span style="color: #000000;background-color: #ddffdd">+ if (msg->head.type <= 26 &&
</span> !( msg->head.type == IPC_TEXT || msg->head.type == IPC_WIZ))
return;
if (store_len >= STORE_SIZE) {
- /* store is full, discard oldest,
<span style="color: #000000;background-color: #ddffdd">+ /* store is full, discard oldest,
</span> * it will have wrapped, so store_next is the last one */
ipcmsg_destroy(store[store_next]);
store_len--;
<span style="color: #aaaaaa">@@ -115,7 +115,7 @@ void replay(ipc_connection_t *conn, ipc_message_t *msg)
</span> int64_t want = json_getint(cmd, "since");
while (idx != store_next) {
/* list will be in date order */
- if (store[idx]!=NULL &&
<span style="color: #000000;background-color: #ddffdd">+ if (store[idx]!=NULL &&
</span> store[idx]->head.when >= want) break;
idx = store_wrap(idx+1);
}
</code></pre>
<br>
</li>
<li id='diff-40'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-40'>
<strong>
src/server/servsock.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/server/servsock.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/server/servsock.c
</span><span style="color: #aaaaaa">@@ -234,7 +234,7 @@ void write_socket(ipc_connection_t * conn)
</span> }
extern time_t uptime;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> void send_error(ipc_connection_t *conn, ipc_message_t *orig, const char *format, ...) __attribute__((format (printf, 3, 4)));
void send_error(ipc_connection_t *conn, ipc_message_t *orig, const char *format, ...)
<span style="color: #aaaaaa">@@ -368,7 +368,7 @@ void process_msg(ipc_connection_t *conn, ipc_message_t *msg)
</span> json_t * j = json_init(msg);
const char * target = json_getstring(j, "target");
if (msg_attach_to_username(msg, target) < 1) {
- send_error(conn, msg, "User '%s' not found", target);
<span style="color: #000000;background-color: #ddffdd">+ send_error(conn, msg, "User '%s' not found", target);
</span> }
json_decref(j);
ipcmsg_destroy(msg);
<span style="color: #aaaaaa">@@ -550,7 +550,7 @@ void msg_attach(ipc_message_t *msg, ipc_connection_t *conn)
</span> }
}
-/* test if the user is gagged and apply the filter
<span style="color: #000000;background-color: #ddffdd">+/* test if the user is gagged and apply the filter
</span> * from - who sent it (to see if they are gagged)
* msg - the message to filter
* field - name of json field containing text to filter
</code></pre>
<br>
</li>
<li id='diff-41'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-41'>
<strong>
src/socket.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/socket.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/socket.c
</span><span style="color: #aaaaaa">@@ -80,9 +80,9 @@ void ipcmsg_send(ipc_message_t *msg, ipc_connection_t *conn)
</span> struct iovec iov[2];
int iovused = 0;
- if (conn == NULL) {
- //ipcmsg_summary("NO CONN", msg);
- return;
<span style="color: #000000;background-color: #ddffdd">+ if (conn == NULL) {
+ //ipcmsg_summary("NO CONN", msg);
+ return;
</span> }
if (msg == NULL) { msg_queue(msg, conn); return; }
if (conn->fd == -1) { msg_queue(msg, conn); return; }
<span style="color: #aaaaaa">@@ -181,7 +181,7 @@ int ipcconn_connect(const char * target)
</span> }
-/**
<span style="color: #000000;background-color: #ddffdd">+/**
</span> * read=1
* We got an okay to read from this socket/connection
* make one read and see what we can do with it
</code></pre>
<br>
</li>
<li id='diff-42'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-42'>
<strong>
src/socket.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/socket.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/socket.h
</span><span style="color: #aaaaaa">@@ -7,8 +7,8 @@
</span>
#define IPCPORT_DEFAULT 9999
-/* which userposn is the System user,
<span style="color: #000000;background-color: #ffdddd">- * 0 is possible but 1 is an impossible location
</span><span style="color: #000000;background-color: #ddffdd">+/* which userposn is the System user,
+ * 0 is possible but 1 is an impossible location
</span> */
#define SYSTEM_USER 1
</code></pre>
<br>
</li>
<li id='diff-43'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-43'>
<strong>
src/special.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/special.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/special.c
</span><span style="color: #aaaaaa">@@ -21,7 +21,7 @@ unsigned short set_special(const char *string, unsigned short st)
</span> case '+': mode=-1;break;
case '-': mode=1;break;
case 'C': p=p|(1<<0);break; /* cannot use tell */
- case 'S': p=p|(1<<1);break; /* su toggle */
<span style="color: #000000;background-color: #ddffdd">+ case 'S': p=p|(1<<1);break; /* su toggle */
</span> case 'W': p=p|(1<<2);break; /* wiz enabled */
case 'n': p=p|(1<<3);break; /* wizchat off */
case 'T': p=p|(1<<4);break; /* setable timeout */
</code></pre>
<br>
</li>
<li id='diff-44'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-44'>
<strong>
src/special.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/special.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/special.h
</span><span style="color: #aaaaaa">@@ -54,5 +54,5 @@ enum {
</span> #define s_devel(stat) (stat & (1<<MWSPCL_DEVEL))
#define s_fixedcontact(stat) (stat & (1<<MWSPCL_FIXEDCONTACT))
#define s_nolinewrap(stat) (stat & (1<<MWSPCL_NOWRAP))
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> #endif /* SPECIAL_H */
</code></pre>
<br>
</li>
<li id='diff-45'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-45'>
<strong>
src/str_util.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/str_util.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/str_util.c
</span><span style="color: #aaaaaa">@@ -44,7 +44,7 @@ void strip_str(char *string)
</span> char *array;
int i,ptr=0;
int len;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> len=strlen(string);
array=(char *)malloc(len+1);
for (i=0;i<len;i++)
<span style="color: #aaaaaa">@@ -78,7 +78,7 @@ void string_add(char **str, const char *fmt, ...)
</span> va_start(va, fmt);
vasprintf(&text, fmt, va);
va_end(va);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (*str == NULL)
{
/* was an empty string, give it this one */
<span style="color: #aaaaaa">@@ -188,7 +188,7 @@ char *strip_colours(const char *text)
</span> k=0;
//utf8 safe way to skip the next two chars
//we only need this in case someone is mean enough to try using something like
- // [ESC]r£ as a colour sequence which would previously have us remove the first
<span style="color: #000000;background-color: #ddffdd">+ // [ESC]r£ as a colour sequence which would previously have us remove the first
</span> // byte of the utf8 sequence leaving us with an invalid char.
while(i<len && k<2)
{
</code></pre>
<br>
</li>
<li id='diff-46'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-46'>
<strong>
src/talker_privs.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/talker_privs.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/talker_privs.c
</span><span style="color: #aaaaaa">@@ -6,9 +6,9 @@
</span> /* chatmode flags, as in currently active modes */
unsigned long cm_flags(unsigned long cm, unsigned long flags, int mode)
{
- if (mode==CM_MODE_CLEAR) return( cm & (~flags) );
<span style="color: #000000;background-color: #ddffdd">+ if (mode==CM_MODE_CLEAR) return( cm & (~flags) );
</span> else
- if (mode==CM_MODE_SET) return(cm | flags);
<span style="color: #000000;background-color: #ddffdd">+ if (mode==CM_MODE_SET) return(cm | flags);
</span> else
if (mode==CM_MODE_ANY) {
return ((cm & flags) > 0);
<span style="color: #aaaaaa">@@ -22,7 +22,7 @@ unsigned long cm_flags(unsigned long cm, unsigned long flags, int mode)
</span> char *display_cmflags(unsigned long cm)
{
static char s[40];
-
<span style="color: #000000;background-color: #ddffdd">+
</span> s[0]=0;
if (cm & CM_ONCHAT) strcat(s,"c");
if (cm & CM_GLOBAL) strcat(s,"o");
<span style="color: #aaaaaa">@@ -43,7 +43,7 @@ char *display_cmflags(unsigned long cm)
</span> void show_chatmodes(unsigned long cm, char *tmp, int flag)
{
int i=0;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (cm & CM_ONCHAT) tmp[i++]='c'; else if (flag) tmp[i++]='-';
if (cm & CM_GLOBAL) tmp[i++]='o'; else if (flag) tmp[i++]='-';
if (cm & CM_PROTECTED) tmp[i++]='p'; else if (flag) tmp[i++]='-';
<span style="color: #aaaaaa">@@ -119,11 +119,11 @@ unsigned long cm_setbycode(unsigned long stat, const char *string)
</span>
unsigned long cp_flags(unsigned long cm, unsigned long flags, int mode)
{
- if (mode==CM_MODE_SET) return( cm | flags );
<span style="color: #000000;background-color: #ddffdd">+ if (mode==CM_MODE_SET) return( cm | flags );
</span> else
- if (mode==CM_MODE_CLEAR) return( cm & (~flags) );
<span style="color: #000000;background-color: #ddffdd">+ if (mode==CM_MODE_CLEAR) return( cm & (~flags) );
</span> else
- if (mode==CM_MODE_ANY) {
<span style="color: #000000;background-color: #ddffdd">+ if (mode==CM_MODE_ANY) {
</span> return ((cm & flags) > 0);
} else
if (mode==CM_MODE_ALL) {
<span style="color: #aaaaaa">@@ -135,7 +135,7 @@ unsigned long cp_flags(unsigned long cm, unsigned long flags, int mode)
</span> char *display_cpflags(unsigned long cm)
{
static char s[40];
-
<span style="color: #000000;background-color: #ddffdd">+
</span> s[0]=0;
if (cm & CP_CANRAW) strcat(s,"R");
if (cm & CP_CANGAG) strcat(s,"G");
</code></pre>
<br>
</li>
<li id='diff-47'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-47'>
<strong>
src/user.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/user.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/user.c
</span><span style="color: #aaaaaa">@@ -29,12 +29,12 @@ void userdb_write(struct person *record, int32_t *userposn)
</span> }
void fetch_user(struct person *record, int32_t userposn)
-{
<span style="color: #000000;background-color: #ddffdd">+{
</span> int outfile;
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> outfile=userdb_open(O_RDWR|O_CREAT);
lseek(outfile,userposn,0);
read(outfile,record,sizeof(*record));
close(outfile);
-}
<span style="color: #000000;background-color: #ddffdd">+}
</span>
</code></pre>
<br>
</li>
<li id='diff-48'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-48'>
<strong>
src/user.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/user.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/user.h
</span><span style="color: #aaaaaa">@@ -11,12 +11,12 @@
</span> #define CONTACTSIZE 60 /* contact address */
#define DOINGSIZE 79 /* 'doing' user record field */
-struct person
<span style="color: #000000;background-color: #ddffdd">+struct person
</span> {
char name[NAMESIZE+1];
char passwd[PASSWDSIZE+1];
uint16_t pad0;
- int32_t lastlogout;
<span style="color: #000000;background-color: #ddffdd">+ int32_t lastlogout;
</span> int32_t folders[2]; /* which folders are subscribed to */
#define SETALLLONG 0xFFFFFFFF
/* person.status
</code></pre>
<br>
</li>
<li id='diff-49'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-49'>
<strong>
src/utils/clean_users.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/utils/clean_users.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/utils/clean_users.c
</span><span style="color: #aaaaaa">@@ -2,7 +2,7 @@
</span> #include <fcntl.h>
#include "../bb.h"
int internet=0;
-struct person user;
<span style="color: #000000;background-color: #ddffdd">+struct person user;
</span>
main()
{
<span style="color: #aaaaaa">@@ -11,7 +11,7 @@ main()
</span> int newfile,oldfile;
char buff[20];
long tt=0l;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> sprintf(oldpath,"%s/%s",HOMEPATH,USERFILE);
sprintf(newpath,"%s.new",oldpath);
</code></pre>
<br>
</li>
<li id='diff-50'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-50'>
<strong>
src/utils/del_user.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/utils/del_user.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/utils/del_user.c
</span><span style="color: #aaaaaa">@@ -9,14 +9,14 @@
</span> #include <perms.h>
int internet=0;
-struct person user;
<span style="color: #000000;background-color: #ddffdd">+struct person user;
</span>
int main(void)
{
const char *newpath = USERFILE ".new";
int newfile,oldfile;
long tt=0l;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if ((oldfile=open(USERFILE,O_RDONLY))<0)
{
perror(USERFILE);
</code></pre>
<br>
</li>
<li id='diff-51'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-51'>
<strong>
src/utils/fixuser.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/utils/fixuser.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/utils/fixuser.c
</span><span style="color: #aaaaaa">@@ -31,7 +31,7 @@ int main(void)
</span> write(ff2, &user, sizeof(user));
count++;
if (!strcasecmp(user.name, "dot")) {
- close(ff2);
<span style="color: #000000;background-color: #ddffdd">+ close(ff2);
</span> close(ff);
exit(1);
}
</code></pre>
<br>
</li>
<li id='diff-52'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-52'>
<strong>
src/utils/sizes.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/utils/sizes.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/utils/sizes.c
</span><span style="color: #aaaaaa">@@ -9,7 +9,7 @@
</span> #include "files.h"
#include "folders.h"
-static void addmap(char *map, const char *name, char key,
<span style="color: #000000;background-color: #ddffdd">+static void addmap(char *map, const char *name, char key,
</span> unsigned long size, void * offset, void * base)
{
int i;
<span style="color: #aaaaaa">@@ -24,7 +24,7 @@ static void showmap(const char *map, unsigned long size)
</span> int i;
printf("memmap: ");
for (i=0;i<size;i++) {
- if (map[i]==0)
<span style="color: #000000;background-color: #ddffdd">+ if (map[i]==0)
</span> printf(".");
else
printf("%c", map[i]);
</code></pre>
<br>
</li>
<li id='diff-53'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-53'>
<strong>
src/webclient/comms.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/webclient/comms.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/webclient/comms.c
</span><span style="color: #aaaaaa">@@ -138,7 +138,7 @@ static void accept_pipe_cmd(ipc_message_t *ipc, struct person *mesg_user)
</span> whoinfo = strdup(ipc->body);
whowhen = time(NULL);
/* if we want it, fall through, otherwise stop now */
- if (whowant != 0)
<span style="color: #000000;background-color: #ddffdd">+ if (whowant != 0)
</span> whowant=0;
else
return;
<span style="color: #aaaaaa">@@ -274,7 +274,7 @@ int mainloop(int millis)
</span> fwrite(buf, strlen(buf), 1, stderr);
}
if (die) return -1; else
<span style="color: #000000;background-color: #ffdddd">- if (nfds < 0) return nfds; else
</span><span style="color: #000000;background-color: #ddffdd">+ if (nfds < 0) return nfds; else
</span> return 0;
}
<span style="color: #aaaaaa">@@ -412,7 +412,7 @@ static int handle_command(CONNECTION *co)
</span> }else{
user->room = newroom;
snprintf(line, sizeof line, "\03313%s has left to room %d", user->name, newroom);
- talk_send_to_room(line, oldroom, "raw", -1);
<span style="color: #000000;background-color: #ddffdd">+ talk_send_to_room(line, oldroom, "raw", -1);
</span> snprintf(line, sizeof line, "\03314Leaving room %d for room %d",oldroom,newroom);
ipc_send_to_username(user->name,IPC_TEXT,line);
snprintf(line, sizeof line, "\03312%s has just arrived in room %d", user->name, user->room);
<span style="color: #aaaaaa">@@ -444,7 +444,7 @@ static int handle_command(CONNECTION *co)
</span> snprintf(buff, sizeof buff, "{\"status\":\"sayto sent to %s (%s)\"}", duser, msg);
send(co->fd, buff, strlen(buff), 0);
user->idletime = lastcomm;
<span style="color: #000000;background-color: #ffdddd">- return 1;
</span><span style="color: #000000;background-color: #ddffdd">+ return 1;
</span> }else
if (co->authd && strncasecmp(buff, "emote ", 6)==0) {
talk_send_to_room(&buff[6], user->room, "emote", 0);
<span style="color: #aaaaaa">@@ -469,7 +469,7 @@ static int handle_command(CONNECTION *co)
</span> }else
if (co->authd && strcasecmp(buff, "who")==0) {
const char *line = fetch_who(0);
- if (line != NULL)
<span style="color: #000000;background-color: #ddffdd">+ if (line != NULL)
</span> send(co->fd, line, strlen(line), 0);
return 1;
}else
<span style="color: #aaaaaa">@@ -611,7 +611,7 @@ void mwlog(const char *fmt, ...)
</span> time_t t;
va_start(ap, fmt);
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if ((file=open(LOGFILE,O_WRONLY|O_CREAT|O_APPEND,0600))<0)
{
perror("log");
<span style="color: #aaaaaa">@@ -638,7 +638,7 @@ int32_t who_find(const char *username)
</span> json_error_t err;
json_t *wlist = json_loads(whoinfo, 0, &err);
if (wlist == NULL) return -1;
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> size_t wi;
json_t *entry;
json_array_foreach(wlist, wi, entry) {
</code></pre>
<br>
</li>
<li id='diff-54'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-54'>
<strong>
src/webclient/import.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/webclient/import.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/webclient/import.c
</span><span style="color: #aaaaaa">@@ -50,17 +50,17 @@ void update_user(struct person *record, int32_t userposn)
</span>
/* chatmode flags, as in currently active modes */
unsigned long cm_flags(unsigned long cm, unsigned long flags, int mode)
-{
<span style="color: #000000;background-color: #ddffdd">+{
</span> if (mode==CM_MODE_CLEAR) return( cm & (~flags) );
<span style="color: #000000;background-color: #ffdddd">- else
</span><span style="color: #000000;background-color: #ddffdd">+ else
</span> if (mode==CM_MODE_SET) return(cm | flags);
<span style="color: #000000;background-color: #ffdddd">- else
</span><span style="color: #000000;background-color: #ddffdd">+ else
</span> if (mode==CM_MODE_ANY) {
if ((cm&flags)>0) return(true); else return(false);
<span style="color: #000000;background-color: #ffdddd">- } else
</span><span style="color: #000000;background-color: #ddffdd">+ } else
</span> if (mode==CM_MODE_ALL) {
if ((cm&flags)==flags) return(true); else return(false);
<span style="color: #000000;background-color: #ffdddd">- }
</span><span style="color: #000000;background-color: #ddffdd">+ }
</span> return(0);
}
</code></pre>
<br>
</li>
<li id='diff-55'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-55'>
<strong>
src/webclient/list.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/webclient/list.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/webclient/list.h
</span><span style="color: #aaaaaa">@@ -1,8 +1,8 @@
</span> #ifndef __LIST_H
#define __LIST_H
-/* This file is from Linux Kernel (include/linux/list.h)
<span style="color: #000000;background-color: #ffdddd">- * and modified by simply removing hardware prefetching of list items.
</span><span style="color: #000000;background-color: #ddffdd">+/* This file is from Linux Kernel (include/linux/list.h)
+ * and modified by simply removing hardware prefetching of list items.
</span> * Here by copyright, credits attributed to wherever they belong.
* Kulesh Shanmugasundaram (kulesh [squiggly] isis.poly.edu)
*/
<span style="color: #aaaaaa">@@ -31,7 +31,7 @@ struct list_head {
</span> } while (0)
/*
<span style="color: #000000;background-color: #ffdddd">- * Insert a new entry between two known consecutive entries.
</span><span style="color: #000000;background-color: #ddffdd">+ * Insert a new entry between two known consecutive entries.
</span> *
* This is only for internal list manipulation where we know
* the prev/next entries already!
<span style="color: #aaaaaa">@@ -104,7 +104,7 @@ static inline void list_del(struct list_head *entry)
</span> static inline void list_del_init(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
- INIT_LIST_HEAD(entry);
<span style="color: #000000;background-color: #ddffdd">+ INIT_LIST_HEAD(entry);
</span> }
/**
<span style="color: #aaaaaa">@@ -205,7 +205,7 @@ static inline void list_splice_init(struct list_head *list,
</span> #define list_for_each_prev(pos, head) \
for (pos = (head)->prev; pos != (head); \
pos = pos->prev)
<span style="color: #000000;background-color: #ffdddd">-
</span><span style="color: #000000;background-color: #ddffdd">+
</span> /**
* list_for_each_safe - iterate over a list safe against removal of list entry
* @pos: the &struct list_head to use as a loop counter.
</code></pre>
<br>
</li>
<li id='diff-56'>
<a href='https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01#diff-56'>
<strong>
src/webclient/mwpoll.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/webclient/mwpoll.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/webclient/mwpoll.c
</span><span style="color: #aaaaaa">@@ -37,7 +37,7 @@ static int mydaemon(void)
</span> if (pid != 0) {
return pid;
} else {
- /* why is this needed ?
<span style="color: #000000;background-color: #ddffdd">+ /* why is this needed ?
</span> if (seteuid(110)) {
printf("seteuid failed. %s\n", strerror(errno));
exit(0);
<span style="color: #aaaaaa">@@ -50,7 +50,7 @@ static int mydaemon(void)
</span> }
return 0;
}
-
<span style="color: #000000;background-color: #ddffdd">+
</span>
static void usage(const char *name)
{
<span style="color: #aaaaaa">@@ -104,7 +104,7 @@ int main(int argc, char ** argv)
</span>
/* read the password / session string */
- {
<span style="color: #000000;background-color: #ddffdd">+ {
</span> char *p;
if (fgets(passwd, sizeof passwd, stdin) == NULL) {
printf("Expected password\n");
<span style="color: #aaaaaa">@@ -216,7 +216,7 @@ int main(int argc, char ** argv)
</span> hostname = "localhost";
ipc_connect(hostname);
open_command_socket();
-
<span style="color: #000000;background-color: #ddffdd">+
</span> if (user->status&(1<<3)) {
ipc_close();
close_cmd();
<span style="color: #aaaaaa">@@ -224,7 +224,7 @@ int main(int argc, char ** argv)
</span> }
loggedin = lastcomm = loggedin;
-
<span style="color: #000000;background-color: #ddffdd">+
</span> /* spock, announce us please... */
//broadcast_onoffcode(3, 0, user->name, NULL);
talk_rawbcast("\03310%s has just joined web talker room %d", user->name, user->room);
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01">View it on GitLab</a>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://projects.sucs.org/arthur/mw/commit/0513f99657d31d7b60821ab3e85cbc2177393e01"}}</script>
</p>
</div>
</body>
</html>