Changeset 65ad073


Ignore:
Timestamp:
Jun 4, 2003, 11:14:41 AM (17 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
ae4cd12
Parents:
6a415e9
Message:
'addbuddy zephyr <user>' and 'delbuddy zephyr <user>' now work.
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r38cf544c r65ad073  
    8585        Added the 'startup' and 'unstartup' commands
    8686        The $HOME/.owl directory is created on startup if it does not exist
     87        Added the 'aim_ingorelogin_timer' variable
     88        'addbuddy zephyr <user>' and 'delbuddy zephyr <user>' now work.
    8789       
    88901.2.8
  • commands.c

    r6a415e9 r65ad073  
    882882char *owl_command_addbuddy(int argc, char **argv, char *buff)
    883883{
    884   if (!owl_global_is_aimloggedin(&g)) {
    885     owl_function_makemsg("addbuddy: You must be logged into aim to use this command.");
    886     return(NULL);
    887   }
    888 
    889884  if (argc!=3) {
    890885    owl_function_makemsg("usage: addbuddy <protocol> <buddyname>");
     
    892887  }
    893888
    894   if (strcasecmp(argv[1], "aim")) {
    895     owl_function_makemsg("addbuddy: currently the only supported protocol is 'aim'");
    896     return(NULL);
    897   }
    898 
    899   owl_aim_addbuddy(argv[2]);
    900   owl_function_makemsg("%s added as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g));
     889  if (!strcasecmp(argv[1], "aim")) {
     890    if (!owl_global_is_aimloggedin(&g)) {
     891      owl_function_makemsg("addbuddy: You must be logged into aim to use this command.");
     892      return(NULL);
     893    }
     894    owl_aim_addbuddy(argv[2]);
     895    owl_function_makemsg("%s added as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g));
     896  } else if (!strcasecmp(argv[1], "zephyr")) {
     897    owl_zephyr_addbuddy(argv[2]);
     898    owl_function_makemsg("%s added as zephyr buddy", argv[2]);
     899  } else {
     900    owl_function_makemsg("addbuddy: currently the only supported protocols are 'zephyr' and 'aim'");
     901  }
    901902
    902903  return(NULL);
     
    905906char *owl_command_delbuddy(int argc, char **argv, char *buff)
    906907{
    907   if (!owl_global_is_aimloggedin(&g)) {
    908     owl_function_makemsg("delbuddy: You must be logged into aim to use this command.");
    909     return(NULL);
    910   }
    911 
    912908  if (argc!=3) {
    913909    owl_function_makemsg("usage: delbuddy <protocol> <buddyname>");
     
    915911  }
    916912
    917   if (strcasecmp(argv[1], "aim")) {
    918     owl_function_makemsg("delbuddy: currently the only supported protocol is 'aim'");
    919     return(NULL);
    920   }
    921 
    922   owl_aim_delbuddy(argv[2]);
    923   owl_function_makemsg("%s deleted as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g));
     913  if (!strcasecmp(argv[1], "aim")) {
     914    if (!owl_global_is_aimloggedin(&g)) {
     915      owl_function_makemsg("delbuddy: You must be logged into aim to use this command.");
     916      return(NULL);
     917    }
     918    owl_aim_delbuddy(argv[2]);
     919    owl_function_makemsg("%s deleted as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g));
     920  } else if (!strcasecmp(argv[1], "zephyr")) {
     921    owl_zephyr_delbuddy(argv[2]);
     922    owl_function_makemsg("%s deleted as zephyr buddy", argv[2]);
     923  } else {
     924    owl_function_makemsg("delbuddy: currently the only supported protocols are 'zephyr' and 'aim'");
     925  }
     926
    924927
    925928  return(NULL);
  • owl.h

    r6a415e9 r65ad073  
    248248  int delete;
    249249  char hostname[MAXHOSTNAMELEN];
    250   owl_list attributes; /* this is a list of pairs */
     250  owl_list attributes;            /* this is a list of pairs */
    251251  char *time;
    252252  char *zwriteline;
  • owl_prototypes.h

    r6a415e9 r65ad073  
    969969extern void owl_zephyr_zlog_in(void);
    970970extern void owl_zephyr_zlog_out(void);
     971extern void owl_zephyr_addbuddy(char *name);
     972extern void owl_zephyr_delbuddy(char *name);
    971973
    972974/* -------------------------------- zwrite.c -------------------------------- */
  • util.c

    r38cf544c r65ad073  
    704704    if (backup) fputs(buff, backupfile);
    705705  }
    706   fclose(backupfile);
     706  if (backup) fclose(backupfile);
    707707  fclose(file);
    708708
  • zephyr.c

    r31e48a3 r65ad073  
    607607}
    608608
     609void owl_zephyr_addbuddy(char *name)
     610{
     611  char *filename;
     612  FILE *file;
     613 
     614  filename=owl_sprintf("%s/.anyone", owl_global_get_homedir(&g));
     615  file=fopen(filename, "a");
     616  owl_free(filename);
     617  if (!file) {
     618    owl_function_makemsg("Error opening zephyr buddy file for append");
     619    return;
     620  }
     621  fprintf(file, "%s\n", name);
     622  fclose(file);
     623}
     624
     625void owl_zephyr_delbuddy(char *name)
     626{
     627  char *filename;
     628
     629  filename=owl_sprintf("%s/.anyone", owl_global_get_homedir(&g));
     630  owl_util_file_deleteline(filename, name, 0);
     631  owl_free(filename);
     632}
Note: See TracChangeset for help on using the changeset viewer.