1 package Thrasher
::Protocol
::Purple
::Vars
;
7 our @ISA = qw(Exporter);
10 $ERROR_INVALID_USERNAME
11 $ERROR_AUTHENTICATION_FAILED
12 $ERROR_AUTHENTICATION_IMPOSSIBLE
14 $ERROR_ENCRYPTION_ERROR
16 $ERROR_INVALID_SETTINGS
17 $ERROR_CERT_NOT_PROVIDED
20 $ERROR_CERT_NOT_ACTIVATED
21 $ERROR_CERT_HOSTNAME_MISMATCH
22 $ERROR_CERT_FINGERPRINT_MISMATCH
23 $ERROR_CERT_SELF_SIGNED
24 $ERROR_CERT_OTHER_ERROR
27 our @EXPORT_OK = (qw(%purple_presence %purple_presence_to_xmpp), @ERROR_CODES);
28 our %EXPORT_TAGS = (all => \@EXPORT_OK,
29 error_codes => \@ERROR_CODES);
31 # mirror server.h enum
43 # Mirror of PurpleConnectionError from connection.h
44 our $ERROR_NETWORK_ERROR = 0;
45 our $ERROR_INVALID_USERNAME = 1;
46 our $ERROR_AUTHENTICATION_FAILED = 2;
47 our $ERROR_AUTHENTICATION_IMPOSSIBLE = 3;
48 our $ERROR_NO_SSL_SUPPORT = 4;
49 our $ERROR_ENCRYPTION_ERROR = 5;
50 our $ERROR_NAME_IN_USE = 6;
51 our $ERROR_INVALID_SETTINGS = 7;
52 our $ERROR_CERT_NOT_PROVIDED = 8;
53 our $ERROR_CERT_UNTRUSTED = 9;
54 our $ERROR_CERT_EXPIRED = 10;
55 our $ERROR_CERT_NOT_ACTIVATED = 11;
56 our $ERROR_CERT_HOSTNAME_MISMATCH = 12;
57 our $ERROR_CERT_FINGERPRINT_MISMATCH = 13;
58 our $ERROR_CERT_SELF_SIGNED = 14;
59 our $ERROR_CERT_OTHER_ERROR = 15;
60 our $ERROR_OTHER_ERROR = 16;
63 # mirror libpurple/status.h PurpleStatusPrimitive enum
64 our $PURPLE_STATUS_UNSET = 0;
65 our $PURPLE_STATUS_OFFLINE = 1;
66 our $PURPLE_STATUS_AVAILABLE = 2;
67 our $PURPLE_STATUS_UNAVAILABLE = 3;
68 our $PURPLE_STATUS_INVISIBLE = 4;
69 our $PURPLE_STATUS_AWAY = 5;
70 our $PURPLE_STATUS_EXTENDED_AWAY = 6;
71 our $PURPLE_STATUS_MOBILE = 7;
72 our $PURPLE_STATUS_TUNE = 8;
73 our $PURPLE_STATUS_NUM_PRIMITIVES = 9;
75 # mirror tlv_struct enum in server.h
90 USERNAME => $USERNAME,
91 PASSWORD => $PASSWORD,
93 RECIPIENT => $RECIPIENT,
98 ERROR_CODE=> $ERROR_CODE,
102 my %tlv_reverse_lookup = reverse %tlv_type;
105 our %purple_presence = (
106 unset => $PURPLE_STATUS_UNSET,
107 offline => $PURPLE_STATUS_OFFLINE,
108 available => $PURPLE_STATUS_AVAILABLE,
109 unavailable => $PURPLE_STATUS_UNAVAILABLE,
110 invisible => $PURPLE_STATUS_INVISIBLE,
111 away => $PURPLE_STATUS_AWAY,
112 xaway => $PURPLE_STATUS_EXTENDED_AWAY,
113 mobile => $PURPLE_STATUS_MOBILE,
114 tune => $PURPLE_STATUS_TUNE,
115 num_prim => $PURPLE_STATUS_NUM_PRIMITIVES,
118 our %purple_presence_to_xmpp = (
119 $PURPLE_STATUS_OFFLINE => [ 'unavailable', '', ],
120 $PURPLE_STATUS_AVAILABLE => [ '', '', ],
121 $PURPLE_STATUS_UNAVAILABLE => [ '', 'dnd' ],
122 $PURPLE_STATUS_INVISIBLE => [ 'unavailable', '', ],
123 $PURPLE_STATUS_AWAY => [ '', 'away', ],
124 $PURPLE_STATUS_EXTENDED_AWAY => [ '', 'xa', ],
132 'send_msg' => $SEND_MSG,
133 'recv_msg' => $RECV_MSG,
134 'presence' => $PRESENCE,
135 'subscr_add' => $SUBSCR_ADD,
136 'subscr_rem' => $SUBSCR_REM,
137 'buddy_add' => $BUDDY_ADD,
138 'buddy_rem' => $BUDDY_REM,