~armagetronad-ct/armagetronad/0.4-advrim

« back to all changes in this revision

Viewing changes to src/macosx/AAGrowlPlugin.mm

  • Committer: Voodoo
  • Date: 2013-04-11 10:46:24 UTC
  • Revision ID: voodoo-20130411104624-zse1f33o7ten188z
merge -r 1454..1476 lp:armagetronad/0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 
3
 
*************************************************************************
4
 
 
5
 
ArmageTron -- Just another Tron Lightcycle Game in 3D.
6
 
Copyright (C) 2005  by 
7
 
and the AA DevTeam (see the file AUTHORS(.txt) in the main source directory)
8
 
 
9
 
**************************************************************************
10
 
 
11
 
This program is free software; you can redistribute it and/or
12
 
modify it under the terms of the GNU General Public License
13
 
as published by the Free Software Foundation; either version 2
14
 
of the License, or (at your option) any later version.
15
 
 
16
 
This program is distributed in the hope that it will be useful,
17
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 
GNU General Public License for more details.
20
 
 
21
 
You should have received a copy of the GNU General Public License
22
 
along with this program; if not, write to the Free Software
23
 
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
24
 
  
25
 
***************************************************************************
26
 
 
27
 
*/
28
 
 
29
 
#include <Growl-WithInstaller/GrowlApplicationBridge.h>
30
 
#include <Growl-WithInstaller/GrowlDefines.h>
31
 
#include "AAGrowlPlugin.h"
32
 
#include "tString.h"
33
 
 
34
 
#define PLAYER_LEFT @"Player left"
35
 
#define PLAYER_ENTERED @"Player entered"
36
 
#define PLAYER_RENAMED @"Player renamed"
37
 
#define DEATH_SUICIDE @"Death suicide"
38
 
#define DEATH_FRAG @"Death frag"
39
 
#define DEATH_TEAMKILL @"Death teamkill"
40
 
#define GAME_END @"Game end"
41
 
#define NEW_ROUND @"New Round"
42
 
#define ROUND_WINNER @"Round winner"
43
 
#define MATCH_WINNER @"Match winner"
44
 
#define NEW_MATCH @"New match"
45
 
 
46
 
@implementation AAGrowlPlugin
47
 
 
48
 
- (void)startGrowling
49
 
{    
50
 
    [GrowlApplicationBridge setGrowlDelegate:self];
51
 
}
52
 
 
53
 
//! Give Growl a list of all notifications we plan on sending
54
 
- (NSDictionary *)registrationDictionaryForGrowl
55
 
{
56
 
    NSArray *all_notes = [NSArray arrayWithObjects:PLAYER_LEFT,
57
 
                                               PLAYER_ENTERED,
58
 
                                               PLAYER_RENAMED,
59
 
                                               DEATH_SUICIDE,
60
 
                                               DEATH_FRAG,
61
 
                                               DEATH_TEAMKILL,
62
 
                                               GAME_END,
63
 
                                               NEW_ROUND,
64
 
                                               ROUND_WINNER,
65
 
                                               MATCH_WINNER,
66
 
                                               NEW_MATCH,
67
 
                                               nil];
68
 
    NSArray *def_notes = [NSArray arrayWithObjects:GAME_END,
69
 
                          NEW_ROUND,
70
 
                          ROUND_WINNER,
71
 
                          MATCH_WINNER,
72
 
                          NEW_MATCH,
73
 
                          nil];
74
 
    
75
 
            
76
 
    NSDictionary *growlNotes = [NSDictionary dictionaryWithObjectsAndKeys:
77
 
                                    all_notes, GROWL_NOTIFICATIONS_ALL,
78
 
                                    def_notes, GROWL_NOTIFICATIONS_DEFAULT,
79
 
                                    nil];
80
 
    return growlNotes;
81
 
}
82
 
 
83
 
- (NSString *)applicationNameForGrowl
84
 
{
85
 
    return @"Armagetron Advanced";
86
 
}
87
 
 
88
 
+ (void)growl:(NSString *)aTitle message:(NSString *)aMessage
89
 
{
90
 
    [GrowlApplicationBridge notifyWithTitle:aTitle
91
 
                                description:aMessage
92
 
                           notificationName:aTitle
93
 
                                   iconData:nil
94
 
                                   priority:0
95
 
                                   isSticky:NO
96
 
                               clickContext:nil];
97
 
}
98
 
 
99
 
@end