~ubuntu-branches/ubuntu/jaunty/gnome-do-plugins/jaunty-proposed

« back to all changes in this revision

Viewing changes to Skype/src/Chat.cs

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers, Christopher James Halse Rogers, Iain Lane
  • Date: 2009-02-05 16:58:51 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090205165851-bku2c9rmrny93b31
Tags: 0.8.0.2+dfsg-1~ubuntu1
[ Christopher James Halse Rogers ]
* New upstream version
* debian/control:
  + gnome-sharp2 transition (LP: #314516)
  + Add banshee build-dep
  + Drop monodevelop build-dep; upstream uses mautil rather than mdtool now
  + Bump required gnome-do version in Build-Dep & Depends.
  + Suggest Banshee
* debian/copyright:
  + Refresh for new upstream version; new plugins added.
* debian/rules:
  + Rework clean target to simply delete files generated by autoreconf,
    rather than trying to preserve them.
  + Remove XDG_CONFIG_DIR hack needed for mdtool
* debian/patches/01_firefox_iceweasel_rename:
  + Refresh for new upsteam changes.
  + Extend to also make the Firefox bookmark plugin index iceweasel bookmarks

[ Iain Lane ]
* Tag pkg-cli-apps SVN revision into Jaunty, to get in before Feature
  Freeze. Should be a sync after the next Debian upload.
* debian/control: Add ${misc:Depends} build-dep 
* debian/rules: Do not fail if configure is missing (e.g. clean twice in a
  row) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Chat.cs
 
2
//
 
3
// This program is free software; you can redistribute it and/or modify
 
4
// it under the terms of the GNU General Public License as published by
 
5
// the Free Software Foundation; either version 3 of the License, or
 
6
// (at your option) any later version.
 
7
//
 
8
// This program is distributed in the hope that it will be useful,
 
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
11
// GNU General Public License for more details.
 
12
// 
 
13
// You should have received a copy of the GNU General Public License
 
14
// along with this program; if not, see <http://www.gnu.org/licenses/> or 
 
15
// write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
 
16
// Boston, MA 02111-1307 USA
 
17
//
 
18
 
 
19
using System;
 
20
using System.Linq;
 
21
using System.Collections;
 
22
using System.Collections.Generic;
 
23
 
 
24
using Do.Universe;
 
25
 
 
26
namespace Skype {
 
27
 
 
28
  public abstract class AbstractChatItem : Item {
 
29
    private Chat chat;
 
30
    public AbstractChatItem(Chat s) {
 
31
      chat = s;
 
32
    }
 
33
    public override string Name {
 
34
      get { return chat.Title; }
 
35
    }
 
36
    public override string Description {
 
37
      get {
 
38
        return "Last Message: "+chat.TimeAsString;
 
39
      }
 
40
    }
 
41
    public override string Icon {
 
42
      get { return chat.Icon; }
 
43
    }
 
44
    public string ChatID {
 
45
      get { return chat.ChatID; }
 
46
    }
 
47
    public DateTime Time {
 
48
      get { return chat.Time; }
 
49
    }
 
50
  }
 
51
 
 
52
  public abstract class AbstractChatItemSource : ItemSource {
 
53
    protected List<Item> items;
 
54
    public AbstractChatItemSource () {
 
55
      items = new List<Item> ();
 
56
      UpdateItems ();
 
57
    }
 
58
 
 
59
    public override string Description {
 
60
      get { return ""; }
 
61
    }
 
62
    public override string Icon {
 
63
      get { return "skype"; }
 
64
    }
 
65
    public override IEnumerable<Item> Items {
 
66
      get { return items; }
 
67
    }
 
68
    public override IEnumerable<Item> ChildrenOfItem (Item item) {
 
69
      return null;
 
70
    }
 
71
    public override IEnumerable<Type> SupportedItemTypes {
 
72
      get { return new Type[] { typeof (AbstractChatItem), }; }
 
73
    }
 
74
 
 
75
  }
 
76
 
 
77
  public abstract class AbstractChatAction : Act {
 
78
    public override string Description {
 
79
      get { return ""; }
 
80
    }
 
81
    public override bool SupportsItem (Item item) {
 
82
      return true;
 
83
    }
 
84
    public override bool SupportsModifierItemForItems (IEnumerable<Item> items, Item modItem) {
 
85
      return true;
 
86
    }
 
87
    public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems) {
 
88
      AbstractChatItem i = items.First () as AbstractChatItem;
 
89
      SkypeAPI.Instance.OpenChat(i.ChatID);
 
90
      return null;
 
91
    }
 
92
  }
 
93
 
 
94
  ////////////////////////////////////////////////////
 
95
  // Recent Chat Item, Action
 
96
 
 
97
  public class RecentChatItem : AbstractChatItem {
 
98
    public RecentChatItem(Chat s) : base(s) {}
 
99
  }
 
100
 
 
101
  public class RecentChatItemSource : AbstractChatItemSource {
 
102
    public override string Name {
 
103
      get { return "Source: Recent Chats"; }
 
104
    }
 
105
    public override void UpdateItems () {
 
106
      items.Clear();
 
107
      Chat[] cs = SkypeAPI.Instance.GetRecentChats();
 
108
      if (cs == null) return;
 
109
      foreach (Chat i in cs){
 
110
        items.Add(new RecentChatItem(i));
 
111
      }
 
112
    }
 
113
  }
 
114
 
 
115
  public class OpenRecentChatAction : AbstractChatAction {
 
116
    public OpenRecentChatAction() {}
 
117
    public override string Name {
 
118
      get { return "Open Recent Chat"; }
 
119
    }
 
120
    public override string Icon {
 
121
      get { return SkypeAPI.RES("CallList_128x128.png"); }
 
122
    }
 
123
    public override IEnumerable<Type> SupportedItemTypes {
 
124
      get { return new Type[] { typeof (RecentChatItem) }; }
 
125
    }
 
126
  }
 
127
 
 
128
  ////////////////////////////////////////////////////
 
129
  // Missed Item, Source and Action
 
130
 
 
131
  public class MissedChatItem : AbstractChatItem {
 
132
    public MissedChatItem(Chat s) : base(s) {}
 
133
  }
 
134
 
 
135
  public class MissedAllChat : Chat {
 
136
    public static string CHAT_ID = "AllMissedItems";
 
137
    public MissedAllChat() : base(CHAT_ID,"All missed chats",DateTime.Now) {
 
138
      icon = SkypeAPI.RES("MessageMultipleUsers_128x128.png");
 
139
    }
 
140
  }
 
141
 
 
142
  public class MissedChatItemSource : AbstractChatItemSource {
 
143
    public override string Name {
 
144
      get { return "Source: Missed Chats"; }
 
145
    }
 
146
    public override void UpdateItems () {
 
147
      items.Clear();
 
148
      items.Add(new MissedChatItem(new MissedAllChat()));
 
149
      Chat[] cs = SkypeAPI.Instance.GetMissedChats();
 
150
      if (cs == null || cs.Length == 0) return;
 
151
      foreach (Chat i in cs){
 
152
        items.Add(new MissedChatItem(i));
 
153
      }
 
154
    }
 
155
  }
 
156
 
 
157
  public class OpenMissedChatAction : AbstractChatAction {
 
158
    public OpenMissedChatAction() { }
 
159
    public override string Name {
 
160
      get { return "Open Missed Chat"; }
 
161
    }
 
162
    public override string Icon {
 
163
      get { return SkypeAPI.RES("Events_128x128.png"); }
 
164
    }
 
165
    public override IEnumerable<Type> SupportedItemTypes {
 
166
      get { return new Type[] { typeof (MissedChatItem) }; }
 
167
    }
 
168
    public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems) {
 
169
      AbstractChatItem i = items.First () as AbstractChatItem;
 
170
      if (i.ChatID == MissedAllChat.CHAT_ID) {
 
171
        Chat[] cs = SkypeAPI.Instance.GetMissedChats();
 
172
        foreach (Chat j in cs){
 
173
          SkypeAPI.Instance.OpenChat(j.ChatID);
 
174
        }
 
175
      } else {
 
176
        SkypeAPI.Instance.OpenChat(i.ChatID);
 
177
      }
 
178
      return null;
 
179
    }
 
180
  }
 
181
 
 
182
  ////////////////////////////////////////////////////
 
183
  // Bookmarked Item, Source and Action
 
184
 
 
185
  public class BookmarkedChatItem : AbstractChatItem {
 
186
    public BookmarkedChatItem(Chat s) : base(s) {}
 
187
  }
 
188
 
 
189
  public class BookmarkedChatItemSource : AbstractChatItemSource {
 
190
    public override string Name {
 
191
      get { return "Source: Bookmarked Chats"; }
 
192
    }
 
193
    public override void UpdateItems () {
 
194
      items.Clear();
 
195
      Chat[] cs = SkypeAPI.Instance.GetBookmarkedChats();
 
196
      if (cs == null) return;
 
197
      foreach (Chat i in cs){
 
198
        items.Add(new BookmarkedChatItem(i));
 
199
      }
 
200
    }
 
201
  }
 
202
 
 
203
  public class OpenBookmarkedChatAction : AbstractChatAction {
 
204
    public OpenBookmarkedChatAction() { }
 
205
    public override string Name {
 
206
      get { return "Open Bookmarked Chat"; }
 
207
    }
 
208
    public override string Icon {
 
209
      get { return SkypeAPI.RES("History_128x128.png"); }
 
210
    }
 
211
    public override IEnumerable<Type> SupportedItemTypes {
 
212
      get { return new Type[] { typeof (BookmarkedChatItem) }; }
 
213
    }
 
214
  }
 
215
 
 
216
}