ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/hopm/branches/1.0.x/src/irc.c
(Generate patch)

Comparing hopm/branches/1.0.x/src/irc.c (file contents):
Revision 5289 by michael, Sat Jan 3 20:38:33 2015 UTC vs.
Revision 5312 by michael, Mon Jan 5 19:27:13 2015 UTC

# Line 86 | Line 86 | static char          IRC_RAW[MSGLENMAX];
86   static unsigned int  IRC_RAW_LEN    = 0;         /* Position of IRC_RAW                   */
87   static int           IRC_FD         = 0;         /* File descriptor for IRC client        */
88  
89 < static struct bopm_sockaddr IRC_SVR;             /* Sock Address Struct for IRC server    */
90 < static struct bopm_ircaddr  IRC_LOCAL;           /* Sock Address Struct for Bind          */
89 > static struct sockaddr_in IRC_SVR;              /* Sock Address Struct for IRC server    */
90 > static struct in_addr IRC_LOCAL;                /* Sock Address Struct for Bind          */
91  
92   static time_t IRC_LAST = 0;                      /* Last full line of data from irc server*/
93   static time_t IRC_LASTRECONNECT = 0;             /* Time of last reconnection */
# Line 172 | Line 172 | irc_cycle(void)
172   static void
173   irc_init(void)
174   {
175 <  struct bopm_sockaddr bsaddr;
175 >  struct sockaddr_in bsaddr;
176    struct in_addr *irc_host;
177  
178    if (IRC_FD)
# Line 180 | Line 180 | irc_init(void)
180  
181    memset(&IRC_SVR, 0, sizeof(IRC_SVR));
182    memset(&IRC_LOCAL, 0, sizeof(IRC_LOCAL));
183 <  memset(&bsaddr, 0, sizeof(struct bopm_sockaddr));
183 >  memset(&bsaddr, 0, sizeof(bsaddr));
184  
185    /* Resolve IRC host. */
186    if ((irc_host = firedns_resolveip4(IRCItem->server)) == NULL)
# Line 190 | Line 190 | irc_init(void)
190      exit(EXIT_FAILURE);
191    }
192  
193 <  IRC_SVR.sa4.sin_family = AF_INET;
194 <  IRC_SVR.sa4.sin_port = htons(IRCItem->port);
195 <  IRC_SVR.sa4.sin_addr = *irc_host;
193 >  IRC_SVR.sin_family = AF_INET;
194 >  IRC_SVR.sin_port = htons(IRCItem->port);
195 >  IRC_SVR.sin_addr = *irc_host;
196  
197 <  if (IRC_SVR.sa4.sin_addr.s_addr == INADDR_NONE)
197 >  if (IRC_SVR.sin_addr.s_addr == INADDR_NONE)
198    {
199      log_printf("IRC -> Unknown error resolving remote host (%s)",
200                 IRCItem->server);
# Line 215 | Line 215 | irc_init(void)
215    {
216      int bindret = 0;
217  
218 <    if (inet_pton(AF_INET, IRCItem->vhost, &(IRC_LOCAL.in4.s_addr)) <= 0)
218 >    if (inet_pton(AF_INET, IRCItem->vhost, &IRC_LOCAL.s_addr) <= 0)
219      {
220        log_printf("IRC -> bind(): %s is an invalid address", IRCItem->vhost);
221        exit(EXIT_FAILURE);
222      }
223  
224 <    bsaddr.sa4.sin_addr.s_addr = IRC_LOCAL.in4.s_addr;
225 <    bsaddr.sa4.sin_family = AF_INET;
226 <    bsaddr.sa4.sin_port = htons(0);
224 >    bsaddr.sin_addr.s_addr = IRC_LOCAL.s_addr;
225 >    bsaddr.sin_family = AF_INET;
226 >    bsaddr.sin_port = htons(0);
227  
228 <    bindret = bind(IRC_FD, (struct sockaddr *) &(bsaddr.sa4), sizeof(bsaddr.sa4));
228 >    bindret = bind(IRC_FD, (struct sockaddr *)&bsaddr, sizeof(bsaddr));
229  
230      if (bindret)
231      {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines