- Timestamp:
- 2006-07-14T09:34:56Z (18 years ago)
- Branches:
- master
- Children:
- 00a5270
- Parents:
- 75a4b85 (diff), 6398094 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.c
r75a4b85 reda0270 47 47 char buf[128]; 48 48 #ifdef IPV6 49 struct sockaddr_in6 sock[1]; 50 #else 49 struct sockaddr_in6 sock6[1]; 50 unsigned int i6; 51 #endif 51 52 struct sockaddr_in sock[1]; 52 #endif53 53 54 54 irc = g_new0( irc_t, 1 ); … … 70 70 71 71 i = sizeof( *sock ); 72 #ifdef IPV6 73 i6 = sizeof( *sock6 ); 74 #endif 72 75 73 76 if( global.conf->hostname ) 74 77 irc->myhost = g_strdup( global.conf->hostname ); 75 78 #ifdef IPV6 76 else if( getsockname( irc->fd, (struct sockaddr*) sock , &i ) == 0 && sock->sin6_family == AF_INETx)77 { 78 if( ( peer = gethostbyaddr( (char*) &sock ->sin6_addr, sizeof( sock->sin6_addr ), AF_INETx) ) )79 else if( getsockname( irc->fd, (struct sockaddr*) sock6, &i6 ) == 0 && sock6->sin6_family == AF_INET6 ) 80 { 81 if( ( peer = gethostbyaddr( (char*) &sock6->sin6_addr, sizeof( sock6->sin6_addr ), AF_INET6 ) ) ) 79 82 irc->myhost = g_strdup( peer->h_name ); 80 else if( inet_ntop( AF_INET x, &sock->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL )83 else if( inet_ntop( AF_INET6, &sock6->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL ) 81 84 irc->myhost = g_strdup( ipv6_unwrap( buf ) ); 82 85 } 83 #e lse84 else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INET x)85 { 86 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INET x) ) )86 #endif 87 else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INET ) 88 { 89 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INET ) ) ) 87 90 irc->myhost = g_strdup( peer->h_name ); 88 else if( inet_ntop( AF_INET x, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL )91 else if( inet_ntop( AF_INET, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL ) 89 92 irc->myhost = g_strdup( buf ); 90 93 } 91 #endif92 94 93 95 i = sizeof( *sock ); 94 96 #ifdef IPV6 95 if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin6_family == AF_INETx ) 96 { 97 if( ( peer = gethostbyaddr( (char*) &sock->sin6_addr, sizeof( sock->sin6_addr ), AF_INETx ) ) ) 97 i6 = sizeof( *sock6 ); 98 if( getpeername( irc->fd, (struct sockaddr*) sock6, &i6 ) == 0 && sock6->sin6_family == AF_INET6 ) 99 { 100 if( ( peer = gethostbyaddr( (char*) &sock6->sin6_addr, sizeof( sock6->sin6_addr ), AF_INET6 ) ) ) 98 101 irc->host = g_strdup( peer->h_name ); 99 else if( inet_ntop( AF_INET x, &sock->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL )102 else if( inet_ntop( AF_INET6, &sock6->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL ) 100 103 irc->host = g_strdup( ipv6_unwrap( buf ) ); 101 104 } 102 #else 103 if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INETx ) 104 { 105 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INETx ) ) ) 105 else 106 #endif 107 if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INET ) 108 { 109 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INET ) ) ) 106 110 irc->host = g_strdup( peer->h_name ); 107 else if( inet_ntop( AF_INET x, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL )111 else if( inet_ntop( AF_INET, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL ) 108 112 irc->host = g_strdup( buf ); 109 113 } 110 #endif111 114 112 115 /* Rare, but possible. */ … … 621 624 char namelist[385] = ""; 622 625 struct conversation *c = NULL; 626 char *ops = set_getstr( irc, "ops" ); 623 627 624 628 /* RFCs say there is no error reply allowed on NAMES, so when the … … 637 641 if( u->gc && !u->away && set_getbool( &irc->set, "away_devoice" ) ) 638 642 strcat( namelist, "+" ); 643 else if( ( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( ops, "root" ) == 0 || strcmp( ops, "both" ) == 0 ) ) || 644 ( strcmp( u->nick, irc->nick ) == 0 && ( strcmp( ops, "user" ) == 0 || strcmp( ops, "both" ) == 0 ) ) ) 645 strcat( namelist, "@" ); 639 646 640 647 strcat( namelist, u->nick );
Note: See TracChangeset
for help on using the changeset viewer.