This file is indexed.

/usr/share/ada/adainclude/aws/aws-jabber-client.ads is in libaws2.10.2-dev 2.10.2-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
------------------------------------------------------------------------------
--                              Ada Web Server                              --
--                                                                          --
--                     Copyright (C) 2008-2009, AdaCore                     --
--                                                                          --
--  This library is free software; you can redistribute it and/or modify    --
--  it under the terms of the GNU General Public License as published by    --
--  the Free Software Foundation; either version 2 of the License, or (at   --
--  your option) any later version.                                         --
--                                                                          --
--  This library is distributed in the hope that it will be useful, but     --
--  WITHOUT ANY WARRANTY; without even the implied warranty of              --
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       --
--  General Public License for more details.                                --
--                                                                          --
--  You should have received a copy of the GNU General Public License       --
--  along with this library; if not, write to the Free Software Foundation, --
--  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.          --
--                                                                          --
------------------------------------------------------------------------------

with Ada.Strings.Unbounded;

private with AWS.Net;

package AWS.Jabber.Client is

   use Ada.Strings.Unbounded;

   type Account is limited private;
   type Account_Access is not null access all Account;

   Server_Error : exception;
   --  Raised by any routine below when an server or protocol error occurs. A
   --  message is attached to the exception, this correspond to the <error>
   --  XML protocol tag if present.

   type Port is new Positive;
   Default_Port : Port := 5222;

   type Authentication_Mechanism is
     (More_Secure_Mechanism, Digest_Md5_Mechanism, Plain_Mechanism);
   --  Select PLAIN or DIGEST_MD5
   --  if More_Secure_Mechanism choose DIGEST_MD5 but fallback to PLAIN if
   --  DIGEST_MD5 is not supported.

   type Jabber_ID is new String;

   function To_Jabber_ID
     (Username : String;
      Server   : String;
      Resource : String := "") return Jabber_ID;
   --  Returns a Jabber ID (username@server/resource)

   --  Jabber Hook

   type Message_Type is (M_Chat, M_Normal, M_Group_Chat, M_Headline, M_Error);

   type Message_Hook is not null access procedure
     (From         : Jabber_ID;
      Message_Type : Client.Message_Type;
      Subject      : String;
      Content      : String);

   type Presence_Hook is not null access procedure
     (From   : Jabber_ID;
      Status : String);

   procedure IO_Presence
     (From    : Jabber_ID;
      Status  : String);

   procedure IO_Message
     (From         : Jabber_ID;
      Message_Type : Client.Message_Type;
      Subject      : String;
      Content      : String);

   procedure Set_Presence_Hook
     (Account : in out Client.Account;
      Hook    : Presence_Hook);

   procedure Set_Host
     (Account : in out Client.Account;
      Host    : String);

   procedure Set_Port
     (Account : in out Client.Account;
      Port    : Client.Port);

   procedure Set_Login_Information
     (Account  : in out Client.Account;
      User     : String;
      Password : String;
      Resource : String := "");

   procedure Set_Authentication_Type
     (Account   : in out Client.Account;
      Auth_Type : Authentication_Mechanism);

   procedure Connect (Account : in out Client.Account);
   --  Connect to the jabber server

   procedure Close (Account : in out Client.Account);
   --  Close the connection

   procedure Send
     (Account      : Client.Account;
      JID          : Jabber_ID;
      Content      : String;
      Subject      : String := "";
      Message_Type : Client.Message_Type := M_Normal);
   --  Send a message to user JID (Jabber ID) via the specified Server. The
   --  message is composed of Subject and a body (Content).

private
   --  Jabber Client and Server open a stream and both communicate with each
   --  others via this channel. All messages exchanged are XML encoded. Both
   --  streams (client -> server and server -> client) have a common
   --  structure:
   --
   --  <?xml version=""1.0"" encoding=""UTF-8"" ?>"
   --  <stream:stream>
   --     <message> ... </message>
   --     <presence> ... </presence>
   --  </stream:stream>
   --
   --  As both streams are sent asynchronously, we use a Task to read the
   --  incoming stream. This task is responsible to accept incoming XML
   --  message, to parse them, create a Message object and run the Presence and
   --  Message hooks.

   type Jabber_Hooks is limited record
      Presence : Presence_Hook := IO_Presence'Access;
      Message  : Message_Hook  := IO_Message'Access;
   end record;

   ---------------------
   -- Incoming_Stream --
   ---------------------

   --  Read incoming XML messages, parse them and add them to the
   --  Mailbox. This task will terminate with the connection socket will be
   --  closed by the client.

   task type Incoming_Stream (Account : Account_Access);
   type Incoming_Stream_Access is access Incoming_Stream;

   type Connection_State is
     (Initialize_Connection, Start_Authentication, Connected);

   type User_Data is limited record
      Name     : Unbounded_String;
      Password : Unbounded_String;
      Resource : Unbounded_String;
      JID      : Unbounded_String;
   end record;

   type Account is limited record
      Self       : Account_Access := Account'Unchecked_Access;
      User       : User_Data;
      Host       : Unbounded_String;
      Port       : Client.Port := Default_Port;
      Stream     : Incoming_Stream_Access;
      Sock       : Net.Socket_Access;
      Is_Running : Boolean := False;
      SID        : Unbounded_String;
      Auth_Type  : Authentication_Mechanism := More_Secure_Mechanism;
      Hooks      : Jabber_Hooks;
   end record;

end AWS.Jabber.Client;