[srvx-commits] CVS: services/src chanserv.c,1.357,1.358
                
                Brought to you by:
                
                    entrope
                    
                
            
            
        
        
        
    | 
      
      
      From: Entrope <en...@us...> - 2003-07-08 03:08:23
      
     | 
| Update of /cvsroot/srvx/services/src
In directory sc8-pr-cvs1:/tmp/cvs-serv22129/src
Modified Files:
	chanserv.c 
Log Message:
implement RFE [612905] - set staff notes after channel suspend
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.357
retrieving revision 1.358
diff -C2 -r1.357 -r1.358
*** chanserv.c	7 Jul 2003 23:21:13 -0000	1.357
--- chanserv.c	8 Jul 2003 03:08:20 -0000	1.358
***************
*** 279,282 ****
--- 279,283 ----
  #define CSMSG_NOTE_TYPE_USED    "Note type $b%s$b is in use; give the FORCE argument to delete it."
  #define CSMSG_NOTE_DELETED      "Note type $b%s$b deleted."
+ #define CSMSG_NOTE_SUSPENDED    "You may not view or set notes for suspended channels."
  
  /* Channel [un]suspension */
***************
*** 4663,4672 ****
  static CHANSERV_FUNC(cmd_note)
  {
!     struct chanData *cData = channel->channel_info;
      struct note *note;
      struct note_type *ntype;
  
      /* If no arguments, show all visible notes for the channel. */
!     if(argc < 2)
      {
          dict_iterator_t it;
--- 4664,4706 ----
  static CHANSERV_FUNC(cmd_note)
  {
!     struct chanData *cData;
      struct note *note;
      struct note_type *ntype;
+     unsigned int arg = 1;
+ 
+     if(channel)
+     {
+         cData = channel->channel_info;
+         if(!cData)
+         {
+             reply(CSMSG_NOT_REGISTERED, channel->name);
+             return 0;
+         }
+     }
+     else if((argc > arg) && IsCSChannelName(argv[arg]))
+     {
+         struct suspended *sChan = dict_find(sChannels, argv[arg], NULL);
+         if(!sChan)
+         {
+             reply(CSMSG_NOT_REGISTERED, argv[arg]);
+             return 0;
+         }
+         arg++;
+         cData = sChan->cData;
+     }
+     else
+     {
+         reply(MSG_NOT_CHANNEL_NAME);
+         return 0;
+     }
+ 
+     if (IsSuspended(cData) && !IsHelping(user))
+     {
+         reply(CSMSG_NOTE_SUSPENDED);
+         return 0;
+     }
  
      /* If no arguments, show all visible notes for the channel. */
!     if(argc <= arg)
      {
          dict_iterator_t it;
***************
*** 4684,4695 ****
      }
      /* If one argument, show the named note. */
!     else if(argc < 3)
      {
!         if((note = dict_find(cData->notes, argv[1], NULL))
             && note_type_visible_to_user(cData, note->type, user))
          {
              chanserv_notice(user, CSMSG_NOTE_FORMAT, note->type->name, note->setter, note->note);
          }
!         else if((ntype = dict_find(note_types, argv[1], NULL))
                  && note_type_visible_to_user(NULL, ntype, user))
          {
--- 4718,4729 ----
      }
      /* If one argument, show the named note. */
!     else if(argc == arg+1)
      {
!         if((note = dict_find(cData->notes, argv[arg], NULL))
             && note_type_visible_to_user(cData, note->type, user))
          {
              chanserv_notice(user, CSMSG_NOTE_FORMAT, note->type->name, note->setter, note->note);
          }
!         else if((ntype = dict_find(note_types, argv[arg], NULL))
                  && note_type_visible_to_user(NULL, ntype, user))
          {
***************
*** 4699,4703 ****
          else
          {
!             chanserv_notice(user, CSMSG_BAD_NOTE_TYPE, argv[1]);
              return 0;
          }
--- 4733,4737 ----
          else
          {
!             chanserv_notice(user, CSMSG_BAD_NOTE_TYPE, argv[arg]);
              return 0;
          }
***************
*** 4707,4719 ****
      {
          char *note_text;
!         ntype = dict_find(note_types, argv[1], NULL);
          if(!ntype)
          {
!             chanserv_notice(user, CSMSG_BAD_NOTE_TYPE, argv[1]);
              return 0;
          }
          else if(note_type_settable_by_user(channel, ntype, user))
          {
!             note_text = unsplit_string(argv+2, argc-2, NULL);
              chanserv_add_channel_note(cData, ntype, user->handle_info->handle, note_text);
              chanserv_notice(user, CSMSG_NOTE_SET, ntype->name, channel->name);
--- 4741,4753 ----
      {
          char *note_text;
!         ntype = dict_find(note_types, argv[arg], NULL);
          if(!ntype)
          {
!             chanserv_notice(user, CSMSG_BAD_NOTE_TYPE, argv[arg]);
              return 0;
          }
          else if(note_type_settable_by_user(channel, ntype, user))
          {
!             note_text = unsplit_string(argv+arg+1, argc-arg-1, NULL);
              chanserv_add_channel_note(cData, ntype, user->handle_info->handle, note_text);
              chanserv_notice(user, CSMSG_NOTE_SET, ntype->name, channel->name);
***************
*** 7374,7378 ****
      DEFINE_COMMAND(names, 1, MODCMD_REQUIRE_REGCHAN, "flags", "+nolog,+joinable", NULL);
  
!     DEFINE_COMMAND(note, 1, MODCMD_REQUIRE_REGCHAN, "flags", "+joinable", NULL);
      DEFINE_COMMAND(delnote, 2, MODCMD_REQUIRE_CHANUSER, NULL);
  
--- 7408,7412 ----
      DEFINE_COMMAND(names, 1, MODCMD_REQUIRE_REGCHAN, "flags", "+nolog,+joinable", NULL);
  
!     DEFINE_COMMAND(note, 1, MODCMD_ACCEPT_CHANNEL, "flags", "+joinable", NULL);
      DEFINE_COMMAND(delnote, 2, MODCMD_REQUIRE_CHANUSER, NULL);
  
 |