File: celerity.c

package info (click to toggle)
scrollz 2.1-1.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 6,996 kB
  • sloc: ansic: 78,409; tcl: 2,866; makefile: 682; sh: 508
file content (109 lines) | stat: -rw-r--r-- 2,678 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 *   Celerity C-Script
 *
 *  code:      jeremy roethel [xanth@3sheep.COM]
 *  cosmetics: sasha eysymontt [sage@3Sheep.COM]
 *
 *  $Id: celerity.c,v 1.5 2002-01-23 18:48:10 f Exp $
 */
/*
 * Cstatusbar()		- /set STATUSBAR #
 * Cquickstat()		- /QuickStat command 
 */

#include "defs.h"
#ifdef CELE
#include "irc.h"
#include "ircaux.h"
#include "output.h"
#include "screen.h"
#include "status.h"
#include "myvars.h" 
#include "vars.h"

#undef DEBUG

/* Externalities */
/* handled in include files above */

/* Global Stuff */
void Cstatusbar _((char *,char *,char *));
void Cquickstat _((char *,char *,char *));
extern void Cquick_status _((char *, int));

char *CelerityVersion=" celerity v1.1";
char *CelerityL="\002/cy/\002";

static int Cqstat=0; /* Status of QuickStat: 1=on, 0=off */

/* Internal Stuff */
#define Cstatusnum 2


/******************** Beginning of code section ********************/

/* Change the status bar [/set STATUSBAR] */
void Cstatusbar(command,args,subargs)
char *command;
char *args;
char *subargs;
{
    int n=0;
    u_int old_display;
    char *sbar=(char *) 0;
    char *newbar0;
    char *newbar1;
    char *newbar2;
    char *newbar3;
    char tmpbuf[mybufsize/2];

    sbar=new_next_arg(args,&args);
    if (sbar) n=atoi(sbar);
    if ((n>0) && (n<=Cstatusnum)) {
	if (n==2) {
	    newbar0="%y1 [OperVision] %> %!S ";
	    newbar1="%y1 %T %*%@%y3%N %# %C%+%A %Q %> %M ";
	    newbar2="%y1 %1 %> %S%H%B%I%O%F%W l/%2 ";
	    newbar3="%y1 %U [lj:%3] %> [DCC:s%6:r%5:o%4] ";
	}
	else { 		/* bar 1 is the default */
	    newbar0="%y1 [OperVision] %> %!S ";
	    newbar1="%y1 %T %*%@%y3%N %#%A %Q %> %M %1 ";
	    newbar2="%y1 %C%+ %U %> %S%H%B%I%O%F %W l/%2 ";
	    newbar3="%y1 QuickStat %> [lj:%3] [DCC:s%6:r%5:o%4] ";
	}
	old_display=window_display;
	window_display=0;
	snprintf(tmpbuf,sizeof(tmpbuf),"STATUS_FORMAT %s",newbar0);
	set_variable(NULL,tmpbuf,NULL);
	snprintf(tmpbuf,sizeof(tmpbuf),"STATUS_FORMAT1 %s",newbar1);
	set_variable(NULL,tmpbuf,NULL);
	snprintf(tmpbuf,sizeof(tmpbuf),"STATUS_FORMAT2 %s",newbar2);
	set_variable(NULL,tmpbuf,NULL);
	snprintf(tmpbuf,sizeof(tmpbuf),"STATUS_FORMAT3 %s",newbar3);
	set_variable(NULL,tmpbuf,NULL);
	window_display=old_display;
    }
    else say("Error: Invalid status bar number (1 - %d)",Cstatusnum);
}

void Cquickstat(command,args,subargs)
char *command;
char *args;
char *subargs;
{
    char tmpbuf[mybufsize/16];

    if (Cqstat) {	/* Turn off */
	Cqstat=0;
        strcpy(tmpbuf,"DOUBLE 2");
    }
    else {		/* Turn on */
	Cqstat=1;
        strcpy(tmpbuf,"DOUBLE 3");
    }
    Cquick_status((char *) 0,Cqstat);
    windowcmd(NULL,tmpbuf,NULL);
    update_all_status();
}
#endif