1 | /* |
---|
2 | * |
---|
3 | * Copyright (C) 1989 by the Massachusetts Institute of Technology |
---|
4 | * Developed by the MIT Student Information Processing Board (SIPB). |
---|
5 | * For copying information, see the file mit-copyright.h in this release. |
---|
6 | * |
---|
7 | */ |
---|
8 | /* |
---|
9 | * |
---|
10 | * Status request for DISCUSS |
---|
11 | * |
---|
12 | * $Id: status.c,v 1.17 1999-02-08 14:46:54 danw Exp $ |
---|
13 | * |
---|
14 | */ |
---|
15 | #ifndef lint |
---|
16 | static char rcsid_discuss_c[] = |
---|
17 | "$Id: status.c,v 1.17 1999-02-08 14:46:54 danw Exp $"; |
---|
18 | #endif /* lint */ |
---|
19 | |
---|
20 | #include <stdio.h> |
---|
21 | #include <ctype.h> |
---|
22 | #include <ss/ss.h> |
---|
23 | #include <discuss/discuss.h> |
---|
24 | #include "config.h" |
---|
25 | #include "globals.h" |
---|
26 | #include <string.h> |
---|
27 | |
---|
28 | static int sending_msg; |
---|
29 | static char msg_buf[64]; |
---|
30 | |
---|
31 | static |
---|
32 | add_msg(str) |
---|
33 | char *str; |
---|
34 | { |
---|
35 | if (!sending_msg) |
---|
36 | msg_buf[0] = '\0'; |
---|
37 | else |
---|
38 | strcat(msg_buf, "; "); |
---|
39 | strcat(msg_buf, str); |
---|
40 | sending_msg++; |
---|
41 | } |
---|
42 | |
---|
43 | static |
---|
44 | put_msg() |
---|
45 | { |
---|
46 | if (sending_msg) { |
---|
47 | msg_buf[0] = toupper(msg_buf[0]); |
---|
48 | printf(" (%s.)", msg_buf); |
---|
49 | } |
---|
50 | sending_msg = 0; |
---|
51 | } |
---|
52 | |
---|
53 | status(argc, argv) |
---|
54 | int argc; |
---|
55 | char **argv; |
---|
56 | { |
---|
57 | sending_msg = 0; |
---|
58 | printf("Discuss version %s.\n", dsc_version); |
---|
59 | if (!dsc_public.attending) { |
---|
60 | printf("No current meeting.\n"); |
---|
61 | return; |
---|
62 | } |
---|
63 | |
---|
64 | printf("Attending %s (%s) meeting.", |
---|
65 | dsc_public.m_info.long_name, |
---|
66 | strrchr(dsc_public.m_info.location, '/')+1); |
---|
67 | if (dsc_public.m_info.public_flag) |
---|
68 | add_msg("public"); |
---|
69 | if (acl_is_subset("c", dsc_public.m_info.access_modes)) |
---|
70 | add_msg("you are a chairman"); |
---|
71 | if (!acl_is_subset("w", dsc_public.m_info.access_modes)) { |
---|
72 | if (!acl_is_subset("a", dsc_public.m_info.access_modes)) |
---|
73 | add_msg("read only"); |
---|
74 | else |
---|
75 | add_msg("reply only"); |
---|
76 | } else if (!acl_is_subset("a", dsc_public.m_info.access_modes)) |
---|
77 | add_msg("no replies"); |
---|
78 | put_msg(); |
---|
79 | |
---|
80 | if (dsc_public.current == 0) |
---|
81 | printf("\nNo current transaction selected; %d highest.\n", |
---|
82 | dsc_public.m_info.last); |
---|
83 | else |
---|
84 | printf("\nTransaction %d of %d.\n", dsc_public.current, |
---|
85 | dsc_public.m_info.last); |
---|
86 | } |
---|