/[svn]/ircd-hybrid-8/src/s_serv.c
ViewVC logotype

Diff of /ircd-hybrid-8/src/s_serv.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1544 by michael, Wed Sep 5 12:02:04 2012 UTC revision 1545 by michael, Sun Sep 30 15:21:59 2012 UTC
# Line 75  static void burst_members(struct Client Line 75  static void burst_members(struct Client
75  void  void
76  write_links_file(void* notused)  write_links_file(void* notused)
77  {  {
78    MessageFileLine *next_mptr = 0;    MessageFileLine *next_mptr = NULL;
79    MessageFileLine *mptr = 0;    MessageFileLine *mptr = NULL;
80    MessageFileLine *currentMessageLine = 0;    MessageFileLine *currentMessageLine = NULL;
81    MessageFileLine *newMessageLine = 0;    MessageFileLine *newMessageLine = NULL;
82    MessageFile *MessageFileptr;    MessageFile *MessageFileptr = &ConfigFileEntry.linksfile;
   const char *p;  
83    FILE *file;    FILE *file;
84    char buff[512];    char buff[512];
85    dlink_node *ptr;    dlink_node *ptr;
86    
   MessageFileptr = &ConfigFileEntry.linksfile;  
   
87    if ((file = fopen(MessageFileptr->fileName, "w")) == NULL)    if ((file = fopen(MessageFileptr->fileName, "w")) == NULL)
88      return;      return;
89    
# Line 97  write_links_file(void* notused) Line 94  write_links_file(void* notused)
94    }    }
95    
96    MessageFileptr->contentsOfFile = NULL;    MessageFileptr->contentsOfFile = NULL;
   currentMessageLine             = NULL;  
97    
98    DLINK_FOREACH(ptr, global_serv_list.head)    DLINK_FOREACH(ptr, global_serv_list.head)
99    {    {
# Line 111  write_links_file(void* notused) Line 107  write_links_file(void* notused)
107      if (IsHidden(target_p))      if (IsHidden(target_p))
108        continue;        continue;
109    
     if (target_p->info[0])  
       p = target_p->info;  
     else  
       p = "(Unknown Location)";  
   
110      newMessageLine = MyMalloc(sizeof(MessageFileLine));      newMessageLine = MyMalloc(sizeof(MessageFileLine));
111    
112      /* Attempt to format the file in such a way it follows the usual links output      /*
113         * Attempt to format the file in such a way it follows the usual links output
114       * ie  "servername uplink :hops info"       * ie  "servername uplink :hops info"
115       * Mostly for aesthetic reasons - makes it look pretty in mIRC ;)       * Mostly for aesthetic reasons - makes it look pretty in mIRC ;)
116       * - madmax       * - madmax
117       */       */
   
     /*  
      * For now, check this ircsprintf wont overflow - it shouldnt on a  
      * default config but it is configurable..  
      * This should be changed to an snprintf at some point, but I'm wanting to  
      * know if this is a cause of a bug - cryogen  
      */  
     assert(strlen(target_p->name) + strlen(me.name) + 6 + strlen(p) <=  
             MESSAGELINELEN);  
118      snprintf(newMessageLine->line, sizeof(newMessageLine->line), "%s %s :1 %s",      snprintf(newMessageLine->line, sizeof(newMessageLine->line), "%s %s :1 %s",
119               target_p->name, me.name, p);               target_p->name, me.name, target_p->info);
     newMessageLine->next = NULL;  
120    
121      if (MessageFileptr->contentsOfFile)      if (MessageFileptr->contentsOfFile)
122      {      {
# Line 148  write_links_file(void* notused) Line 130  write_links_file(void* notused)
130        currentMessageLine = newMessageLine;        currentMessageLine = newMessageLine;
131      }      }
132    
133      snprintf(buff, sizeof(buff), "%s %s :1 %s\n", target_p->name, me.name, p);      snprintf(buff, sizeof(buff), "%s %s :1 %s\n",
134                 target_p->name, me.name, target_p->info);
135      fputs(buff, file);      fputs(buff, file);
136    }    }
137    

Legend:
Removed from v.1544  
changed lines
  Added in v.1545

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28