56 struct irc_net_info net_info = { |
56 struct irc_net_info net_info = { |
57 .use_ssl = _net_info->use_ssl, |
57 .use_ssl = _net_info->use_ssl, |
58 }; |
58 }; |
59 |
59 |
60 // combine _net_info and defaults to get net_info |
60 // combine _net_info and defaults to get net_info |
61 if ( |
61 if (_net_info->raw_sock) |
62 _net_info->raw_sock |
62 RETURN_SET_ERROR_STR(err, ERR_IRC_NET_INFO, "raw_sock"); |
63 || (net_info.network = _net_info->network) == NULL |
63 |
64 || (net_info.hostname = _net_info->hostname) == NULL |
64 if ((net_info.network = _net_info->network) == NULL) |
65 || (net_info.service = (_net_info->service ? _net_info->service : ( |
65 RETURN_SET_ERROR_STR(err, ERR_IRC_NET_INFO, "network"); |
|
66 |
|
67 if ((net_info.hostname = _net_info->hostname) == NULL) |
|
68 RETURN_SET_ERROR_STR(err, ERR_IRC_NET_INFO, "hostname"); |
|
69 |
|
70 if ((net_info.service = (_net_info->service ? _net_info->service : ( |
66 _net_info->use_ssl ? client->defaults.service_ssl : client->defaults.service |
71 _net_info->use_ssl ? client->defaults.service_ssl : client->defaults.service |
67 ))) == NULL |
72 ))) == NULL) |
68 || APPLY_REGISTER_INFO_DEFAULT(&net_info, _net_info, &client->defaults, nickname) |
73 RETURN_SET_ERROR_STR(err, ERR_IRC_NET_INFO, "service"); |
69 || APPLY_REGISTER_INFO_DEFAULT(&net_info, _net_info, &client->defaults, username) |
74 |
70 || APPLY_REGISTER_INFO_DEFAULT(&net_info, _net_info, &client->defaults, realname) |
75 if (APPLY_REGISTER_INFO_DEFAULT(&net_info, _net_info, &client->defaults, nickname)) |
71 ) |
76 RETURN_SET_ERROR_STR(err, ERR_IRC_NET_INFO, "nickname"); |
72 return SET_ERROR(err, ERR_IRC_NET_INFO); |
77 |
|
78 if (APPLY_REGISTER_INFO_DEFAULT(&net_info, _net_info, &client->defaults, username)) |
|
79 RETURN_SET_ERROR_STR(err, ERR_IRC_NET_INFO, "username"); |
|
80 |
|
81 if (APPLY_REGISTER_INFO_DEFAULT(&net_info, _net_info, &client->defaults, realname)) |
|
82 RETURN_SET_ERROR_STR(err, ERR_IRC_NET_INFO, "realname"); |
73 |
83 |
74 // create the new irc_chan struct |
84 // create the new irc_chan struct |
75 if (irc_net_create(&net, &net_info, err)) |
85 if (irc_net_create(&net, &net_info, err)) |
76 return ERROR_CODE(err); |
86 return ERROR_CODE(err); |
77 |
87 |