Changeset 3b3cd693
- Timestamp:
- 2006-10-20T19:58:09Z (18 years ago)
- Branches:
- master
- Children:
- 35f6677
- Parents:
- dfa41a4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
rdfa41a4 r3b3cd693 62 62 struct jabber_data *jd = g_new0( struct jabber_data, 1 ); 63 63 struct ns_srv_reply *srv = NULL; 64 char *connect_to ;64 char *connect_to, *s; 65 65 66 66 jd->gc = gc; … … 81 81 jd->server ++; 82 82 83 if( ( s = strchr( jd->server, '/' ) ) ) 84 { 85 *s = 0; 86 set_setstr( &acc->set, "resource", s + 1 ); 87 88 /* Also remove the /resource from the original variable so we 89 won't have to do this again every time. */ 90 s = strchr( acc->user, '/' ); 91 *s = 0; 92 } 93 94 /* This code isn't really pretty. Backwards compatibility never is... */ 95 s = acc->server; 96 while( s ) 97 { 98 static int had_port = 0; 99 100 if( strncmp( s, "ssl", 3 ) == 0 ) 101 { 102 set_setstr( &acc->set, "ssl", "true" ); 103 104 /* Flush this part so that (if this was the first 105 part of the server string) acc->server gets 106 flushed. We don't want to have to do this another 107 time. :-) */ 108 *s = 0; 109 s ++; 110 111 /* Only set this if the user didn't specify a custom 112 port number already... */ 113 if( !had_port ) 114 set_setint( &acc->set, "port", 5223 ); 115 } 116 else if( isdigit( *s ) ) 117 { 118 int i; 119 120 /* The first character is a digit. It could be an 121 IP address though. Only accept this as a port# 122 if there are only digits. */ 123 for( i = 0; isdigit( s[i] ); i ++ ); 124 125 /* If the first non-digit character is a colon or 126 the end of the string, save the port number 127 where it should be. */ 128 if( s[i] == ':' || s[i] == 0 ) 129 { 130 sscanf( s, "%d", &i ); 131 set_setint( &acc->set, "port", i ); 132 133 /* See above. */ 134 *s = 0; 135 s ++; 136 } 137 138 had_port = 1; 139 } 140 141 s = strchr( s, ':' ); 142 if( s ) 143 { 144 *s = 0; 145 s ++; 146 } 147 } 148 83 149 jd->node_cache = g_hash_table_new_full( g_str_hash, g_str_equal, NULL, jabber_cache_entry_free ); 84 150 jd->buddies = g_hash_table_new( g_str_hash, g_str_equal ); 85 151 86 152 /* Figure out the hostname to connect to. */ 87 if( acc->server )153 if( acc->server && *acc->server ) 88 154 connect_to = acc->server; 89 155 else if( ( srv = srv_lookup( "xmpp-client", "tcp", jd->server ) ) || … … 99 165 { 100 166 jd->ssl = ssl_connect( connect_to, set_getint( &acc->set, "port" ), jabber_connected_ssl, gc ); 101 jd->fd = ssl_getfd( jd->ssl );167 jd->fd = jd->ssl ? ssl_getfd( jd->ssl ) : -1; 102 168 } 103 169 else
Note: See TracChangeset
for help on using the changeset viewer.