1
// PidginSetStatusAction.cs
3
// GNOME Do is the legal property of its developers, whose names are too numerous
4
// to list here. Please refer to the COPYRIGHT file distributed with this
5
// source distribution.
7
// This program is free software: you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation, either version 3 of the License, or
10
// (at your option) any later version.
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with this program. If not, see <http://www.gnu.org/licenses/>.
21
using System.Collections.Generic;
25
namespace Do.Addins.Pidgin
27
public sealed class PidginSetStatusAction : IAction
29
private IItem [] pidginStatuses;
31
public PidginSetStatusAction ()
33
pidginStatuses = new IItem [] {new PidginStatusTypeItem (1),
34
new PidginStatusTypeItem (2), new PidginStatusTypeItem (3),
35
new PidginStatusTypeItem (4), new PidginStatusTypeItem (5)};
38
public string Name { get { return "Set status"; } }
39
public string Description { get { return "Set pidgin status message"; } }
40
public string Icon { get { return "pidgin"; } }
42
public Type [] SupportedItemTypes {
45
typeof (PidginSavedStatusItem),
51
public Type [] SupportedModifierItemTypes {
54
typeof (PidginStatusTypeItem),
59
public bool SupportsItem (IItem item)
64
public bool ModifierItemsOptional {
68
public bool SupportsModifierItemForItems (IItem [] items, IItem modItem)
70
if (items [0] is ITextItem)
75
public IItem [] DynamicModifierItemsForItem (IItem item)
77
return pidginStatuses;
80
public IItem [] Perform (IItem [] items, IItem [] modItems)
85
Pidgin.IPurpleObject prpl = Pidgin.GetPurpleObject ();
87
if (items [0] is PidginSavedStatusItem) {
88
status = (items [0] as PidginSavedStatusItem).ID;
89
prpl.PurpleSavedstatusActivate (status);
91
message = (items [0] as ITextItem).Text;
92
if (modItems.Length > 0)
93
status = (int) (modItems [0] as PidginStatusTypeItem).Status;
95
status = prpl.PurpleSavedstatusGetType (prpl.PurpleSavedstatusGetCurrent ());
96
Pidgin.PurpleSetAvailabilityStatus ((uint) status, message);
b'\\ No newline at end of file'