Difference for server/c_chat.c from version 1.8 to 1.9


version 1.8 version 1.9
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_c_chat_c =   * static char *rcsid_c_chat_c =
  *   "$Id: c_chat.c,v 1.8 2002/07/15 04:25:40 mwedel Exp $";   *   "$Id: c_chat.c,v 1.9 2002/10/17 07:15:39 mwedel Exp $";
  */   */
   
 /*  /*
Line 35
 
Line 35
     char buf[MAX_BUF];      char buf[MAX_BUF];
   
     if (!params) return 0;      if (!params) return 0;
     /* This broken apart from one sprintf to avoid buffer overuns.      snprintf(buf, MAX_BUF-1, "%s says: %s",op->name, params);
      * This could be done via snprintf, but I am not sure how widely  
      * available that is. MSW 5/22/2000  
      */  
     sprintf(buf, "%s says: ",op->name);  
     strncat(buf, params, MAX_BUF - strlen(buf)-1);  
     buf[MAX_BUF-1]=0;  
   
     new_info_map(NDI_WHITE,op->map, buf);      new_info_map(NDI_WHITE,op->map, buf);
     communicate(op, params);      communicate(op, params);
      
Line 51
 
Line 44
   
 int command_shout (object *op, char *params)  int command_shout (object *op, char *params)
 {  {
     char buf[MAX_BUF];  
 #ifdef PLUGINS  #ifdef PLUGINS
     int evtid;      int evtid;
     CFParm CFP;      CFParm CFP;
Line 60
 
Line 52
  new_draw_info(NDI_UNIQUE, 0,op,"Shout what?");   new_draw_info(NDI_UNIQUE, 0,op,"Shout what?");
  return 1;   return 1;
     }      }
     strcpy(buf,op->name);      new_draw_info_format(NDI_UNIQUE | NDI_ALL | NDI_RED, 1, NULL,
     strcat(buf," shouts: ");   "%s shouts: %s", op->name, params);
     strncat(buf, params, MAX_BUF-30);  
     buf[MAX_BUF - 30] = '\0';  
     new_draw_info(NDI_UNIQUE | NDI_ALL | NDI_RED, 1, NULL, buf);  
 #ifdef PLUGINS  #ifdef PLUGINS
     /* GROS : Here we handle the SHOUT global event */      /* GROS : Here we handle the SHOUT global event */
     evtid = EVENT_SHOUT;      evtid = EVENT_SHOUT;
Line 79
 
Line 68
 int command_tell (object *op, char *params)  int command_tell (object *op, char *params)
 {  {
     char buf[MAX_BUF],*name = NULL ,*msg = NULL;      char buf[MAX_BUF],*name = NULL ,*msg = NULL;
     char buf2[MAX_BUF];  
     player *pl;      player *pl;
   
     if ( params != NULL){      if ( params != NULL){
         name = params;          name = params;
         msg = strchr(name, ' ');          msg = strchr(name, ' ');
Line 95
 
Line 84
  new_draw_info(NDI_UNIQUE, 0,op,"Tell whom what?");   new_draw_info(NDI_UNIQUE, 0,op,"Tell whom what?");
  return 1;   return 1;
     } else if ( msg == NULL){      } else if ( msg == NULL){
  sprintf(buf, "Tell %s what?", name);   new_draw_info_format(NDI_UNIQUE, 0,op,"Tell %s what?", name);
  new_draw_info(NDI_UNIQUE, 0,op,buf);  
  return 1;   return 1;
     }      }
   
     sprintf(buf,"%s tells you: ",op->name);      snprintf(buf,MAX_BUF-1, "%s tells you: %s",op->name, msg);
     strncat(buf, msg, MAX_BUF-strlen(buf)-1);  
     buf[MAX_BUF-1]=0;  
   
     for(pl=first_player;pl!=NULL;pl=pl->next)      for(pl=first_player;pl!=NULL;pl=pl->next)
       if(strncasecmp(pl->ob->name,name,MAX_NAME)==0)   if(strncasecmp(pl->ob->name,name,MAX_NAME)==0) {
       {  
         new_draw_info(NDI_UNIQUE | NDI_ORANGE, 0, pl->ob, buf);          new_draw_info(NDI_UNIQUE | NDI_ORANGE, 0, pl->ob, buf);
         sprintf(buf2, "You tell to %s: %s",name,msg);       new_draw_info_format(NDI_UNIQUE | NDI_ORANGE, 0, op,
         new_draw_info(NDI_UNIQUE | NDI_ORANGE, 0, op, buf2);        "You tell %s: %s", name, msg);
   
         /* Update last_tell value [mids 01/14/2002] */          /* Update last_tell value [mids 01/14/2002] */
         strcpy(pl->last_tell, op->name);          strcpy(pl->last_tell, op->name);
Line 121
 
Line 107
   
 /* Reply to last person who told you something [mids 01/14/2002] */  /* Reply to last person who told you something [mids 01/14/2002] */
 int command_reply (object *op, char *params) {  int command_reply (object *op, char *params) {
     char buf[MAX_BUF];  
     char buf2[MAX_BUF];  
     player *pl;      player *pl;
   
     if (params == NULL) {      if (params == NULL) {
Line 130
 
Line 114
         return 1;          return 1;
     }      }
   
   
     if (op->contr->last_tell[0] == '\0') {      if (op->contr->last_tell[0] == '\0') {
         new_draw_info(NDI_UNIQUE, 0, op, "You can't reply to nobody.");          new_draw_info(NDI_UNIQUE, 0, op, "You can't reply to nobody.");
         return 1;          return 1;
Line 144
 
Line 127
         return 1;          return 1;
     }      }
   
     sprintf(buf, "%s tells you: ", op->name);  
     strncat(buf, params, MAX_BUF-strlen(buf)-1);  
     buf[MAX_BUF-1] = 0;  
   
     /* Update last_tell value */      /* Update last_tell value */
     strcpy(pl->last_tell, op->name);      strcpy(pl->last_tell, op->name);
   
     new_draw_info(NDI_UNIQUE | NDI_ORANGE, 0, pl->ob, buf);      new_draw_info_format(NDI_UNIQUE | NDI_ORANGE, 0, pl->ob,
     sprintf(buf2, "You tell to %s: %s", pl->ob->name, params);   "%s tells you: %s", op->name, params);
     new_draw_info(NDI_UNIQUE | NDI_ORANGE, 0, op, buf2);      new_draw_info_format(NDI_UNIQUE | NDI_ORANGE, 0, op,
      "You tell to %s: %s", pl->ob->name, params);
     return 1;      return 1;
 }  }
   
Line 692
 
Line 671
  return(0);   return(0);
      }/*if self*/       }/*if self*/
  }/*for*/   }/*for*/
  sprintf(buf, "%s is not around.", params);   new_draw_info_format(NDI_UNIQUE, 0, op, "%s is not around.", params);
  new_draw_info(NDI_UNIQUE, 0, op, buf);  
  return(1);   return(1);
     } /*else*/      } /*else*/
   


Legend:
line(s) removed in v.1.8 
line(s) changed
 line(s) added in v.1.9

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:26