本文整理汇总了C++中CHAT_PROTOCOL_REC::create_server_connect方法的典型用法代码示例。如果您正苦于以下问题:C++ CHAT_PROTOCOL_REC::create_server_connect方法的具体用法?C++ CHAT_PROTOCOL_REC::create_server_connect怎么用?C++ CHAT_PROTOCOL_REC::create_server_connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHAT_PROTOCOL_REC
的用法示例。
在下文中一共展示了CHAT_PROTOCOL_REC::create_server_connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
static SERVER_CONNECT_REC *
create_addr_conn(int chat_type, const char *address, int port,
const char *chatnet, const char *password,
const char *nick)
{
CHAT_PROTOCOL_REC *proto;
SERVER_CONNECT_REC *conn;
SERVER_SETUP_REC *sserver;
CHATNET_REC *chatnetrec;
g_return_val_if_fail(address != NULL, NULL);
sserver = server_setup_find(address, port, chatnet);
if (sserver != NULL) {
if (chat_type < 0)
chat_type = sserver->chat_type;
else if (chat_type != sserver->chat_type)
sserver = NULL;
}
proto = chat_type >= 0 ? chat_protocol_find_id(chat_type) :
chat_protocol_get_default();
conn = proto->create_server_connect();
server_connect_ref(conn);
conn->chat_type = proto->id;
if (chatnet != NULL && *chatnet != '\0')
conn->chatnet = g_strdup(chatnet);
/* fill in the defaults */
server_setup_fill(conn, address, port);
/* fill the rest from chat network settings */
chatnetrec = chatnet != NULL ? chatnet_find(chatnet) :
(sserver == NULL || sserver->chatnet == NULL ? NULL :
chatnet_find(sserver->chatnet));
if (chatnetrec != NULL)
server_setup_fill_chatnet(conn, chatnetrec);
/* fill the information from setup */
if (sserver != NULL)
server_setup_fill_server(conn, sserver);
/* nick / password given in command line overrides all settings */
if (password && *password) {
g_free_not_null(conn->password);
conn->password = g_strdup(password);
}
if (nick && *nick) {
g_free_not_null(conn->nick);
conn->nick = g_strdup(nick);
}
return conn;
}