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.
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.
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
21
using System.Collections;
22
using System.Collections.Generic;
28
public abstract class AbstractChatItem : Item {
30
public AbstractChatItem(Chat s) {
33
public override string Name {
34
get { return chat.Title; }
36
public override string Description {
38
return "Last Message: "+chat.TimeAsString;
41
public override string Icon {
42
get { return chat.Icon; }
44
public string ChatID {
45
get { return chat.ChatID; }
47
public DateTime Time {
48
get { return chat.Time; }
52
public abstract class AbstractChatItemSource : ItemSource {
53
protected List<Item> items;
54
public AbstractChatItemSource () {
55
items = new List<Item> ();
59
public override string Description {
62
public override string Icon {
63
get { return "skype"; }
65
public override IEnumerable<Item> Items {
68
public override IEnumerable<Item> ChildrenOfItem (Item item) {
71
public override IEnumerable<Type> SupportedItemTypes {
72
get { return new Type[] { typeof (AbstractChatItem), }; }
77
public abstract class AbstractChatAction : Act {
78
public override string Description {
81
public override bool SupportsItem (Item item) {
84
public override bool SupportsModifierItemForItems (IEnumerable<Item> items, Item modItem) {
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);
94
////////////////////////////////////////////////////
95
// Recent Chat Item, Action
97
public class RecentChatItem : AbstractChatItem {
98
public RecentChatItem(Chat s) : base(s) {}
101
public class RecentChatItemSource : AbstractChatItemSource {
102
public override string Name {
103
get { return "Source: Recent Chats"; }
105
public override void UpdateItems () {
107
Chat[] cs = SkypeAPI.Instance.GetRecentChats();
108
if (cs == null) return;
109
foreach (Chat i in cs){
110
items.Add(new RecentChatItem(i));
115
public class OpenRecentChatAction : AbstractChatAction {
116
public OpenRecentChatAction() {}
117
public override string Name {
118
get { return "Open Recent Chat"; }
120
public override string Icon {
121
get { return SkypeAPI.RES("CallList_128x128.png"); }
123
public override IEnumerable<Type> SupportedItemTypes {
124
get { return new Type[] { typeof (RecentChatItem) }; }
128
////////////////////////////////////////////////////
129
// Missed Item, Source and Action
131
public class MissedChatItem : AbstractChatItem {
132
public MissedChatItem(Chat s) : base(s) {}
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");
142
public class MissedChatItemSource : AbstractChatItemSource {
143
public override string Name {
144
get { return "Source: Missed Chats"; }
146
public override void UpdateItems () {
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));
157
public class OpenMissedChatAction : AbstractChatAction {
158
public OpenMissedChatAction() { }
159
public override string Name {
160
get { return "Open Missed Chat"; }
162
public override string Icon {
163
get { return SkypeAPI.RES("Events_128x128.png"); }
165
public override IEnumerable<Type> SupportedItemTypes {
166
get { return new Type[] { typeof (MissedChatItem) }; }
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);
176
SkypeAPI.Instance.OpenChat(i.ChatID);
182
////////////////////////////////////////////////////
183
// Bookmarked Item, Source and Action
185
public class BookmarkedChatItem : AbstractChatItem {
186
public BookmarkedChatItem(Chat s) : base(s) {}
189
public class BookmarkedChatItemSource : AbstractChatItemSource {
190
public override string Name {
191
get { return "Source: Bookmarked Chats"; }
193
public override void UpdateItems () {
195
Chat[] cs = SkypeAPI.Instance.GetBookmarkedChats();
196
if (cs == null) return;
197
foreach (Chat i in cs){
198
items.Add(new BookmarkedChatItem(i));
203
public class OpenBookmarkedChatAction : AbstractChatAction {
204
public OpenBookmarkedChatAction() { }
205
public override string Name {
206
get { return "Open Bookmarked Chat"; }
208
public override string Icon {
209
get { return SkypeAPI.RES("History_128x128.png"); }
211
public override IEnumerable<Type> SupportedItemTypes {
212
get { return new Type[] { typeof (BookmarkedChatItem) }; }