Software /
code /
prosody
Annotate
core/eventmanager.lua @ 3432:7f3e45955725
s2smanager: brackets, just to be sure :)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 03 Aug 2010 09:40:06 +0100 |
parent | 2986:fff153f7f4de |
rev | line source |
---|---|
1522
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1514
diff
changeset
|
1 -- Prosody IM |
2923
b7049746bd29
Update copyright headers for 2010
Matthew Wild <mwild1@gmail.com>
parents:
1522
diff
changeset
|
2 -- Copyright (C) 2008-2010 Matthew Wild |
b7049746bd29
Update copyright headers for 2010
Matthew Wild <mwild1@gmail.com>
parents:
1522
diff
changeset
|
3 -- Copyright (C) 2008-2010 Waqas Hussain |
1522
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1514
diff
changeset
|
4 -- |
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1514
diff
changeset
|
5 -- This project is MIT/X11 licensed. Please see the |
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1514
diff
changeset
|
6 -- COPYING file in the source package for more information. |
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1514
diff
changeset
|
7 -- |
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1514
diff
changeset
|
8 |
1514
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
9 |
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
10 local t_insert = table.insert; |
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
11 local ipairs = ipairs; |
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
12 |
2986
fff153f7f4de
eventmanager, prosody: Adapt eventmanager to use prosody.events, as a step towards removing it entirely
Matthew Wild <mwild1@gmail.com>
parents:
2923
diff
changeset
|
13 local events = _G.prosody.events; |
fff153f7f4de
eventmanager, prosody: Adapt eventmanager to use prosody.events, as a step towards removing it entirely
Matthew Wild <mwild1@gmail.com>
parents:
2923
diff
changeset
|
14 |
1514
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
15 module "eventmanager" |
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
16 |
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
17 local event_handlers = {}; |
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
18 |
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
19 function add_event_hook(name, handler) |
2986
fff153f7f4de
eventmanager, prosody: Adapt eventmanager to use prosody.events, as a step towards removing it entirely
Matthew Wild <mwild1@gmail.com>
parents:
2923
diff
changeset
|
20 return events.add_handler(name, handler); |
1514
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
21 end |
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
22 |
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
23 function fire_event(name, ...) |
2986
fff153f7f4de
eventmanager, prosody: Adapt eventmanager to use prosody.events, as a step towards removing it entirely
Matthew Wild <mwild1@gmail.com>
parents:
2923
diff
changeset
|
24 return events.fire_event(name, ...); |
1514
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
25 end |
0c706c3d2e30
eventmanager: Convert from Windows line endings
Matthew Wild <mwild1@gmail.com>
parents:
569
diff
changeset
|
26 |
2986
fff153f7f4de
eventmanager, prosody: Adapt eventmanager to use prosody.events, as a step towards removing it entirely
Matthew Wild <mwild1@gmail.com>
parents:
2923
diff
changeset
|
27 return _M; |