text stringlengths 0 234 |
|---|
begin |
Client_EP_Receive := LLU.End_Point_Type'Input (I_Buffer); |
Client_EP_Handler := LLU.End_Point_Type'Input (I_Buffer); |
Nick := ASU.Unbounded_String'Input (I_Buffer); |
Active_Clients.Get(Active_Map,Nick,Client_Data,Success); |
if Success then |
Accepted := False; |
ATI.Put_Line("INIT received from " & ASU.To_String(Nick) |
& ": IGNORED. nick already used"); |
else |
ATI.Put_Line("INIT received from " & ASU.To_String(Nick) |
& ": ACCEPTED"); |
begin |
Accepted := True; |
Client_Data.Client_EP := Client_EP_Handler; |
Client_Data.Time := Ada.Calendar.Clock; |
Old_Clients.Get(Old_Map,Nick_to_Integer(Nick),Old_Client,Success); |
if Success then |
Old_Clients.Delete (Old_Map,Nick_to_Integer(Nick),Success); |
Comment := ASU.To_Unbounded_String(ASU.To_String(Nick) & |
" rejoins the chat"); |
else |
Comment := ASU.To_Unbounded_String(ASU.To_String(Nick) & |
" joins the chat"); |
end if; |
Active_Clients.Put (Active_Map,Nick,Client_Data); |
-- Automatic := True |
Send_To_Readers (True,Nick,Comment,O_Buffer); |
exception |
when Active_Clients.Full_Map => |
Ban_Nick := Client_To_Ban(Active_Map); |
Old_Client.Nick := Ban_Nick; |
Old_Client.Time := Ada.Calendar.Clock; |
Old_Clients.Put (Old_Map,Nick_to_Integer(Ban_Nick),Old_Client); |
Ban_Message := ASU.To_Unbounded_String(ASU.To_String(Ban_Nick) |
& " banned for being idle too long"); |
Server_To_All (Ban_Message,O_Buffer); |
Active_Clients.Delete (Active_Map,Ban_Nick,Success); |
Active_Clients.Put (Active_Map,Nick,Client_Data); |
-- Automatic := True |
Send_To_Readers (True,Nick,Comment,O_Buffer); |
Function Definition: procedure Unknown_Fail is |
Function Body: result : Boolean; |
begin |
result := Connect ("unknown", 1_984); |
Fail (Message => "Exception expected"); |
exception |
when Error : BaseXException => |
null; |
end Unknown_Fail; |
procedure Port_Fail is |
result : Boolean; |
begin |
result := Connect ("localhost", 1_985); |
Fail (Message => "Exception expected"); |
exception |
when Error : BaseXException => |
null; |
end Port_Fail; |
procedure Connect_Auth is |
result : Boolean; |
begin |
result := Connect ("localhost", 1_984); |
Assert (Condition => result = True, Message => "Connect test"); |
result := Authenticate ("unknown", "test"); |
Assert (Condition => result = False, Message => "Auth test"); |
Close; |
end Connect_Auth; |
procedure Connect_Pass is |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.