Skip to content
Snippets Groups Projects
Commit ca8c3311 authored by deuce's avatar deuce
Browse files

Lets call this "1/3rd done" now... all the text file editing viewing works,

the restart/stop semaphores are touched.  Various impossible menu options
have been removed (toggle sysop avilability etc).

Still to do:
The File menu is functionless.
On the BBS menu, only about half of the stuff works.
User->List doesn't work
Help menu is funtionless
parent 342cd361
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,11 @@
#include "gtkmonitor.h"
#include "util_funcs.h"
void update_stats_callback(GtkWidget *wiggy, gpointer data)
{
refresh_data(NULL);
}
void on_guru_brain1_activate(GtkWidget *wiggy, gpointer data) {
edit_text_file(cfg.ctrl_dir,"guru.dat");
}
......@@ -104,7 +109,11 @@ void on_login_message1_activate(GtkWidget *wiggy, gpointer data)
{
edit_text_file(cfg.text_dir,"ftplogin.txt");
}
#warning Missing ftpbadlogin.txt
void on_failed_login_mesage1_activate(GtkWidget *wiggy, gpointer data)
{
edit_text_file(cfg.text_dir,"ftpbadlogin.txt");
}
void on_hello_message1_activate(GtkWidget *wiggy, gpointer data)
{
......@@ -146,7 +155,11 @@ void on_error_log1_activate(GtkWidget *wiggy, gpointer data)
view_text_file(cfg.logs_dir,"error.log");
}
#warning Remove BBS stats form thinger.
void on_statistics_log1_activate(GtkWidget *wiggy, gpointer data)
{
view_stdout(cfg.exec_dir,"slog");
}
void on_todays_log1_activate(GtkWidget *wiggy, gpointer data)
{
time_t t;
......@@ -181,64 +194,6 @@ void on_spam_log1_activate(GtkWidget *wiggy, gpointer data)
view_text_file(cfg.logs_dir,"spam.log");
}
void on_todays_log2_activate(GtkWidget *wiggy, gpointer data)
{
time_t t;
struct tm *tm;
char fn[20];
t=time(NULL);
tm=localtime(&t);
sprintf(fn,"logs/ms%02d%02d%02d.log",tm->tm_mon+1,tm->tm_mday,tm->tm_year%100);
view_text_file(cfg.logs_dir,fn);
}
void on_yesterdays_log2_activate(GtkWidget *wiggy, gpointer data)
{
time_t t;
struct tm *tm;
char fn[20];
t=time(NULL);
t-=24*60*60;
tm=localtime(&t);
sprintf(fn,"logs/ms%02d%02d%02d.log",tm->tm_mon+1,tm->tm_mday,tm->tm_year%100);
view_text_file(cfg.logs_dir,fn);
}
void on_another_days_log2_activate(GtkWidget *wiggy, gpointer data) {
/* ToDo */
}
void on_todays_log3_activate(GtkWidget *wiggy, gpointer data)
{
time_t t;
struct tm *tm;
char fn[20];
t=time(NULL);
tm=localtime(&t);
sprintf(fn,"logs/fs%02d%02d%02d.log",tm->tm_mon+1,tm->tm_mday,tm->tm_year%100);
view_text_file(cfg.logs_dir,fn);
}
void on_yesterdays_log3_activate(GtkWidget *wiggy, gpointer data)
{
time_t t;
struct tm *tm;
char fn[20];
t=time(NULL);
t-=24*60*60;
tm=localtime(&t);
sprintf(fn,"logs/fs%02d%02d%02d.log",tm->tm_mon+1,tm->tm_mday,tm->tm_year%100);
view_text_file(cfg.logs_dir,fn);
}
void on_another_days_log3_activate(GtkWidget *wiggy, gpointer data) {
/* ToDo */
}
void on_ip_address_filter1_activate(GtkWidget *wiggy, gpointer data)
{
edit_text_file(cfg.text_dir,"ip.can");
......@@ -314,3 +269,115 @@ void on_twit_list1_activate(GtkWidget *wiggy, gpointer data)
edit_text_file(cfg.ctrl_dir,"twitlist.cfg");
}
void on_hack_attempt_log1_activate(GtkWidget *wiggy, gpointer data)
{
view_text_file(cfg.logs_dir,"hack.log");
}
void on_configure1_activate(GtkWidget *wiggy, gpointer data)
{
run_external(cfg.exec_dir,"scfg");
}
void on_edit3_activate(GtkWidget *wiggy, gpointer data)
{
run_external(cfg.exec_dir,"gtkuseredit");
}
void on_truncate_deleted_users1_activate(GtkWidget *wiggy, gpointer data)
{
int usernumber;
int deleted=0;
user_t user;
char str[128];
while((user.number=lastuser(&cfg))!=0) {
if(getuserdat(&cfg,&user)!=0)
break;
if(!(user.misc&DELETED))
break;
if(!del_lastuser(&cfg))
break;
deleted++;
}
sprintf(str,"%u Deleted User Records Removed",deleted);
display_message("Users Truncated", str);
}
void on_stop6_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "shutdown");
}
void on_recycle6_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "recycle");
}
void on_stop1_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "shutdown.telnet");
}
void on_recycle5_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "recycle.telnet");
}
void on_stop2_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "shutdown.mail");
}
void on_recycle1_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "recycle.mail");
}
void on_stop3_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "shutdown.ftp");
}
void on_recycle2_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "recycle.ftp");
}
void on_stop4_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "shutdown.web");
}
void on_recycle3_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "recycle.web");
}
void on_stop5_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "shutdown.services");
}
void on_recycle4_activate(GtkWidget *wiggy, gpointer data)
{
touch_sem(cfg.ctrl_dir, "recycle.services");
}
void on_statistics_pane1_activate(GtkWidget *wiggy, gpointer data)
{
GtkWidget *w;
w=glade_xml_get_widget(xml, "StatisticsPane");
if(w==NULL)
fprintf(stderr,"Cannot get the statistics pane.\n");
else {
switch(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(wiggy))) {
case 0:
gtk_widget_hide(w);
break;
default:
gtk_widget_show(w);
}
}
}
......@@ -3,6 +3,8 @@
#include <gtk/gtk.h>
void update_stats_callback(GtkWidget *wiggy, gpointer data);
void on_guru_brain1_activate(GtkWidget *wiggy, gpointer data);
void on_text_strings1_activate(GtkWidget *wiggy, gpointer data);
void on_default_colours1_activate(GtkWidget *wiggy, gpointer data);
......
......@@ -30,6 +30,34 @@ int refresh_data(gpointer data)
return(-1);
}
/* Update timed events */
#if 0
w=glade_xml_get_widget(xml, "force_timed_event1");
if(w==NULL)
fprintf(stderr,"Cannot get timed event widget\n");
else {
GtkWidget *menu;
menu=gtk_menu_item_get_submenu(w);
if(menu!=NULL) {
GList *evts;
evts = gtk_container_get_children(GTK_CONTAINER(menu));
for(i=0; i<cfg.total_event; i++) {
}
}
else
fprintf(stderr,"Cannot get timed event submenu\n");
}
/* Update network call-outs */
w=glade_xml_get_widget(xml, "force_network_callout1");
if(w==NULL)
fprintf(stderr,"Cannot get network callout widget\n");
else {
}
#endif
/* Update the node list stuff */
w=glade_xml_get_widget(xml, "lNodeList");
......
This diff is collapsed.
#include <stdlib.h>
#include "util_funcs.h"
#include "dirwrap.h"
#include "threadwrap.h"
#include "gtkmonitor.h"
void run_cmdline(void *cmdline)
{
system((char *)cmdline);
}
char *complete_path(char *dest, char *path, char *filename)
{
if(path != NULL) {
strcpy(dest, path);
backslash(dest);
}
else
dest[0]=0;
strcat(dest, filename);
fexistcase(dest); /* Fixes upr/lwr case fname */
return(dest);
}
/* ToDo: This will need to read the command-line from a config file */
void run_external(char *path, char *filename)
{
static char cmdline[MAX_PATH*2];
_beginthread(run_cmdline, 0, complete_path(cmdline,path,filename));
}
/* ToDo: This will need to read the command-line from a config file */
void view_stdout(char *path, char *filename)
{
static char cmdline[MAX_PATH*2];
char p[MAX_PATH+1];
if(path != NULL) {
strcpy(p, path);
backslash(p);
}
else
p[0]=0;
strcat(p, filename);
sprintf(cmdline, "%s | xmessage -file", p);
sprintf(cmdline, "%s | xmessage -file -", complete_path(p,path,filename));
_beginthread(run_cmdline, 0, cmdline);
}
......@@ -31,16 +47,21 @@ void view_text_file(char *path, char *filename)
static char cmdline[MAX_PATH*2];
char p[MAX_PATH+1];
if(path != NULL) {
strcpy(p, path);
backslash(p);
complete_path(p,path,filename);
if(!fexist(p)) {
sprintf(cmdline,"The file %s does not exist.",p);
display_message("File Does Not Exist", cmdline);
}
else {
if(access(p,R_OK)) {
sprintf(cmdline,"Cannot read the file %s... check your permissions.",p);
display_message("Cannot Read File", cmdline);
}
else {
sprintf(cmdline, "xmessage -file %s", p);
_beginthread(run_cmdline, 0, cmdline);
}
}
else
p[0]=0;
strcat(p, filename);
sprintf(cmdline, "xmessage -file %s", p);
_beginthread(run_cmdline, 0, cmdline);
}
/* ToDo: This will need to read the command-line from a config file */
......@@ -49,32 +70,15 @@ void edit_text_file(char *path, char *filename)
static char cmdline[MAX_PATH*2];
char p[MAX_PATH+1];
if(path != NULL) {
strcpy(p, path);
backslash(p);
}
else
p[0]=0;
strcat(p, filename);
sprintf(cmdline, "xedit %s", p);
sprintf(cmdline, "xedit %s", complete_path(p,path,filename));
_beginthread(run_cmdline, 0, cmdline);
}
void touch_sem(char *path, char *filename)
{
static char cmdline[MAX_PATH*2];
char p[MAX_PATH+1];
char fn[MAX_PATH*2];
if(path != NULL) {
strcpy(p, path);
backslash(p);
}
else
p[0]=0;
strcat(p, filename);
ftouch(run_cmdline, 0, cmdline);
ftouch(complete_path(fn,path,filename));
}
/* Assumes a 12 char outstr */
......@@ -152,3 +156,23 @@ char *getnumstr(char *outstr, ulong size) {
return(outstr);
}
void display_message(char *title, char *message)
{
GtkWidget *dialog, *label;
dialog=gtk_dialog_new_with_buttons(title
,GTK_WINDOW(glade_xml_get_widget(xml, "MainWindow"))
,GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT
,GTK_STOCK_OK
,GTK_RESPONSE_NONE
,NULL);
label = gtk_label_new (message);
g_signal_connect_swapped (dialog
,"response"
,G_CALLBACK(gtk_widget_destroy)
,dialog);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox),
label);
gtk_widget_show_all (dialog);
}
#ifndef _UTIL_FUNCS_H_
#define _UTIL_FUNCS_H_
#include "gen_defs.h" /* BOOL */
void run_cmdline(void *cmdline);
void run_external(char *path, char *filename);
void view_stdout(char *path, char *filename);
void view_text_file(char *path, char *filename);
void edit_text_file(char *path, char *filename);
char *getsizestr(char *outstr, long size, BOOL bytes);
char *getnumstr(char *outstr, ulong size);
void touch_sem(char *path, char *filename);
void display_message(char *title, char *message);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment