~do-core/do/fix-the-shitstorm

« back to all changes in this revision

Viewing changes to Pidgin/src/PidginStatusItemSource.cs

Adding missing files and Archive plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// PidginStatusItemSource.cs created with MonoDevelop
 
2
// User: alex at 12:19 PM 4/8/2008
 
3
//
 
4
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
 
5
//
 
6
 
 
7
using System;
 
8
using System.IO;
 
9
using System.Xml;
 
10
using System.Collections.Generic;
 
11
 
 
12
using Do.Universe;
 
13
 
 
14
namespace Pidgin
 
15
{
 
16
        public class PidginStatusItemSource : IItemSource
 
17
        {
 
18
                private static readonly string status_file;
 
19
                private List<IItem> statuses;
 
20
                
 
21
                static PidginStatusItemSource() {
 
22
                        string home =  Environment.GetFolderPath (Environment.SpecialFolder.Personal);
 
23
                        status_file = "~/.purple/status.xml".Replace("~", home);
 
24
                }
 
25
                
 
26
                public PidginStatusItemSource() {
 
27
                        statuses = new List<IItem> ();
 
28
                        UpdateItems();
 
29
                }
 
30
                
 
31
                public Type[] SupportedItemTypes {
 
32
                        get {
 
33
                                return new Type[] {
 
34
                                        typeof (PidginStatusItem),
 
35
                                };
 
36
                        }
 
37
                }
 
38
                
 
39
                public enum status {
 
40
                        offline = 1, available, unavailable, invisible, away,
 
41
                        extended_away, mobile, tune
 
42
                };
 
43
                
 
44
                public string Name { get { return "Pidgin Statuses"; } }
 
45
                public string Description { get { return ""; } }
 
46
                public string Icon {get { return "pidgin"; } }
 
47
                
 
48
                public ICollection<IItem> Items {
 
49
                        get { return statuses; }
 
50
                }
 
51
                
 
52
                public ICollection<IItem> ChildrenOfItem (IItem item)
 
53
                {
 
54
                        return null;
 
55
                }
 
56
                
 
57
                public void UpdateItems () {
 
58
                        XmlDocument statuses_xml = new XmlDocument ();
 
59
                        statuses.Clear ();
 
60
                        try {
 
61
                                statuses_xml.Load (status_file);
 
62
                                foreach (XmlNode status in statuses_xml.GetElementsByTagName ("status")) {
 
63
                                }
 
64
                        } catch { }
 
65
                }
 
66
        }
 
67
}