first commit
58
.gitignore
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# python
|
||||||
|
*.py[co]
|
||||||
|
ipython_autoexec.py
|
||||||
|
|
||||||
|
|
||||||
|
# system
|
||||||
|
.DS_Store
|
||||||
|
*.pid
|
||||||
|
*.log
|
||||||
|
*.sw[ponm]
|
||||||
|
*~
|
||||||
|
|
||||||
|
# xcode
|
||||||
|
build/*
|
||||||
|
*.perspective
|
||||||
|
*.perspectivev3
|
||||||
|
*.pbxuser
|
||||||
|
*.xcworkspace
|
||||||
|
*.mode1
|
||||||
|
*.mode2v3
|
||||||
|
*.mode1v3
|
||||||
|
xcuserdata
|
||||||
|
Snapshots
|
||||||
|
|
||||||
|
# java/andriod
|
||||||
|
*.apk
|
||||||
|
*.ap_
|
||||||
|
*.dex
|
||||||
|
*.class
|
||||||
|
bin/
|
||||||
|
gen/
|
||||||
|
|
||||||
|
# Eclipse/Idea/Dev Env
|
||||||
|
env/
|
||||||
|
.idea
|
||||||
|
.cache
|
||||||
|
tags
|
||||||
|
temp
|
||||||
|
.coverage
|
||||||
|
*.packed
|
||||||
|
*.pydevproject
|
||||||
|
.project
|
||||||
|
.metadata
|
||||||
|
bin/**
|
||||||
|
tmp/**
|
||||||
|
tmp/**/*
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*~.nib
|
||||||
|
local.properties
|
||||||
|
.classpath
|
||||||
|
.settings/
|
||||||
|
.loadpath
|
||||||
|
.externalToolBuilders/
|
||||||
|
*.launch
|
||||||
|
.cproject
|
||||||
|
.buildpath
|
BIN
OSX/English.lproj/InfoPlist.strings
Normal file
28
OSX/English.lproj/MainMenu.nib/classes.nib
generated
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
IBClasses = (
|
||||||
|
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||||
|
{
|
||||||
|
ACTIONS = {
|
||||||
|
goDEVSDF1 = id;
|
||||||
|
goDonate = id;
|
||||||
|
goiMoodURL = id;
|
||||||
|
iMoodUpdater = id;
|
||||||
|
setMoodPrefs = id;
|
||||||
|
};
|
||||||
|
CLASS = iMoodUpdater;
|
||||||
|
LANGUAGE = ObjC;
|
||||||
|
OUTLETS = {
|
||||||
|
adv = id;
|
||||||
|
face = id;
|
||||||
|
mood = id;
|
||||||
|
moodList = id;
|
||||||
|
moodTextList = id;
|
||||||
|
pMood = id;
|
||||||
|
pass = id;
|
||||||
|
userID = id;
|
||||||
|
};
|
||||||
|
SUPERCLASS = NSObject;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
IBVersion = 1;
|
||||||
|
}
|
25
OSX/English.lproj/MainMenu.nib/info.nib
generated
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>IBDocumentLocation</key>
|
||||||
|
<string>410 325 364 391 0 0 1024 746 </string>
|
||||||
|
<key>IBEditorPositions</key>
|
||||||
|
<dict>
|
||||||
|
<key>29</key>
|
||||||
|
<string>480 252 165 44 0 0 1024 746 </string>
|
||||||
|
<key>292</key>
|
||||||
|
<string>377 338 270 342 0 0 1024 746 </string>
|
||||||
|
</dict>
|
||||||
|
<key>IBFramework Version</key>
|
||||||
|
<string>326.0</string>
|
||||||
|
<key>IBOpenObjects</key>
|
||||||
|
<array>
|
||||||
|
<integer>29</integer>
|
||||||
|
<integer>295</integer>
|
||||||
|
<integer>394</integer>
|
||||||
|
</array>
|
||||||
|
<key>IBSystem Version</key>
|
||||||
|
<string>7A202</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
BIN
OSX/English.lproj/MainMenu.nib/keyedobjects.nib
generated
Normal file
38
OSX/README
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
iMood Updater 1.52 - Updates your internet mood (imood.com).
|
||||||
|
Copyright (C) 2003 RiSC, and SDF1 Networks
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
GNU License @ http://www.gnu.org/copyleft/gpl.htm
|
||||||
|
|
||||||
|
iMood Updater version 1.52, Copyright (C) 2003 RiSC, and SDF1 Networks
|
||||||
|
iMood Updater comes with ABSOLUTELY NO WARRANTY
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
Requirements:
|
||||||
|
Mac OS X 10.2 or higher
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
New in 1.52:
|
||||||
|
|
||||||
|
- DES encryption of passwords being sent to iMood.com
|
||||||
|
|
||||||
|
Known issues:
|
||||||
|
|
||||||
|
- Must have a connection to the internet before running
|
||||||
|
|
||||||
|
To-do list:
|
||||||
|
|
||||||
|
- Keychain support
|
||||||
|
- Better error handling
|
BIN
OSX/Resources/images/00.gif
Normal file
After Width: | Height: | Size: 87 B |
BIN
OSX/Resources/images/01.gif
Normal file
After Width: | Height: | Size: 87 B |
BIN
OSX/Resources/images/02.gif
Normal file
After Width: | Height: | Size: 88 B |
BIN
OSX/Resources/images/03.gif
Normal file
After Width: | Height: | Size: 87 B |
BIN
OSX/Resources/images/04.gif
Normal file
After Width: | Height: | Size: 94 B |
BIN
OSX/Resources/images/05.gif
Normal file
After Width: | Height: | Size: 96 B |
BIN
OSX/Resources/images/06.gif
Normal file
After Width: | Height: | Size: 88 B |
BIN
OSX/Resources/images/07.gif
Normal file
After Width: | Height: | Size: 87 B |
BIN
OSX/Resources/images/08.gif
Normal file
After Width: | Height: | Size: 92 B |
BIN
OSX/Resources/images/09.gif
Normal file
After Width: | Height: | Size: 124 B |
BIN
OSX/Resources/images/10.gif
Normal file
After Width: | Height: | Size: 86 B |
BIN
OSX/Resources/images/11.gif
Normal file
After Width: | Height: | Size: 91 B |
BIN
OSX/Resources/images/12.gif
Normal file
After Width: | Height: | Size: 85 B |
BIN
OSX/Resources/images/13.gif
Normal file
After Width: | Height: | Size: 133 B |
BIN
OSX/Resources/images/14.gif
Normal file
After Width: | Height: | Size: 128 B |
BIN
OSX/Resources/images/15.gif
Normal file
After Width: | Height: | Size: 120 B |
BIN
OSX/Resources/images/16.gif
Normal file
After Width: | Height: | Size: 87 B |
BIN
OSX/Resources/images/17.gif
Normal file
After Width: | Height: | Size: 86 B |
BIN
OSX/Resources/images/18.gif
Normal file
After Width: | Height: | Size: 100 B |
BIN
OSX/Resources/images/19.gif
Normal file
After Width: | Height: | Size: 85 B |
BIN
OSX/Resources/images/20.gif
Normal file
After Width: | Height: | Size: 97 B |
BIN
OSX/Resources/images/21.gif
Normal file
After Width: | Height: | Size: 106 B |
BIN
OSX/Resources/images/22.gif
Normal file
After Width: | Height: | Size: 94 B |
BIN
OSX/Resources/images/23.gif
Normal file
After Width: | Height: | Size: 87 B |
BIN
OSX/Resources/images/24.gif
Normal file
After Width: | Height: | Size: 93 B |
BIN
OSX/Resources/images/25.gif
Normal file
After Width: | Height: | Size: 90 B |
BIN
OSX/Resources/images/26.gif
Normal file
After Width: | Height: | Size: 86 B |
BIN
OSX/Resources/images/27.gif
Normal file
After Width: | Height: | Size: 101 B |
BIN
OSX/Resources/images/28.gif
Normal file
After Width: | Height: | Size: 332 B |
BIN
OSX/Resources/images/29.gif
Normal file
After Width: | Height: | Size: 87 B |
BIN
OSX/Resources/images/30.gif
Normal file
After Width: | Height: | Size: 92 B |
BIN
OSX/Resources/images/31.gif
Normal file
After Width: | Height: | Size: 93 B |
BIN
OSX/Resources/images/32.gif
Normal file
After Width: | Height: | Size: 95 B |
BIN
OSX/Resources/imood.icns
Normal file
325
OSX/XMLTree.h
Normal file
@ -0,0 +1,325 @@
|
|||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@header XMLTree
|
||||||
|
XMLTree provides an Objective-C wrapper for Apple's built-in C-language
|
||||||
|
XML parser and manipulation functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@class XMLTree
|
||||||
|
@abstract Wraps some C-level functions from Apple for XML manipulation.
|
||||||
|
@discussion
|
||||||
|
<p>
|
||||||
|
XMLTree provides an Objective-C wrapper for Apple's built-in C-language
|
||||||
|
XML parser and manipulation functions.
|
||||||
|
At the moment it only supports basic element and attribute information.
|
||||||
|
However Apple's XML parser supports processing instructions, CDATA,
|
||||||
|
and some other things I've never seen, so I'll add support for these
|
||||||
|
as I go along.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
I'm releasing this code into the Public Domain, so you can include it
|
||||||
|
with your software regardless of the license you use. If you make any
|
||||||
|
useful additions or bug fixes (especially with retain/release), we
|
||||||
|
would all appreciate it if you would let me know so we can give the
|
||||||
|
changes to everyone else too.
|
||||||
|
</p>
|
||||||
|
<p>Author: Robert Harder, rob -at- iharder.net</p>
|
||||||
|
<p>version: 0.1</p>
|
||||||
|
*/
|
||||||
|
@interface XMLTree : NSObject
|
||||||
|
{
|
||||||
|
CFXMLTreeRef _tree;
|
||||||
|
CFXMLNodeRef _node;
|
||||||
|
|
||||||
|
NSString *_lastUnknownSelector;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method dealloc
|
||||||
|
@abstract Be a good citizen and clean up after ourselves.
|
||||||
|
*/
|
||||||
|
-(void)dealloc;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method treeWithURL:
|
||||||
|
@abstract Creates an autoreleased XMLTree with the contents of <var>url</var>.
|
||||||
|
@discussion
|
||||||
|
<p><b>This method does not return a properly-autoreleased object.
|
||||||
|
Do not use it until we figure out what's wrong (or let me know if you found out.</b></p>
|
||||||
|
Creates an autoreleased XMLTree with the contents of <var>url</var> or
|
||||||
|
<tt>nil</tt> if there was an error.
|
||||||
|
Of course the URL can be pointing to a file or a URL on the internet
|
||||||
|
such as a GET command to a SOAP application.
|
||||||
|
@param url The <tt>NSURL</tt> pointing to your XML data.
|
||||||
|
@result An autoreleased <tt>XMLTree</tt> with the contents
|
||||||
|
of <var>url</var> or <tt>nil</tt> if there was a problem.
|
||||||
|
*/
|
||||||
|
+(XMLTree *)treeWithURL:(NSURL *)url;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method init
|
||||||
|
@abstract Initializes and returns an <tt>XMLTree</tt>.
|
||||||
|
@discussion
|
||||||
|
Initializes and returns an <tt>XMLTree</tt> (with a retain count of 1).
|
||||||
|
There isn't much point to creating an <tt>XMLTree</tt> this way until
|
||||||
|
I add methods for manuallying adding XML nodes to the tree.
|
||||||
|
@result An <tt>XMLTree</tt> (with a retain count of 1).
|
||||||
|
*/
|
||||||
|
-(XMLTree *)init;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method initWithURL:
|
||||||
|
@abstract Initializes and returns an <tt>XMLTree</tt>
|
||||||
|
with the contents of <var>url</var>.
|
||||||
|
@discussion
|
||||||
|
Initializes and returns an <tt>XMLTree</tt> (with a retain count of 1)
|
||||||
|
with the XML contents of <var>url</var> or <tt>nil</tt> if there is an error.
|
||||||
|
@param url The <tt>NSURL</tt> pointing to your XML data.
|
||||||
|
@result An <tt>XMLTree</tt> with a retain count of 1.
|
||||||
|
*/
|
||||||
|
-(XMLTree *)initWithURL:(NSURL *)url;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method initWithCFXMLTreeRef:
|
||||||
|
@abstract Initializes and returns an <tt>XMLTree</tt>
|
||||||
|
with the internal data represented by <var>ref</var>.
|
||||||
|
@discussion
|
||||||
|
Initializes and returns an <tt>XMLTree</tt> (with a retain count of 1)
|
||||||
|
with the internal <tt>CFXMLTreeRef</tt> data represented by <var>ref</var>.
|
||||||
|
You probably won't ever need to call this yourself, but I call it internally
|
||||||
|
and may move it to a Private API in the XMLTree.m file later.
|
||||||
|
@param ref The <tt>CFXMLTreeRef</tt> containing the XML data.
|
||||||
|
@result An <tt>XMLTree</tt> with a retain count of 1.
|
||||||
|
*/
|
||||||
|
-(XMLTree *)initWithCFXMLTreeRef:(CFXMLTreeRef)ref;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ******** A B O U T S E L F ******** */
|
||||||
|
/*!
|
||||||
|
@method name
|
||||||
|
@abstract Returns the name of the root node in the tree.
|
||||||
|
@discussion
|
||||||
|
Returns the name of the root node in the tree or <tt>nil</tt>
|
||||||
|
if a name is not appropriate in the current context such as
|
||||||
|
if the "tree" is actually a single XML Processing Instruction node.
|
||||||
|
@result The name of the root node in the tree..
|
||||||
|
*/
|
||||||
|
-(NSString *)name;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method xml
|
||||||
|
@abstract Returns the <tt>XMLTree</tt> in an XML-looking form.
|
||||||
|
@discussion
|
||||||
|
Returns the <tt>XMLTree</tt> in an XML-looking form as performed
|
||||||
|
by Apple's own <tt>CFXMLTreeCreateXMLData(...)</tt> method.
|
||||||
|
@result The <tt>XMLTree</tt> in an XML-looking form.
|
||||||
|
*/
|
||||||
|
-(NSString *)xml;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method description
|
||||||
|
@abstract Returns a textual representation of the <tt>XMLTree</tt>.
|
||||||
|
@discussion
|
||||||
|
<p>
|
||||||
|
Returns a textual representation of the <tt>XMLTree</tt>.
|
||||||
|
The way the tree is interpreted depends on what kind of root
|
||||||
|
node is represented by the receiver.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Listed below are the actions this method takes depending
|
||||||
|
on the type of node this is.
|
||||||
|
</p>
|
||||||
|
<table border="1">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Node Type</th><th>CFXMLNodeTypeCode</th><th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Document</td><td>kCFXMLNodeTypeDocument</td>
|
||||||
|
<td rowspan="2" valign="top">
|
||||||
|
Recursively descends XML document piecing together
|
||||||
|
the Text and CDATA nodes that are encountered.
|
||||||
|
You can think of this as returning the plaintext
|
||||||
|
version of the XML data, that is, with all tags removed.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<td>Element</td><td>kCFXMLNodeTypeElement</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Attribute</td><td>kCFXMLNodeTypeAttribute</td>
|
||||||
|
<td rowspan="13" valign="top">
|
||||||
|
Default action: Whatever is returned by Apple's
|
||||||
|
<tt>CFXMLNodeGetString(...)</tt> method.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>Processing Instruction</td><td>kCFXMLNodeTypeProcessingInstruction</td></tr>
|
||||||
|
<tr><td>Comment</td><td>kCFXMLNodeTypeComment</td></tr>
|
||||||
|
<tr><td>Text</td><td>kCFXMLNodeTypeText</td></tr>
|
||||||
|
<tr><td>CDATA Section</td><td>kCFXMLNodeTypeCDATASection</td></tr>
|
||||||
|
<tr><td>Document Fragment</td><td>kCFXMLNodeTypeDocumentFragment</td></tr>
|
||||||
|
<tr><td>Entity</td><td>kCFXMLNodeTypeEntity</td></tr>
|
||||||
|
<tr><td>Entity Reference</td><td>kCFXMLNodeTypeEntityReference</td></tr>
|
||||||
|
<tr><td>Document Type</td><td>kCFXMLNodeTypeDocumentType</td></tr>
|
||||||
|
<tr><td>Whitespace</td><td>kCFXMLNodeTypeWhitespace</td></tr>
|
||||||
|
<tr><td>Notation Element</td><td>kCFXMLNodeTypeNotation</td></tr>
|
||||||
|
<tr><td>Element Type Declaration</td><td>kCFXMLNodeTypeElementTypeDeclaration</td></tr>
|
||||||
|
<tr><td>Attribute List Declaration</td><td>kCFXMLNodeTypeAttributeListDeclaration</td></tr>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
@result A textual representation of the <tt>XMLTree</tt>.
|
||||||
|
*/
|
||||||
|
-(NSString *)description;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method attributeNamed:
|
||||||
|
@abstract Returns the attribute named <var>name</var>.
|
||||||
|
@discussion
|
||||||
|
Returns the attribute named <var>name</var> or
|
||||||
|
<tt>nil</tt> if no such attribute is found or
|
||||||
|
the node is not an Element node.
|
||||||
|
@param name The name of the attribute to return.
|
||||||
|
@result The attribute named <var>name</var>.
|
||||||
|
*/
|
||||||
|
-(NSString *)attributeNamed:(NSString *)name;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method attributes
|
||||||
|
@abstract Returns a dictionary of all the attributes.
|
||||||
|
@discussion
|
||||||
|
Returns a dictionary of all the attributes in the node
|
||||||
|
or <tt>nil</tt> if the node is not an Element node.
|
||||||
|
@result A dictionary of all the attributes.
|
||||||
|
*/
|
||||||
|
-(NSDictionary *)attributes;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method type
|
||||||
|
@abstract Returns the type of node this is.
|
||||||
|
@discussion
|
||||||
|
Returns the type of node this is as defined by Apple's
|
||||||
|
<tt>enum</tt>:
|
||||||
|
<pre>
|
||||||
|
enum CFXMLNodeTypeCode {
|
||||||
|
kCFXMLNodeTypeDocument = 1,
|
||||||
|
kCFXMLNodeTypeElement = 2,
|
||||||
|
kCFXMLNodeTypeAttribute = 3,
|
||||||
|
kCFXMLNodeTypeProcessingInstruction = 4,
|
||||||
|
kCFXMLNodeTypeComment = 5,
|
||||||
|
kCFXMLNodeTypeText = 6,
|
||||||
|
kCFXMLNodeTypeCDATASection = 7,
|
||||||
|
kCFXMLNodeTypeDocumentFragment = 8,
|
||||||
|
kCFXMLNodeTypeEntity = 9,
|
||||||
|
kCFXMLNodeTypeEntityReference = 10,
|
||||||
|
kCFXMLNodeTypeDocumentType = 11,
|
||||||
|
kCFXMLNodeTypeWhitespace = 12,
|
||||||
|
kCFXMLNodeTypeNotation = 13,
|
||||||
|
kCFXMLNodeTypeElementTypeDeclaration = 14,
|
||||||
|
kCFXMLNodeTypeAttributeListDeclaration = 15
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
@result The type of node this is.
|
||||||
|
*/
|
||||||
|
-(CFXMLNodeTypeCode)type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ******** A B O U T C H I L D R E N ******** */
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method childAtIndex:
|
||||||
|
@abstract Returns the child at the given index.
|
||||||
|
@discussion
|
||||||
|
Returns the child at the given index or <tt>nil</tt>
|
||||||
|
if no such child exists or it doesn't make sense
|
||||||
|
to have children (such as a Processing Instruction node).
|
||||||
|
@param index The index of the child to get.
|
||||||
|
@result The child at <var>index</var>.
|
||||||
|
*/
|
||||||
|
-(XMLTree *)childAtIndex:(int)index;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method childNamed:
|
||||||
|
@abstract Returns the first child named <var>name</var>.
|
||||||
|
@discussion
|
||||||
|
Returns the first child named <var>name</var> or <tt>nil</tt>
|
||||||
|
if no such child exists or it doesn't make sense
|
||||||
|
to have children (such as a Processing Instruction node).
|
||||||
|
@param name The name of the child.
|
||||||
|
@result The child named <var>name</var>.
|
||||||
|
*/
|
||||||
|
-(XMLTree *)childNamed:(NSString *)name;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method descendentNamed:
|
||||||
|
@abstract Returns the first descendent named <var>name</var>.
|
||||||
|
@discussion
|
||||||
|
Returns the descendent named <var>name</var> or <tt>nil</tt>
|
||||||
|
if no such descendent exists or it doesn't make sense
|
||||||
|
to have descendents (such as a Processing Instruction node).
|
||||||
|
This is a depth-first search.
|
||||||
|
@param name The name of the child.
|
||||||
|
@result The child named <var>name</var>.
|
||||||
|
*/
|
||||||
|
-(XMLTree *)descendentNamed:(NSString *)name;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@method count
|
||||||
|
@abstract Returns the number of children in the tree.
|
||||||
|
@discussion
|
||||||
|
Returns the number of children in the tree or <tt>-1</tt>
|
||||||
|
if there is no valid tree contained within (like if you
|
||||||
|
tried to create an <tt>XMLTree</tt> with <tt>init</tt>).
|
||||||
|
@result The number of children in the tree.
|
||||||
|
*/
|
||||||
|
-(int)count;
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@function XMLTreeDescription
|
||||||
|
@abstract Used internally to recursively generate tree descriptions.
|
||||||
|
@param descr The mutable string that will have descriptions appended to it.
|
||||||
|
@param tree The tree from which to make a description.
|
||||||
|
@result A description of <var>tree</var>.
|
||||||
|
*/
|
||||||
|
CFStringRef XMLTreeDescription( CFMutableStringRef descr, CFXMLTreeRef tree );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@function XMLTreeDescendentNamed
|
||||||
|
@abstract Used internally to recursively search for a descendent.
|
||||||
|
@param name The name of the descendent to search for.
|
||||||
|
@param tree The tree in which to recursively search.
|
||||||
|
@result The matching descendent or <tt>nil</tt> if no descendent is found.
|
||||||
|
*/
|
||||||
|
CFXMLTreeRef XMLTreeDescendentNamed( CFStringRef name, CFXMLTreeRef tree );
|
||||||
|
|
||||||
|
|
||||||
|
|
383
OSX/XMLTree.m
Normal file
@ -0,0 +1,383 @@
|
|||||||
|
#import "XMLTree.h"
|
||||||
|
|
||||||
|
@interface XMLTree (PrivateAPI)
|
||||||
|
|
||||||
|
|
||||||
|
@end // End Private API
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@implementation XMLTree
|
||||||
|
|
||||||
|
|
||||||
|
-(void)dealloc
|
||||||
|
{
|
||||||
|
//NSLog( @"dealloc %@", self );
|
||||||
|
|
||||||
|
if( _tree != NULL )
|
||||||
|
CFRelease( _tree );
|
||||||
|
|
||||||
|
if( _node != NULL )
|
||||||
|
CFRelease( _node );
|
||||||
|
|
||||||
|
_tree = NULL;
|
||||||
|
_node = NULL;
|
||||||
|
|
||||||
|
} // end dealloc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
+(XMLTree *)treeWithURL:(NSURL *)url
|
||||||
|
{
|
||||||
|
return [[[XMLTree alloc] initWithURL:url] autorelease];
|
||||||
|
} // end treeWithURL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-(XMLTree *)init
|
||||||
|
{
|
||||||
|
if( [super init] == nil )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
_tree = NULL;
|
||||||
|
_node = NULL;
|
||||||
|
|
||||||
|
return self;
|
||||||
|
} // end init
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-(XMLTree *)initWithCFXMLTreeRef:(CFXMLTreeRef)ref
|
||||||
|
{
|
||||||
|
if( [self init] == nil )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
// Clean up?
|
||||||
|
if( _tree != NULL )
|
||||||
|
CFRelease( _tree );
|
||||||
|
if( _node != NULL )
|
||||||
|
CFRelease( _node );
|
||||||
|
|
||||||
|
_tree = ref;
|
||||||
|
_node = CFXMLTreeGetNode( _tree );
|
||||||
|
|
||||||
|
CFRetain( _tree );
|
||||||
|
CFRetain( _node );
|
||||||
|
|
||||||
|
return self;
|
||||||
|
} // end initWithCFXMLTreeRef:
|
||||||
|
|
||||||
|
|
||||||
|
-(XMLTree *)initWithURL:(NSURL *)url
|
||||||
|
{
|
||||||
|
CFDataRef xmlData;
|
||||||
|
if( (xmlData = (CFDataRef)malloc( sizeof( CFDataRef ) ) ) == NULL){
|
||||||
|
NSLog(@"Couldn't allocate any memory.");
|
||||||
|
return nil;
|
||||||
|
} // end if: malloc fail
|
||||||
|
|
||||||
|
|
||||||
|
_tree = CFXMLTreeCreateWithDataFromURL(
|
||||||
|
kCFAllocatorDefault,
|
||||||
|
(CFURLRef)url,
|
||||||
|
kCFXMLParserSkipWhitespace,
|
||||||
|
NULL ); //CFIndex
|
||||||
|
|
||||||
|
_node = CFXMLTreeGetNode( _tree );
|
||||||
|
|
||||||
|
// _tree is implicitly retained
|
||||||
|
CFRetain( _node );
|
||||||
|
|
||||||
|
return self;
|
||||||
|
} // end initWithURL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ******** A B O U T C H I L D R E N ******** */
|
||||||
|
|
||||||
|
|
||||||
|
-(int)count
|
||||||
|
{
|
||||||
|
if( _tree == NULL )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return CFTreeGetChildCount( _tree );
|
||||||
|
} // end count
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-(XMLTree *)childAtIndex:(int)index
|
||||||
|
{
|
||||||
|
CFXMLTreeRef child;
|
||||||
|
|
||||||
|
if( _tree == NULL )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
if( index >= CFTreeGetChildCount( _tree ) )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
child = CFTreeGetChildAtIndex(_tree, index);
|
||||||
|
|
||||||
|
return [[XMLTree alloc] initWithCFXMLTreeRef:child];
|
||||||
|
} // end childAtIndex:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-(XMLTree *)childNamed:(NSString *)name
|
||||||
|
{
|
||||||
|
CFXMLTreeRef childTree;
|
||||||
|
CFXMLNodeRef childNode;
|
||||||
|
CFStringRef childName;
|
||||||
|
int childCount;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if( _tree == NULL )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
childCount = CFTreeGetChildCount( _tree );
|
||||||
|
|
||||||
|
for( i = 0; i < childCount; i++ ){
|
||||||
|
childTree = CFTreeGetChildAtIndex(_tree, i );
|
||||||
|
childNode = CFXMLTreeGetNode( childTree );
|
||||||
|
childName = CFXMLNodeGetString( childNode );
|
||||||
|
|
||||||
|
if( CFStringCompare( (CFStringRef)name, childName, NULL ) == kCFCompareEqualTo )
|
||||||
|
return [[XMLTree alloc] initWithCFXMLTreeRef:childTree];
|
||||||
|
|
||||||
|
} // end for: each child
|
||||||
|
|
||||||
|
return nil;
|
||||||
|
} // end childNamed:
|
||||||
|
|
||||||
|
|
||||||
|
-(XMLTree *)descendentNamed:(NSString *)name
|
||||||
|
{
|
||||||
|
CFXMLTreeRef descTree;
|
||||||
|
|
||||||
|
if( _tree == NULL )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
descTree = XMLTreeDescendentNamed( (CFStringRef)name, _tree );
|
||||||
|
|
||||||
|
if( descTree == NULL )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
return [[XMLTree alloc] initWithCFXMLTreeRef:descTree];
|
||||||
|
} // end descendentNamed:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ******** A B O U T S E L F ******** */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-(NSString *)name
|
||||||
|
{
|
||||||
|
NSString *name;
|
||||||
|
|
||||||
|
if( _node == NULL )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
name = [[NSString alloc] initWithString:(NSString *)CFXMLNodeGetString(_node)];
|
||||||
|
|
||||||
|
return name;
|
||||||
|
} // end name
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@discussion
|
||||||
|
Returns the node type, as defined by Apple's XML parser.
|
||||||
|
The values will be one of the following constants:
|
||||||
|
<pre>
|
||||||
|
enum CFXMLNodeTypeCode {
|
||||||
|
kCFXMLNodeTypeDocument = 1,
|
||||||
|
kCFXMLNodeTypeElement = 2,
|
||||||
|
kCFXMLNodeTypeAttribute = 3,
|
||||||
|
kCFXMLNodeTypeProcessingInstruction = 4,
|
||||||
|
kCFXMLNodeTypeComment = 5,
|
||||||
|
kCFXMLNodeTypeText = 6,
|
||||||
|
kCFXMLNodeTypeCDATASection = 7,
|
||||||
|
kCFXMLNodeTypeDocumentFragment = 8,
|
||||||
|
kCFXMLNodeTypeEntity = 9,
|
||||||
|
kCFXMLNodeTypeEntityReference = 10,
|
||||||
|
kCFXMLNodeTypeDocumentType = 11,
|
||||||
|
kCFXMLNodeTypeWhitespace = 12,
|
||||||
|
kCFXMLNodeTypeNotation = 13,
|
||||||
|
kCFXMLNodeTypeElementTypeDeclaration = 14,
|
||||||
|
kCFXMLNodeTypeAttributeListDeclaration = 15
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
*/
|
||||||
|
-(CFXMLNodeTypeCode)type
|
||||||
|
{
|
||||||
|
return CFXMLNodeGetTypeCode(_node);
|
||||||
|
} // end type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-(NSDictionary *)attributes
|
||||||
|
{
|
||||||
|
CFXMLElementInfo eInfo;
|
||||||
|
|
||||||
|
if( CFXMLNodeGetTypeCode( _node ) != kCFXMLNodeTypeElement )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
eInfo = *(CFXMLElementInfo *)CFXMLNodeGetInfoPtr(_node);
|
||||||
|
|
||||||
|
return (NSDictionary *)eInfo.attributes;
|
||||||
|
} // end attributes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-(NSString *)attributeNamed:(NSString *)name
|
||||||
|
{
|
||||||
|
if( _tree == NULL )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
return [[[self attributes] objectForKey:name] description];
|
||||||
|
} // end attributeNamed:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-(NSString *)description
|
||||||
|
{
|
||||||
|
NSMutableString *descr;
|
||||||
|
|
||||||
|
descr = [[NSMutableString alloc] init];
|
||||||
|
|
||||||
|
//NSLog( @"Description for type %d", CFXMLNodeGetTypeCode(_node) );
|
||||||
|
|
||||||
|
switch( CFXMLNodeGetTypeCode(_node) ){
|
||||||
|
|
||||||
|
case kCFXMLNodeTypeDocument:
|
||||||
|
case kCFXMLNodeTypeElement:
|
||||||
|
XMLTreeDescription( (CFMutableStringRef)descr, _tree );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kCFXMLNodeTypeProcessingInstruction:
|
||||||
|
case kCFXMLNodeTypeAttribute:
|
||||||
|
case kCFXMLNodeTypeComment:
|
||||||
|
case kCFXMLNodeTypeText:
|
||||||
|
case kCFXMLNodeTypeCDATASection:
|
||||||
|
case kCFXMLNodeTypeDocumentFragment:
|
||||||
|
case kCFXMLNodeTypeEntity:
|
||||||
|
case kCFXMLNodeTypeEntityReference:
|
||||||
|
case kCFXMLNodeTypeDocumentType:
|
||||||
|
case kCFXMLNodeTypeWhitespace:
|
||||||
|
case kCFXMLNodeTypeNotation:
|
||||||
|
case kCFXMLNodeTypeElementTypeDeclaration:
|
||||||
|
case kCFXMLNodeTypeAttributeListDeclaration:
|
||||||
|
default:
|
||||||
|
[descr appendString:(NSString *)CFXMLNodeGetString(_node)];
|
||||||
|
} // end switch
|
||||||
|
|
||||||
|
return descr;
|
||||||
|
} // end description
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-(NSString *)xml
|
||||||
|
{
|
||||||
|
CFDataRef xmlData;
|
||||||
|
|
||||||
|
if( _tree == NULL )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
xmlData = CFXMLTreeCreateXMLData(
|
||||||
|
kCFAllocatorDefault,
|
||||||
|
_tree );
|
||||||
|
if( xmlData == NULL )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
return [[NSString alloc] initWithData:(NSData *)xmlData encoding:NSASCIIStringEncoding];
|
||||||
|
|
||||||
|
} // end xml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@end // End implementation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CFStringRef XMLTreeDescription( CFMutableStringRef descr, CFXMLTreeRef tree )
|
||||||
|
{
|
||||||
|
CFXMLTreeRef childTree;
|
||||||
|
CFXMLNodeRef childNode;
|
||||||
|
int childCount;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
childCount = CFTreeGetChildCount( tree );
|
||||||
|
|
||||||
|
for( i = 0; i < childCount; i++ ){
|
||||||
|
|
||||||
|
childTree = CFTreeGetChildAtIndex( tree, i );
|
||||||
|
childNode = CFXMLTreeGetNode( childTree );
|
||||||
|
|
||||||
|
switch( CFXMLNodeGetTypeCode( childNode ) ){
|
||||||
|
|
||||||
|
case kCFXMLNodeTypeText:
|
||||||
|
CFStringAppend( descr, CFXMLNodeGetString( childNode ) );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kCFXMLNodeTypeElement:
|
||||||
|
XMLTreeDescription( descr, childTree );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
} // end switch: node type
|
||||||
|
} // end for
|
||||||
|
|
||||||
|
return descr;
|
||||||
|
} // end XMLTreeDescription
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CFXMLTreeRef XMLTreeDescendentNamed( CFStringRef name, CFXMLTreeRef tree )
|
||||||
|
{
|
||||||
|
CFXMLTreeRef childTree;
|
||||||
|
CFXMLTreeRef descTree;
|
||||||
|
CFXMLNodeRef childNode;
|
||||||
|
CFStringRef childName;
|
||||||
|
int childCount;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
childCount = CFTreeGetChildCount( tree );
|
||||||
|
|
||||||
|
for( i = 0; i < childCount; i++ ){
|
||||||
|
|
||||||
|
childTree = CFTreeGetChildAtIndex( tree, i );
|
||||||
|
childNode = CFXMLTreeGetNode( childTree );
|
||||||
|
childName = CFXMLNodeGetString( childNode );
|
||||||
|
|
||||||
|
// Is this it?
|
||||||
|
if( CFStringCompare( name, childName, NULL ) == kCFCompareEqualTo )
|
||||||
|
return childTree;
|
||||||
|
|
||||||
|
// If child is an element, search recursively
|
||||||
|
if( CFXMLNodeGetTypeCode( childNode ) == kCFXMLNodeTypeElement ){
|
||||||
|
|
||||||
|
descTree = XMLTreeDescendentNamed( name, childTree );
|
||||||
|
|
||||||
|
// Got a match?
|
||||||
|
if( descTree != NULL )
|
||||||
|
return descTree;
|
||||||
|
|
||||||
|
} // end if: element node type
|
||||||
|
|
||||||
|
} // end for
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
} // end XMLTreeDescendentNamed:
|
||||||
|
|
18
OSX/iMoodUpdater.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/* iMoodUpdater */
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
@interface iMoodUpdater : NSObject
|
||||||
|
{
|
||||||
|
IBOutlet id face;
|
||||||
|
IBOutlet id mood;
|
||||||
|
IBOutlet id pMood;
|
||||||
|
IBOutlet id pass;
|
||||||
|
IBOutlet id adv;
|
||||||
|
IBOutlet id userID;
|
||||||
|
IBOutlet id moodList;
|
||||||
|
IBOutlet id moodTextList;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction)iMoodUpdater:(id)sender;
|
||||||
|
@end
|
127
OSX/iMoodUpdater.m
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
#import "iMoodUpdater.h"
|
||||||
|
#import "XMLTree.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#define preferences [NSUserDefaults standardUserDefaults]
|
||||||
|
|
||||||
|
@implementation iMoodUpdater
|
||||||
|
|
||||||
|
- (IBAction)iMoodUpdater:(id)sender
|
||||||
|
{
|
||||||
|
// Put data from app into usable variables
|
||||||
|
int iFace = [face selectedTag];
|
||||||
|
NSString *lMood = @"happy";
|
||||||
|
char *crypt();
|
||||||
|
char passwd[256];
|
||||||
|
char salt[3];
|
||||||
|
char rndChar[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./";
|
||||||
|
|
||||||
|
// Setup the salt for crypt()
|
||||||
|
srandom(time(0));
|
||||||
|
salt[0] = rndChar[random() %64];
|
||||||
|
salt[1] = rndChar[random() &64];
|
||||||
|
salt[3] = 0;
|
||||||
|
|
||||||
|
if ([[preferences stringForKey:@"Advanced"] compare:@"1"])
|
||||||
|
{
|
||||||
|
lMood = [moodList titleOfSelectedItem];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lMood = [moodTextList stringValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup the URL to goto to update the mood for given user.
|
||||||
|
NSString *tempURL = @"http://xml.imood.org/update.cgi?email=";
|
||||||
|
tempURL = [tempURL stringByAppendingString:[preferences stringForKey:@"UserID"]];
|
||||||
|
tempURL = [tempURL stringByAppendingString:@"&crypt=1"];
|
||||||
|
tempURL = [tempURL stringByAppendingString:@"&password="];
|
||||||
|
// Crypt the password
|
||||||
|
[[preferences stringForKey:@"Password"] getCString:passwd];
|
||||||
|
tempURL = [tempURL stringByAppendingString:[NSString stringWithFormat:@"%s",crypt(passwd, salt)]];
|
||||||
|
tempURL = [tempURL stringByAppendingString:@"&base="];
|
||||||
|
tempURL = [tempURL stringByAppendingString:lMood];
|
||||||
|
tempURL = [tempURL stringByAppendingString:@"&face="];
|
||||||
|
tempURL = [tempURL stringByAppendingFormat:@"%d",iFace];
|
||||||
|
tempURL = [tempURL stringByAppendingString:@"&personal="];
|
||||||
|
tempURL = [tempURL stringByAppendingString:[pMood stringValue]];
|
||||||
|
tempURL = (NSString *) CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)tempURL,NULL, NULL,kCFStringEncodingUTF8);
|
||||||
|
[tempURL retain];
|
||||||
|
//NSLog(tempURL);
|
||||||
|
|
||||||
|
XMLTree *errorXML = [[[XMLTree alloc] initWithURL:[NSURL URLWithString:tempURL]] retain];
|
||||||
|
NSString *errorMsg = [NSString stringWithFormat: @"%@", [errorXML descendentNamed:@"error"]];
|
||||||
|
NSRunAlertPanel(@"iMood Updater",errorMsg,@"OK",NULL,NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)awakeFromNib
|
||||||
|
{
|
||||||
|
if ([preferences stringForKey:@"UserID"] == nil)
|
||||||
|
{
|
||||||
|
[preferences setObject:@"" forKey:@"UserID"];
|
||||||
|
[preferences setObject:@"" forKey:@"Password"];
|
||||||
|
NSRunAlertPanel(@"No Account Info Found",@"Please go into preferences and set your account info.",@"OK", NULL, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[userID setStringValue:[preferences stringForKey:@"UserID"]];
|
||||||
|
[pass setStringValue:[preferences stringForKey:@"Password"]];
|
||||||
|
|
||||||
|
|
||||||
|
if ([preferences stringForKey:@"Advanced"] == nil)
|
||||||
|
{
|
||||||
|
[preferences setObject:[adv stringValue] forKey:@"Advanced"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[adv setStringValue:[preferences stringForKey:@"Advanced"]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([[preferences stringForKey:@"Advanced"] compare:@"1"])
|
||||||
|
{
|
||||||
|
NSDictionary *moodsDict = [NSDictionary dictionaryWithContentsOfURL:
|
||||||
|
[NSURL URLWithString:@"http://dev.sdf1.net/moods.xml"]];
|
||||||
|
NSArray *moods = [moodsDict valueForKey:@"Moods"];
|
||||||
|
NSLog(@"Number of moods found in XML: %d",[moods count]);
|
||||||
|
|
||||||
|
[moodTextList removeFromSuperview];
|
||||||
|
[moodList addItemsWithTitles:moods];
|
||||||
|
[moodList removeItemAtIndex:0];
|
||||||
|
[moodList selectItemAtIndex:0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[moodList removeFromSuperview];
|
||||||
|
}
|
||||||
|
|
||||||
|
[[mood window] makeKeyAndOrderFront:self];
|
||||||
|
[moodTextList selectText:self];
|
||||||
|
[userID selectText:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setMoodPrefs:(id)sender;
|
||||||
|
{
|
||||||
|
[preferences setObject:[userID stringValue] forKey:@"UserID"];
|
||||||
|
[preferences setObject:[pass stringValue] forKey:@"Password"];
|
||||||
|
[preferences setObject:[adv stringValue] forKey:@"Advanced"];
|
||||||
|
[[userID window] performClose:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)goiMoodURL:(id)sender;
|
||||||
|
{
|
||||||
|
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://my.imood.com"]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)goDEVSDF1:(id)sender;
|
||||||
|
{
|
||||||
|
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://dev.sdf1.net"]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)goDonate:(id)sender;
|
||||||
|
{
|
||||||
|
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://dev.sdf1.net/donate.html"]];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
1018
OSX/iMoodUpdater.pbproj/project.pbxproj
Normal file
7
OSX/iMoodUpdater_Prefix.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
//
|
||||||
|
// Prefix header for all source files of the 'iMoodUpdater' target in the 'iMoodUpdater' project
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef __OBJC__
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#endif
|
35
OSX/main.m
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
iMood Updater - Updates your internet mood (imood.com).
|
||||||
|
Copyright (C) 2003 RiSC, and SDF1 Networks
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
GNU License @ http://www.gnu.org/copyleft/gpl.htm
|
||||||
|
|
||||||
|
iMood Updater version .9 build 14, Copyright (C) 2003 RiSC, and SDF1 Networks
|
||||||
|
iMood Updater comes with ABSOLUTELY NO WARRANTY
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
Requirements:
|
||||||
|
Mac OS X 10.2
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
int main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
return NSApplicationMain(argc, argv);
|
||||||
|
}
|
||||||
|
|
36
cmdline/README
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
iMood Updater 0.9 - Updates your internet mood (imood.com).
|
||||||
|
Copyright (C) 2003 RiSC, and SDF1 Networks
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
GNU License @ http://www.gnu.org/copyleft/gpl.htm
|
||||||
|
|
||||||
|
iMood Updater version 0.9, Copyright (C) 2003 RiSC, and SDF1 Networks
|
||||||
|
iMood Updater comes with ABSOLUTELY NO WARRANTY
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
Requirements:
|
||||||
|
- None
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Known issues:
|
||||||
|
|
||||||
|
- Must have a connection to the internet before running
|
||||||
|
|
||||||
|
To-do list:
|
||||||
|
|
||||||
|
- DES encryption of password being sent to iMood.com
|
||||||
|
- Better error handling
|
||||||
|
- Add personal mood
|
93
cmdline/imoodupdater.c
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
iMood - Using www.imood.com's API we can change our web mood
|
||||||
|
Copyright (C) 2003 Rise In Superior Code & SDF1 Networks
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
GNU License @ http://www.gnu.org/copyleft/gpl.htm
|
||||||
|
|
||||||
|
iMood version 1.0, Copyright (C) 2003 Rise In Superior Code & SDF1 Networks
|
||||||
|
iMood comes with ABSOLUTELY NO WARRANTY
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
void iMoodSend(char **argv)
|
||||||
|
{
|
||||||
|
char buffy[2048];
|
||||||
|
int dstPort, sock, result;
|
||||||
|
struct sockaddr_in name;
|
||||||
|
struct hostent *hostinfo;
|
||||||
|
|
||||||
|
dstPort = 80;
|
||||||
|
|
||||||
|
hostinfo=gethostbyname("my.imood.com");
|
||||||
|
if (!hostinfo){
|
||||||
|
herror("Error"); exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
name.sin_family=AF_INET;
|
||||||
|
name.sin_port=htons(dstPort);
|
||||||
|
name.sin_addr=*(struct in_addr *)hostinfo->h_addr;
|
||||||
|
sock=socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
result=connect(sock, (struct sockaddr *)&name, sizeof(struct sockaddr_in));
|
||||||
|
if (result != 0) {
|
||||||
|
herror("Error");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
sock=socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
result=connect(sock, (struct sockaddr *)&name, sizeof(struct sockaddr_in));
|
||||||
|
if (result != 0) {
|
||||||
|
herror("Error");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(buffy, "GET /updater.cgi?action=update&new_mood=");
|
||||||
|
strncat(buffy,argv[3],256);
|
||||||
|
strcat(buffy,"&face=");
|
||||||
|
strncat(buffy,argv[4],2);
|
||||||
|
strcat(buffy," HTTP/1.1\r\n");
|
||||||
|
strcat(buffy,"Host: www2.imood.com\r\n");
|
||||||
|
strcat(buffy, "Cookie: imood_pass=");
|
||||||
|
strncat(buffy,argv[2],256);
|
||||||
|
strcat(buffy,"; imood_user=");
|
||||||
|
strncat(buffy,argv[1],256);
|
||||||
|
strcat(buffy,"\r\n\r\n");
|
||||||
|
|
||||||
|
send(sock, buffy, sizeof(buffy), 0);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
if (argc < 4 || argc > 5){
|
||||||
|
printf ("\r\nUsage:\r\n%s UID PW Mood FaceID\r\n", argv[0]);
|
||||||
|
printf ("FaceID:\t0-32\r\nie: imood bob@bob.com myPass happy 0\r\n\r\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
iMoodSend(argv);
|
||||||
|
printf ("\r\niMood Updated\r\n");
|
||||||
|
return 0;
|
||||||
|
}
|
44
python/README
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
iMood Updater 1.52-python - Updates your internet mood (imood.com).
|
||||||
|
Copyright (C) 2003 RiSC, and SDF1 Networks
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
GNU License @ http://www.gnu.org/copyleft/gpl.htm
|
||||||
|
|
||||||
|
iMood Updater version 1.52-python, Copyright (C) 2003 RiSC, and SDF1 Networks
|
||||||
|
iMood Updater comes with ABSOLUTELY NO WARRANTY
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
Requirements:
|
||||||
|
Python 2.2+ (python.org)
|
||||||
|
PyXML (PyXML.sf.net)
|
||||||
|
- Only if using source version
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
New in 1.52:
|
||||||
|
|
||||||
|
- Added MD5 password encryption before sending to imood.com
|
||||||
|
|
||||||
|
New in 1.51:
|
||||||
|
|
||||||
|
- Ported over C code from the command line version
|
||||||
|
- Added error handling
|
||||||
|
|
||||||
|
Known issues:
|
||||||
|
|
||||||
|
- password is sent in plain text
|
||||||
|
|
||||||
|
To-do list:
|
||||||
|
|
||||||
|
- Add GUI
|
95
python/imoodupdater.py
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
"""
|
||||||
|
iMood Updater 1.52-python - Updates your internet mood (imood.com).
|
||||||
|
Copyright (C) 2003 RiSC, and SDF1 Networks
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
GNU License @ http://www.gnu.org/copyleft/gpl.htm
|
||||||
|
|
||||||
|
iMood Updater version 1.52-python, Copyright (C) 2003 RiSC, and SDF1 Networks
|
||||||
|
iMood Updater comes with ABSOLUTELY NO WARRANTY
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
Requirements:
|
||||||
|
Python 2.2+ (python.org)
|
||||||
|
PyXML (PyXML.sf.net)
|
||||||
|
- Only if using source version
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
"""
|
||||||
|
|
||||||
|
from xml.dom.ext.reader import Sax2
|
||||||
|
from whrandom import choice
|
||||||
|
import httplib, urllib, sys, getopt, crypt, random, re, string
|
||||||
|
|
||||||
|
def GenRandStr(length=8, chars=string.uppercase + string.lowercase + string.digits + "./"):
|
||||||
|
return ''.join([choice(chars) for i in range(length)])
|
||||||
|
|
||||||
|
def updateMood(userID, passwd, mood, face, pMood):
|
||||||
|
params = "email=" + userID + "&crypt=1" + "&password=" + passwd + "&base=" + mood + "&face=" + face + "&personal=" + pMood
|
||||||
|
|
||||||
|
print params
|
||||||
|
try:
|
||||||
|
tempURL = "/update.cgi" + "?" + params
|
||||||
|
h = httplib.HTTP("xml.imood.org")
|
||||||
|
h.putrequest('GET', tempURL)
|
||||||
|
h.putheader('User-Agent', 'iMood Updater(python)')
|
||||||
|
h.putheader('Connection', 'close')
|
||||||
|
h.putheader('Host', 'xml.imood.org')
|
||||||
|
h.endheaders()
|
||||||
|
except Exception, reason:
|
||||||
|
print "Error: Could not contact imood.com"
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
try:
|
||||||
|
reply, msg, hdrs = h.getreply()
|
||||||
|
data = h.getfile().read()
|
||||||
|
|
||||||
|
reader = Sax2.Reader()
|
||||||
|
doc_node = reader.fromString(data)
|
||||||
|
result = doc_node.documentElement.getElementsByTagName("error")[ 0]
|
||||||
|
print result.firstChild.data
|
||||||
|
except Exception, reason:
|
||||||
|
print "Warning: Bad data from imood.com, mood may not have been updated"
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
usage = "Usage: %s <account> <password> <\"mood\"> <faceID (0-32)> [\"personal mood\"]\n<> are required params, [] are optional" % sys.argv[0]
|
||||||
|
|
||||||
|
try:
|
||||||
|
opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
|
||||||
|
except getopt.error, msg:
|
||||||
|
print msg
|
||||||
|
print "for help use --help"
|
||||||
|
sys.exit(2)
|
||||||
|
for o, a in opts:
|
||||||
|
if o in ("-h", "--help"):
|
||||||
|
print usage;
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
try:
|
||||||
|
userID = sys.argv[1]
|
||||||
|
salt = GenRandStr()
|
||||||
|
passwd= crypt.crypt(sys.argv[2], salt)
|
||||||
|
mood = sys.argv[3]
|
||||||
|
face = sys.argv[4]
|
||||||
|
except IndexError:
|
||||||
|
print usage;
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
try:
|
||||||
|
pMood = sys.argv[5]
|
||||||
|
except IndexError:
|
||||||
|
pMood = ""
|
||||||
|
|
||||||
|
print "Updateing your iMood..."
|
||||||
|
updateMood(userID, passwd, mood, face, pMood)
|