Changeset bde7714


Ignore:
Timestamp:
Sep 22, 2002, 3:20:00 PM (22 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
5a6e6b9
Parents:
f9c43ae
Message:
Started updating the intro document
Small changes to help / about
The 'subscribe' and 'unsubscribe' commands (and their aliases)
  update .zephyr.subs by default.  If either is given the '-t'
  (for "temporary") option the .zephyr.subs will not be updated
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rf9c43ae rbde7714  
    1717          instances out for the 'reply' command.
    1818        Added -R/usr/athena/lib to the build for Athena
     19        Started updating the intro document
     20        Small changes to help / about
     21        The 'subscribe' and 'unsubscribe' commands (and their aliases) now
     22          update .zephyr.subs by default.  If either is given the '-t'
     23          (for "temporary") option the .zephyr.subs will not be updated
    1924       
    20251.2.3
  • commands.c

    r42abb10 rbde7714  
    132132  OWLCMD_ARGS("subscribe", owl_command_subscribe, OWL_CTX_ANY,
    133133              "subscribe to a zephyr class, instance, recipient",
    134               "subscribe <class> <instance> [recipient]",
     134              "subscribe [-t] <class> <instance> [recipient]",
    135135              "Subscribe the specified class and instance.  If the recipient\n"
    136136              "is not listed on the command line it defaults\n"
    137               "to * (the wildcard recipient).\n"),
     137              "to * (the wildcard recipient).  If the -t option is present\n"
     138              "the subscription will only be temporary, i.e., it will not\n"
     139              "be written to the subscription file and will therefore not\n"
     140              "be present the next time owl is started.\n"),
    138141  OWLCMD_ALIAS("sub", "subscribe"),
    139142
    140143  OWLCMD_ARGS("unsubscribe", owl_command_unsubscribe, OWL_CTX_ANY,
    141144              "unsubscribe from a zephyr class, instance, recipient",
    142               "unsubscribe <class> <instance> [recipient]",
     145              "unsubscribe [-t] <class> <instance> [recipient]",
    143146              "Unsubscribe from the specified class and instance.  If the\n"
    144147              "recipient is not listed on the command line it defaults\n"
    145               "to * (the wildcard recipient).\n"),
     148              "to * (the wildcard recipient).  If the -t option is present\n"
     149              "the unsubscription will only be temporary, i.e., it will not\n"
     150              "be updated in the subscription file and will therefore not\n"
     151              "be in effect the next time owl is started.\n"),
    146152  OWLCMD_ALIAS("unsub", "unsubscribe"),
    147153
     
    724730}
    725731
    726 char *owl_command_zlist(int argc, char **argv) {
     732char *owl_command_zlist(int argc, char **argv, char *buff) {
    727733  int elapsed=0, timesort=0;
    728734  char *file=NULL;
     
    11311137char *owl_command_subscribe(int argc, char **argv, char *buff) {
    11321138  char *recip="";
    1133 
     1139  int temp=0;
     1140 
    11341141  if (argc<3) {
    11351142    owl_function_makemsg("Not enough arguments to the subscribe command");
    1136     return NULL;
    1137   } else if (argc>4) {
     1143    return(NULL);
     1144  }
     1145  argc--;
     1146  argv++;
     1147
     1148  if (!strcmp(argv[0], "-t")) {
     1149    temp=1;
     1150    argc--;
     1151    argv++;
     1152  }
     1153  if (argc<2) {
     1154    owl_function_makemsg("Not enough arguments to the subscribe command");
     1155    return(NULL);
     1156  }
     1157
     1158  if (argc>3) {
    11381159    owl_function_makemsg("Too many arguments to the subscribe command");
    1139     return NULL;
    1140   }
    1141 
    1142   if (argc==3) {
     1160    return(NULL);
     1161  }
     1162
     1163  if (argc==2) {
    11431164    recip="";
    1144   } else if (argc==4) {
    1145     recip=argv[3];
    1146   }
    1147 
    1148   owl_function_subscribe(argv[1], argv[2], recip);
    1149   return NULL;
     1165  } else if (argc==3) {
     1166    recip=argv[2];
     1167  }
     1168
     1169  owl_function_subscribe(argv[0], argv[1], recip);
     1170  if (!temp) {
     1171    owl_zephyr_addsub(NULL, argv[0], argv[1], recip);
     1172  }
     1173  return(NULL);
    11501174}
    11511175
     
    11531177char *owl_command_unsubscribe(int argc, char **argv, char *buff) {
    11541178  char *recip="";
     1179  int temp=0;
    11551180
    11561181  if (argc<3) {
    11571182    owl_function_makemsg("Not enough arguments to the unsubscribe command");
    1158     return NULL;
    1159   } else if (argc>4) {
     1183    return(NULL);
     1184  }
     1185  argc--;
     1186  argv++;
     1187
     1188  if (!strcmp(argv[0], "-t")) {
     1189    temp=1;
     1190    argc--;
     1191    argv++;
     1192  }
     1193  if (argc<2) {
     1194    owl_function_makemsg("Not enough arguments to the subscribe command");
     1195    return(NULL);
     1196  }
     1197
     1198  if (argc>3) {
    11601199    owl_function_makemsg("Too many arguments to the unsubscribe command");
    1161     return NULL;
    1162   }
    1163 
    1164   if (argc==3) {
     1200    return(NULL);
     1201  }
     1202
     1203  if (argc==2) {
    11651204    recip="";
    1166   } else if (argc==4) {
    1167     recip=argv[3];
    1168   }
    1169 
    1170   owl_function_unsubscribe(argv[1], argv[2], recip);
    1171   return NULL;
     1205  } else if (argc==3) {
     1206    recip=argv[2];
     1207  }
     1208
     1209  owl_function_unsubscribe(argv[0], argv[1], recip);
     1210  if (!temp) {
     1211    owl_zephyr_delsub(NULL, argv[0], argv[1], recip);
     1212  }
     1213  return(NULL);
    11721214}
    11731215
     
    16751717  owl_global_set_needrefresh(&g);
    16761718}
    1677 
  • doc/intro.txt

    r61d27fb rbde7714  
    1 
    2 $Id$
    3 
    4 
    5 Owl is a tty, curses-based zephyr client.  This is a quick guide to
    6 learning how to use it.
    7 
    8 ====================
    9 OVERVIEW OF FEATURES
    10 ====================
    11 o) As a tty client it can be run over telnet, rlogin or text ssh sessions
    12 
    13 o) It uses a perl configuration file for setting preferences and
    14    formatting messages
    15 
    16 o) emacs style editing of messages
    17 
    18 o) It is easy to use and runs without a configfile.
    19 
    20 o) There will future support for AIM and ICQ
    21 
    22 o) There will be future support for advanced sorting of messages
    23 
    24 ===============
    25 GETTING STARTED
    26 ===============
     1                     ========================
     2                     Quick Guide To Using Owl
     3                     ========================
     4
     5=======================
     6Section 1: INTRODUCTION
     7=======================
     8
     9Owl is a tty, curses-based instant messaging client.  This is a quick
     10guide to learning how to use it.  Currently it supports only zephyr,
     11but other messaging protocols, including AIM and Jabber, are on the
     12way.  Some major features of owl include:
     13
     14   o) As a tty client it can be run over telnet, rlogin or text ssh
     15      sessions
     16
     17   o) It uses a perl configuration file for setting preferences and
     18      formatting messages
     19
     20   o) Emacs style editing of messages
     21
     22   o) It is easy to use and runs without a configfile.
     23
     24   o) Advanced sorting and coloring of messages
     25
     26==========================
     27Section 2: GETTING STARTED
     28==========================
     29
    2730Owl will run happily without a configfile, so to get started just run
    28 it.  Owl will take over the terminal window it's started in.
    29 
    30 The Screen
    31 ----------
    32 There are three main parts to the screen.  The large top portion of
    33 the screen is where zephyrs are displayed.  The status bar separates
    34 this area from the one below and displays some status information.
    35 The space below that is used to type in messages and is also used by
    36 owl to give warnings and information to the user.
     31the program.  Owl will take over the terminal window it's started in,
     32so you may wish to have another terminal around at the same time.
     33
     34On Athena you can find owl in the ktools locker.  So to run it you can
     35type:
     36
     37        add ktools
     38        owl
     39
     40at the Athena% prompt.  If you wish to run the latest beta release of
     41owl type 'owl-beta' instead of 'owl'.
     42
     43The Screen Layout
     44-----------------
     45There are three main parts to the owl screen.  The large top portion
     46of the screen is where zephyrs are displayed.  The status bar
     47separates this area from the one below and displays some status
     48information.  The space below that is used to type in messages and is
     49also used by owl to give warnings and information to the user.
     50
     51On Line Help
     52------------
     53Owl has a full on line help system.  Pressing the 'h' key will bring
     54up the basic help screen.  Further help can be obtained using the help
     55command.
    3756
    3857Sending a Zephyr
    3958----------------
    40 To send a zephyr to yourself hit the 'z' key.  This will start a
     59To send a zephyr to yourself press the 'z' key.  This will start a
    4160zwrite command, which you can finish by typing the name of the user
    4261you wish to send to, followed by enter.  Begin typing your message.
    4362You will notice that most emacs-style editing is available.  When you
    44 are ready to send type Control-D.  If you wish to cancel type
    45 Control-C.
    46 
    47 If instead of a user you wish to send to class/instance simply supply
    48 -c and -i arguments to the zwrite command.
     63are ready to send the message type Control-D or a dot ('.') on a line
     64by itself.  If instead you wish to cancel the message type Control-C.
     65
     66If you wish to send to a class/instance pair simply supply -c and -i
     67arguments to the zwrite command as you normally would.
    4968
    5069Manipulating Messages
     
    5271When there are one or more zephyrs in the message window, one of them
    5372will be the 'current' message.  Owl will indicate which one it is with
    54 an arrow to the left of the message.  The following keys will move you
    55 between messages
     73an arrow that looks like this: -> .  The following keys will move you
     74to different messages:
    5675
    5776        n               move to the next non-deleted message
     
    6180        <               move to the first message
    6281        >               move to the last message
     82        C-v             page down
     83        M-v             page up
    6384        right           scroll the screen to the right
    6485        left            scroll the screen to the left
    6586        P               move to the next personal message
    6687        M-P             move to the previous personal message
    67         T               Mark all 'trash' messages for deletion
    6888
    6989When you are ready to delete a message you can mark it for deletion
    7090and a 'D' will appear to the left of the message.  Messages will not
    71 actually be removed until you perform an expunge.
     91actually be removed until you perform an expunge.  The following keys
     92are used to delete, undelete and expunge messages:
    7293
    7394        d               mark a message for deletion
    7495        u               unmark a message for deletion
    7596        x               expunge deleted messages
    76         T               mark all automated messages for deletion
     97        T               mark all 'trash' messages for deletion
     98        M-D             mark all messages in the view for deletion
     99        M-u             unmark all messages in the view for deletion
    77100
    78101If you would like to respond to a zephyr sent to you there is a reply
    79 shortcut.  This will reply to a personal zephyr, or if the zephyr is
    80 sent to a zephyr class it will reply to the zephyr class.
    81 
    82         r               reply to a zephyr
    83 
    84 You can scroll within the current message using:
     102shortcut.
     103
     104        r               Reply.  Personal zephyrs get a personal reply,
     105                        class/instance zephyrs get a public reply.
     106        R               Reply to sender.  Always replies personally
     107                        to the user.
     108        M-r             Reply but allow editing of the command line.
     109        M-R             Reply to sender but allow editing of the
     110                        command line.
     111
     112In the event that the current message is too large to fit on the
     113screen, you can scroll within the message using the following keys:
    85114
    86115        SPACE           page down
     
    89118        BACKSPACE       line up
    90119
    91 The pointer will change to indicate that the message is not starting
    92 at the first line.
     120The message pointer will change to indicate that the message is not
     121starting at the first line.
    93122
    94123Two other keys that relate to the current message:
     
    102131Some other funcions that can be performed with a single keystroke:
    103132
    104         A               toggle zaway
    105         h               print the help screen
     133        A               toggle zaway on or off
    106134        C-l             refresh and resize the screen
    107135        C-z             suspend
     
    110138------------
    111139Owl has a command mode where you can enter more detailed commands for
    112 owl to process.  To enter command mode:
     140owl to process.  To enter command press the color (':') key:
    113141
    114142        :               begin command mode
     
    116144Owl will give you a command prompt and you can begin typing your
    117145command.  Type Enter to execute the command, Control-C to cancel.
    118 Currently support commands are:
    119 
    120         quit , exit     exit owl
    121         zwrite          send a zephyr
    122         reply           reply to the current zephyr
    123         set             set a variable
    124         print           print a variable
    125         zlog [in|out]   send a login or logout message
    126         version         print the owl version number
    127         subscribe       subscribe to a class, instance, recipient
    128         unsubscribe     unsubscribe from a class, instance, recipient
    129         unsuball        unsubscribe from all messagse
    130         getsubs         print a list of current subscriptions
    131         zlocate         locate a user
    132         info            print detailed information about a message
    133         help            print the help screen
    134         next            move to the next message
    135         prev            move to the previous message
    136         next-notdel     move to the next non-deleted message
    137         prev-notdel     move to the previous not-deleted message
    138         expunge         expunge messages marked for deletion
    139         first           move to the first message
    140         last            move to the last message
    141         resize          resize owl to the current window
    142         suspend         suspend owl
    143         exec            run a shell command
    144         zaway [on|off|<msg>]  Turn zaway on, off, or set the message
    145         load-subs       load subscriptions from a file
    146         status          print info about owl status
    147         about           print info about owl
     146There are many commands.  The basic commands are listed on the basic
     147help screen (by pressing 'h').  If you'd like a list of all commands
     148you can use the command "show commands".  To get detailed information
     149on the syntax and use of a command you can use the command 'help
     150<command>' as in:
     151
     152        help zwrite
    148153
    149154Variables
    150155---------
    151 The 'set' and 'print' commands let set and print the values of owl
    152 variables.  The currently supported variables are these:
    153 
    154 Variables:                                                                                       
    155      name            settings  default      meaning                                                 
    156      --------------- --------  -------      -------                                                 
    157      appendtosepbar  <string>            string to append to the end of the sepbar               
    158      bell            on,off    on        enable / disable the terminal bell                       
    159      burningears     on,off    off       [NOT YET IMPLEMENTED] beep on messages matching patterns
    160      classlogging    on,off    off       turn class logging on or off                             
    161      classpath       <path>    ~/zlog/class
    162                                          path for logging class zephyrs                           
    163      debug           on,off    on        whether debugging is enabled                             
    164      debug_file      <path>    /var/tmp/owldebug
    165                                          path for logging debug messages when debugging is enabled
    166      disable-ctrl-d  on,off    off       don't send zephyrs on C-d                               
    167                                                                                                  
    168      displayoutgoing on,off    on        display outgoing messages                               
    169      logging         on,off    off       turn personal logging on or off                         
    170      loginsubs       on,off    on        load logins from .anyone on startup                     
    171      logpath         <path>    ~/zlog/people
    172                                          path for logging personal zephyrs                       
    173      personalbell    on,off    off       ring the terminal bell when personal messages are receive
    174      rxping          on,off    off       display received pings                                   
    175      shutdownlogout  on,off    on        send a logout message when owl exits                     
    176      startuplogin    on,off    on        send a login message when owl starts                     
    177      summarymode     on,off    off       [NOT YET IMPLEMENTED]                                   
    178      txping          on,off    on        send pings                                               
    179      typewinsize     int > 0   8         number of lines in the typing window                     
    180      webbrowser  none,netscape,galeon netscape web browser to use to launch URLs             
    181      zaway_msg         <string>  "I'm sorry..."
    182                                            current zaway msg for responding to zephyrs when away   
    183      zaway_msg_default <string>  "I'm sorry..."
    184                                            default zaway msg for responding to zephyrs when away 
    185      zsig              <string>            zephyr signature                                         
    186      zsigproc          <path>    <null>    name of a program to run that will generate zsigs       
    187 
    188 
    189 ================
    190 THE CONFIG FILE
    191 ================
     156
     157Owl has a number of internal variables that can be used to change the
     158behavior the program.  The 'print' command will let you view the value
     159of a variable and the 'set' commmand will let you set the value of a
     160variable.  For example:
     161
     162        set personalbell on
     163
     164will set the value of the variable 'personalbell' to on.  The command:
     165
     166        print personalbell
     167
     168will show you the current value.  The 'print' command with no
     169arguments will show you the value of all variables.  A list of all
     170variables is available on the basic help screen, or by using the
     171command "show variables".  The command "show variable <variablename>"
     172will show you detailed information about a variable and how to use it.
     173As in:
     174
     175        show variable personalbell
     176
     177=============================
     178Section 3: FILTERS AND COLORS
     179=============================
     180
     181
     182
     183==========================
     184Section 4: THE CONFIG FILE
     185==========================
    192186
    193187*** WARNING: This interface may change substantially in the near future ***
     
    227221
    228222
    229 ===================
    230 FURTHER INFORMATION
    231 ===================
     223==============================
     224Section 5: FURTHER INFORMATION
     225==============================
     226
     227$Id$
  • functions.c

    rf9c43ae rbde7714  
    10651065  strcat(buff, "\nOwl was written by James Kretchmar at the Massachusetts\n");
    10661066  strcat(buff, "Institute of Technology.  The first version, 0.5, was\n");
    1067   strcat(buff, "released in March 2002\n");
     1067  strcat(buff, "released in March 2002.\n");
    10681068  strcat(buff, "\n");
    10691069  strcat(buff, "The name 'owl' was chosen in reference to the owls in the\n");
  • help.c

    r65fc0900 rbde7714  
    6363     "    C-z           Suspend\n"
    6464     "    h             Print this help message\n"
    65      "    : , M-x       Enter one of the commands below\n"
     65     "    : , M-x       Enter command mode\n"
    6666     "\n\n"
    6767     );
  • zephyr.c

    r56330ff rbde7714  
    408408  }
    409409}
     410
     411void owl_zephyr_addsub(char *filename, char *class, char *inst, char *recip) {
     412  char *line, subsfile[LINE], buff[LINE];
     413  FILE *file;
     414
     415  line=owl_zephyr_makesubline(class, inst, recip);
     416
     417  if (filename==NULL) {
     418    sprintf(subsfile, "%s/%s", owl_global_get_homedir(&g), ".zephyr.subs");
     419  } else {
     420    strcpy(subsfile, filename);
     421  }
     422
     423  /* first check if it exists already */
     424  file=fopen(subsfile, "r");
     425  if (!file) {
     426    owl_function_makemsg("Error opening file %s", subsfile);
     427    owl_free(line);
     428    return;
     429  }
     430  while (fgets(buff, LINE, file)!=NULL) {
     431    if (!strcasecmp(buff, line)) {
     432      owl_function_makemsg("Subscription already present in %s", subsfile);
     433      owl_free(line);
     434      return;
     435    }
     436  }
     437
     438  /* if we get here then we didn't find it */
     439  fclose(file);
     440  file=fopen(subsfile, "a");
     441  if (!file) {
     442    owl_function_makemsg("Error opening file %s for writing", subsfile);
     443    owl_free(line);
     444    return;
     445  }
     446  fputs(line, file);
     447  fclose(file);
     448  owl_function_makemsg("Subscription added");
     449 
     450  owl_free(line);
     451}
     452
     453void owl_zephyr_delsub(char *filename, char *class, char *inst, char *recip) {
     454  char *line, subsfile[LINE], buff[LINE], *text;
     455  char backupfilename[LINE];
     456  FILE *file, *backupfile;
     457  int size;
     458 
     459  line=owl_zephyr_makesubline(class, inst, recip);
     460
     461  /* open the subsfile for reading */
     462  if (filename==NULL) {
     463    sprintf(subsfile, "%s/%s", owl_global_get_homedir(&g), ".zephyr.subs");
     464  } else {
     465    strcpy(subsfile, filename);
     466  }
     467  file=fopen(subsfile, "r");
     468  if (!file) {
     469    owl_function_makemsg("Error opening file %s", subsfile);
     470    owl_free(line);
     471    return;
     472  }
     473
     474  /* open the backup file for writing */
     475  sprintf(backupfilename, "%s.backup", subsfile);
     476  backupfile=fopen(backupfilename, "w");
     477  if (!backupfile) {
     478    owl_function_makemsg("Error opening file %s for writing", backupfilename);
     479    owl_free(line);
     480    return;
     481  }
     482
     483  /* we'll read the entire file into memory, minus the line we don't want and
     484   * and at the same time create a backup file */
     485  text=malloc(LINE);
     486  size=LINE;
     487  while (fgets(buff, LINE, file)!=NULL) {
     488    /* if we don't match the line, add to text */
     489    if (strcasecmp(buff, line)) {
     490      size+=LINE;
     491      text=realloc(text, size);
     492      strcat(text, buff);
     493    }
     494
     495    /* write to backupfile */
     496    fputs(buff, backupfile);
     497  }
     498  fclose(backupfile);
     499  fclose(file);
     500
     501  /* now open the original subs file for writing and write out the
     502   * subs */
     503  file=fopen(subsfile, "w");
     504  if (!file) {
     505    owl_function_makemsg("WARNING: Error opening %s to rewrite subscriptions.  Use %s to restore", subsfile, backupfilename);
     506    owl_function_beep();
     507    owl_free(line);
     508    return;
     509  }
     510
     511  fputs(text, file);
     512  fclose(file);
     513  owl_free(line);
     514
     515  owl_function_makemsg("Subscription removed");
     516}
     517
     518char *owl_zephyr_makesubline(char *class, char *inst, char *recip) {
     519  /* caller must free the return */
     520  char *out;
     521
     522  out=owl_malloc(strlen(class)+strlen(inst)+strlen(recip)+30);
     523  sprintf(out, "%s,%s,%s\n", class, inst, !strcmp(recip, "") ? "*" : recip);
     524  return(out);
     525}
Note: See TracChangeset for help on using the changeset viewer.