File: alog-facilities-xmpp.ads

## Documentation

Table of Contents
Class Inheritance Tree

1.     --

2.     --  Copyright (c) 2008-2009,

3.     --  Reto Buerki, Adrian-Ken Rueegsegger

4.     --

5.     --  This file is part of Alog.

6.     --

7.     --  Alog is free software; you can redistribute it and/or modify

8.     --  it under the terms of the GNU Lesser General Public License as published

9.     --  by the Free Software Foundation; either version 2.1 of the License, or

10.     --  (at your option) any later version.

11.     --

12.     --  Alog is distributed in the hope that it will be useful,

13.     --  but WITHOUT ANY WARRANTY; without even the implied warranty of

14.     --  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

15.     --  GNU Lesser General Public License for more details.

16.     --

17.     --  You should have received a copy of the GNU Lesser General Public License

18.     --  along with Alog; if not, write to the Free Software

19.     --  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,

20.     --  MA  02110-1301  USA

22.     --  XMPP-Logging (jabber) facility.

23.     --  Send log-messages to a configured Jabber ID via a given jabber server.

24.     --  AWS must be installed for this facility to work.

25.     package Alog.Facilities.XMPPTo API docTo specTo body is

27.        type InstanceTo API docTo body is new Alog.Facilities.InstanceTo API docTo specTo body with private;

28.        --  XMPP based logging facility.

30.        type Handle is access all InstanceTo API docTo specTo body;

32.        procedure Set_SenderTo API docTo body

33.          (FacilityTo API docTo body : in out InstanceTo API docTo specTo body;

34.           JID      :        String;

35.           Password :        String);

36.        --  Set sender for log messages. This procedure MUST be called before

37.        --  subsequent calls to Write_Message().

39.        procedure Set_RecipientTo API docTo body

40.          (FacilityTo API docTo body : in out InstanceTo API docTo specTo body;

41.           JID      :        String);

42.        --  Set recipient for log-messages. This procedure MUST be called before

43.        --  subsequent calls to Write_Message().

45.        procedure Set_ServerTo API docTo body

46.          (FacilityTo API docTo body : in out InstanceTo API docTo specTo body;

47.           Name     :        String);

48.        --  Set server for log-messages. This procedure MUST be called before

49.        --  subsequent calls to Write_Message().

51.        No_Sender             : exception;

52.        --  No sender ID specified. Cannot send message.

54.        No_Recipient          : exception;

55.        --  No recipient specified. Cannot send message.

57.        No_Server             : exception;

58.        --  No server specified. Cannot send message.

60.        Recipient_Not_Present : exception;

61.        --  Recipient can not be reached through specified server.

63.        Delivery_Failed       : exception;

64.        --  Message could not be delivered.

66.     private

68.        overriding

69.        procedure Write

70.          (Facility : InstanceTo API docTo specTo body;

71.           Level    : Log_LevelTo API docTo spec := Info;

72.           Msg      : String);

73.        --  Implementation of the Write procedure for XMPP.

75.        type Sender_Account is tagged

76.           record

77.              JID      : Unbounded_String;

78.              Password : Unbounded_String;

79.           end record;

80.        --  Holds sender information.

82.        type InstanceTo API docTo spec is new Alog.Facilities.InstanceTo API docTo specTo body with record

83.           Sender       : Sender_Account :=

84.             (JID      => To_Unbounded_String ("alog@localhost"),

85.              Password => To_Unbounded_String (""));

86.           --  Notification sender JID/password.

88.           Is_Sender    : Boolean := False;

89.           --  Indicates whether sender id is set.

91.           Server       : Unbounded_String;

92.           --  Server to connect to.

94.           Is_Server    : Boolean := False;

95.           --  Indicates whether a server is set.

97.           Recipient    : Unbounded_String;

98.           --  Recipient for log-mails. Must be specified before calling

99.           --  Write_Message(), else No_Recipient exception is thrown.

101.           Is_Recipient : Boolean := False;

102.           --  Indicates whether a recipient is set.

104.           Subject      : Unbounded_String :=

105.             To_Unbounded_String ("Alog: Log-Message");

106.           --  Subject of messages from Alog-System (default: Alog: Log-Message).

107.        end record;

109.     end Alog.Facilities.XMPPTo API docTo specTo body;