@@ -585,21 +585,7 @@ void Server::AsyncRunStep(bool initial_step)
585
585
MutexAutoLock lock (m_env_mutex);
586
586
while (!m_admin_chat->command_queue .empty ()) {
587
587
ChatEvent *evt = m_admin_chat->command_queue .pop_frontNoEx ();
588
- if (evt->type == CET_NICK_ADD) {
589
- // The terminal informed us of its nick choice
590
- m_admin_nick = ((ChatEventNick *)evt)->nick ;
591
- if (!m_script->getAuth (m_admin_nick, NULL , NULL )) {
592
- errorstream << " You haven't set up an account." << std::endl
593
- << " Please log in using the client as '"
594
- << m_admin_nick << " ' with a secure password." << std::endl
595
- << " Until then, you can't execute admin tasks via the console," << std::endl
596
- << " and everybody can claim the user account instead of you," << std::endl
597
- << " giving them full control over this server." << std::endl;
598
- }
599
- } else {
600
- assert (evt->type == CET_CHAT);
601
- handleAdminChat ((ChatEventChat *)evt);
602
- }
588
+ handleChatInterfaceEvent (evt);
603
589
delete evt;
604
590
}
605
591
}
@@ -2749,6 +2735,25 @@ void Server::UpdateCrafting(Player* player)
2749
2735
plist->changeItem (0 , preview);
2750
2736
}
2751
2737
2738
+ void Server::handleChatInterfaceEvent (ChatEvent *evt)
2739
+ {
2740
+ if (evt->type == CET_NICK_ADD) {
2741
+ // The terminal informed us of its nick choice
2742
+ m_admin_nick = ((ChatEventNick *)evt)->nick ;
2743
+ if (!m_script->getAuth (m_admin_nick, NULL , NULL )) {
2744
+ errorstream << " You haven't set up an account." << std::endl
2745
+ << " Please log in using the client as '"
2746
+ << m_admin_nick << " ' with a secure password." << std::endl
2747
+ << " Until then, you can't execute admin tasks via the console," << std::endl
2748
+ << " and everybody can claim the user account instead of you," << std::endl
2749
+ << " giving them full control over this server." << std::endl;
2750
+ }
2751
+ } else {
2752
+ assert (evt->type == CET_CHAT);
2753
+ handleAdminChat ((ChatEventChat *)evt);
2754
+ }
2755
+ }
2756
+
2752
2757
std::wstring Server::handleChat (const std::string &name, const std::wstring &wname,
2753
2758
const std::wstring &wmessage, u16 peer_id_to_avoid_sending)
2754
2759
{
0 commit comments