static int _client_anongame_set_icon(t_connection * c, t_packet const * const packet) { //BlacKDicK 04/20/2003 unsigned int desired_icon; char user_icon[5]; /*FIXME: In this case we do not get a 'count' but insted of it we get the icon that the client wants to set.'W3H2' for an example. For now it is ok, since they share the same position on the packet*/ desired_icon=bn_int_get(packet->u.client_findanongame.count); user_icon[4]=0; if (desired_icon==0){ std::strcpy(user_icon,"NULL"); eventlog(eventlog_level_info,__FUNCTION__,"[%d] Set icon packet to DEFAULT ICON [%4.4s]",conn_get_socket(c),user_icon); }else{ std::memcpy(user_icon,&desired_icon,4); eventlog(eventlog_level_info,__FUNCTION__,"[%d] Set icon packet to ICON [%s]",conn_get_socket(c),user_icon); } account_set_user_icon(conn_get_account(c),conn_get_clienttag(c),user_icon); //FIXME: Still need a way to 'refresh the user/channel' //_handle_rejoin_command(conn_get_account(c),""); /* ??? channel_update_userflags() */ conn_update_w3_playerinfo(c); channel_rejoin(c); return 0; }
static void event_duplicate_channel(IRC_SERVER_REC *server, const char *data) { CHANNEL_REC *chanrec; char *params, *channel, *p; g_return_if_fail(data != NULL); params = event_get_params(data, 3, NULL, NULL, &channel); p = strchr(channel, ' '); if (p != NULL) *p = '\0'; if (channel[0] == '!' && channel[1] != '!') { chanrec = channel_find(SERVER(server), channel); if (chanrec != NULL && !chanrec->names_got) { /* duplicate channel - this should only happen when there's some sync problem with servers, rejoining after a while should help. note that this same 407 is sent when trying to create !!channel that already exists so we don't want to try rejoining then. */ channel_rejoin(server, channel); signal_stop(); } } g_free(params); }
static void event_target_unavailable(const char *data, IRC_SERVER_REC *server) { char *params, *channel; g_return_if_fail(data != NULL); params = event_get_params(data, 2, NULL, &channel); if (ischannel(*channel)) { /* channel is unavailable - try to join again a bit later */ channel_rejoin(server, channel); } g_free(params); }
/* Choose icon by user from profile > portrait */ static int _client_anongame_set_icon(t_connection * c, t_packet const * const packet) { //BlacKDicK 04/20/2003 // Modified by aancw 16/12/2014 unsigned int desired_icon; char user_icon[5]; t_account * account; // disable with custom icons if (prefs_get_custom_icons() == 1) { return 0; } /*FIXME: In this case we do not get a 'count' but insted of it we get the icon that the client wants to set.'W3H2' for an example. For now it is ok, since they share the same position on the packet*/ desired_icon = bn_int_get(packet->u.client_findanongame.count); //user_icon[4]=0; if (desired_icon == 0){ std::strcpy(user_icon, "1O3W"); // 103W is equal to Default Icon eventlog(eventlog_level_info, __FUNCTION__, "[%d] Set icon packet to DEFAULT ICON [%4.4s]", conn_get_socket(c), user_icon); } else{ std::memcpy(user_icon, &desired_icon, 4); eventlog(eventlog_level_info, __FUNCTION__, "[%d] Set icon packet to ICON [%s]", conn_get_socket(c), user_icon); } account = conn_get_account(c); // ICON SWITCH HACK PROTECTION if (check_user_icon(account, user_icon) == 0) { std::strcpy(user_icon, "1O3W"); // set icon to default eventlog(eventlog_level_info, __FUNCTION__, "[%s] \"%s\" ICON SWITCH hack attempt, icon set to default ", conn_get_username(c), user_icon); //conn_set_state(c,conn_state_destroy); // dont kill user session } account_set_user_icon(conn_get_account(c), conn_get_clienttag(c), user_icon); //FIXME: Still need a way to 'refresh the user/channel' //_handle_rejoin_command(conn_get_account(c),""); /* ??? channel_update_userflags() */ conn_update_w3_playerinfo(c); channel_rejoin(c); return 0; }
static void event_target_unavailable(IRC_SERVER_REC *server, const char *data) { char *params, *channel; IRC_CHANNEL_REC *chanrec; g_return_if_fail(data != NULL); params = event_get_params(data, 2, NULL, &channel); if (ischannel(*channel)) { chanrec = irc_channel_find(server, channel); if (chanrec != NULL && chanrec->joined) { /* dalnet event - can't change nick while banned in channel */ } else { /* channel is unavailable - try to join again a bit later */ channel_rejoin(server, channel); signal_stop(); } } g_free(params); }