Merge lp://qastaging/~alexlauni/do-plugins/microblog-credential-verification into lp://qastaging/do-plugins

Proposed by Alex Launi
Status: Merged
Merged at revision: not available
Proposed branch: lp://qastaging/~alexlauni/do-plugins/microblog-credential-verification
Merge into: lp://qastaging/do-plugins
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~alexlauni/do-plugins/microblog-credential-verification
Reviewer Review Type Date Requested Status
Chris S. Approve
Review via email: mp+6666@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Alex Launi (alexlauni) wrote :

Actually checks microblogging credentials!

611. By Alex Launi

Actually check if credentials are valid

612. By Alex Launi

bump microblogging version to 1.1

Revision history for this message
Chris S. (cszikszoy) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Microblogging/Makefile.am'
2--- Microblogging/Makefile.am 2009-02-28 16:16:48 +0000
3+++ Microblogging/Makefile.am 2009-05-18 05:34:19 +0000
4@@ -27,6 +27,7 @@
5 src/Twitterizer/Twitterizer.Framework/MethodClasses/TwitterStatusMethods.cs \
6 src/Twitterizer/Twitterizer.Framework/MethodClasses/TwitterUserMethods.cs \
7 src/Twitterizer/Twitterizer.Framework/Properties/AssemblyInfo.cs \
8+ src/Twitterizer/Twitterizer.Framework/Service.cs \
9 src/Twitterizer/Twitterizer.Framework/Twitter.cs \
10 src/Twitterizer/Twitterizer.Framework/TwitterizerException.cs \
11 src/Twitterizer/Twitterizer.Framework/TwitterRequest.cs \
12
13=== modified file 'Microblogging/src/FriendItem.cs'
14--- Microblogging/src/FriendItem.cs 2009-02-28 19:46:28 +0000
15+++ Microblogging/src/FriendItem.cs 2009-05-18 05:33:40 +0000
16@@ -13,7 +13,7 @@
17 {
18 public class FriendItem : Item
19 {
20- const string DefaultIcon = "stock_person";
21+ const string FallbackIcon = "stock_person";
22
23 string name, photo, status;
24 SortedList<DateTime, MicroblogStatus> statuses;
25@@ -46,7 +46,7 @@
26 get {
27 if (!string.IsNullOrEmpty (photo) && File.Exists (photo))
28 return photo;
29- return DefaultIcon;
30+ return FallbackIcon;
31 }
32 }
33
34
35=== modified file 'Microblogging/src/MicroblogClient.cs'
36--- Microblogging/src/MicroblogClient.cs 2009-04-17 04:05:22 +0000
37+++ Microblogging/src/MicroblogClient.cs 2009-05-18 05:34:19 +0000
38@@ -69,7 +69,7 @@
39 timers = new Timer [3];
40 this.username = username;
41 Contacts = Enumerable.Empty<FriendItem> ();
42- blog = new Twitter (username, password, service);
43+ blog = new Twitter (username, password, service, "Do");
44 timeline_last_updated = messages_last_updated = DateTime.UtcNow;
45
46 timers [0] = new Timer (UpdateContacts, null, 1 * 1000, UpdateContactsTimeout);
47
48=== modified file 'Microblogging/src/Twitterizer/Twitterizer.Framework/DataTransferObjects/TwitterParameters.cs'
49--- Microblogging/src/Twitterizer/Twitterizer.Framework/DataTransferObjects/TwitterParameters.cs 2008-12-11 04:16:01 +0000
50+++ Microblogging/src/Twitterizer/Twitterizer.Framework/DataTransferObjects/TwitterParameters.cs 2009-05-18 05:34:19 +0000
51@@ -39,7 +39,7 @@
52 Since,
53 SinceID,
54 Count,
55- Page,
56+ Page
57 }
58
59 public class TwitterParameters : Dictionary<TwitterParameterNames, object>
60@@ -67,6 +67,9 @@
61 case TwitterParameterNames.Page:
62 parameterString = string.Format("{0}&page={1}", parameterString, this[key]);
63 break;
64+ case TwitterParameterNames.ID:
65+ parameterString = string.Format("{0}&id={1}", parameterString, this[key]);
66+ break;
67 }
68 }
69
70
71=== modified file 'Microblogging/src/Twitterizer/Twitterizer.Framework/DataTransferObjects/TwitterRequestData.cs'
72--- Microblogging/src/Twitterizer/Twitterizer.Framework/DataTransferObjects/TwitterRequestData.cs 2008-12-11 04:16:01 +0000
73+++ Microblogging/src/Twitterizer/Twitterizer.Framework/DataTransferObjects/TwitterRequestData.cs 2009-05-18 05:34:19 +0000
74@@ -49,6 +49,13 @@
75 set { password = value; }
76 }
77
78+ private string source;
79+ public string Source
80+ {
81+ get { return source; }
82+ set { source = value; }
83+ }
84+
85 private Uri actionUri;
86 public Uri ActionUri
87 {
88
89=== modified file 'Microblogging/src/Twitterizer/Twitterizer.Framework/MethodClasses/TwitterStatusMethods.cs'
90--- Microblogging/src/Twitterizer/Twitterizer.Framework/MethodClasses/TwitterStatusMethods.cs 2009-04-13 04:10:11 +0000
91+++ Microblogging/src/Twitterizer/Twitterizer.Framework/MethodClasses/TwitterStatusMethods.cs 2009-05-18 05:34:19 +0000
92@@ -32,184 +32,190 @@
93
94 namespace Twitterizer.Framework
95 {
96- public class TwitterStatusMethods
97- {
98- private readonly string userName;
99- private readonly string password;
100-
101- public TwitterStatusMethods(string UserName, string Password)
102- {
103- userName = UserName;
104- password = Password;
105- }
106-
107- /// <summary>
108- /// Returns the 20 most recent statuses posted from the authenticating user.
109- /// </summary>
110- /// <returns></returns>
111- public TwitterStatusCollection UserTimeline()
112- {
113- return UserTimeline(null);
114- }
115-
116- /// <summary>
117- /// Returns the 20 most recent statuses posted from the authenticating user.
118- /// </summary>
119- /// <param name="Parameters">Accepts Count, Since, SinceID, and Page parameters.</param>
120- /// <returns></returns>
121- public TwitterStatusCollection UserTimeline(TwitterParameters Parameters)
122- {
123- TwitterRequest Request = new TwitterRequest();
124- TwitterRequestData Data = new TwitterRequestData();
125-
126- string actionUri = (Parameters == null ? Twitter.Urls.UserTimelineUrl : Parameters.BuildActionUri(Twitter.Urls.UserTimelineUrl));
127- Data.ActionUri = new Uri(actionUri);
128-
129- Data = Request.PerformWebRequest(Data);
130-
131- return Data.Statuses;
132- }
133-
134- /// <summary>
135- /// Returns the 20 most recent statuses from non-protected users who have set a custom user icon. Does not require authentication.
136- /// </summary>
137- /// <returns></returns>
138- public TwitterStatusCollection PublicTimeline()
139- {
140- TwitterRequest Request = new TwitterRequest();
141- TwitterRequestData Data = new TwitterRequestData();
142-
143- Data.ActionUri = new Uri(Twitter.Urls.PublicTimelineUrl);
144-
145- Data = Request.PerformWebRequest(Data);
146-
147- return Data.Statuses;
148- }
149-
150- /// <summary>
151- /// Returns the 20 most recent statuses posted by the authenticating user and that user's friends. This is the equivalent of /home on the Web.
152- /// </summary>
153- /// <returns></returns>
154- public TwitterStatusCollection FriendsTimeline()
155- {
156- return FriendsTimeline(null);
157- }
158-
159- /// <summary>
160- /// Returns the 20 most recent statuses posted by the authenticating user and that user's friends. This is the equivalent of /home on the Web.
161- /// </summary>
162- /// <param name="Parameters">Accepts Since, SinceID, Count, and Page parameters.</param>
163- /// <returns></returns>
164- public TwitterStatusCollection FriendsTimeline(TwitterParameters Parameters)
165- {
166- TwitterRequest Request = new TwitterRequest();
167- TwitterRequestData Data = new TwitterRequestData();
168- Data.UserName = userName;
169- Data.Password = password;
170-
171- string actionUri = (Parameters == null ? Twitter.Urls.FriendsTimelineUrl : Parameters.BuildActionUri(Twitter.Urls.FriendsTimelineUrl));
172- Data.ActionUri = new Uri(actionUri);
173-
174- Data = Request.PerformWebRequest(Data);
175-
176- return Data.Statuses;
177- }
178-
179- /// <summary>
180- /// Updates the authenticating user's status.
181- /// </summary>
182- /// <param name="Status">Required. The text of your status update.</param>
183- /// <returns></returns>
184- public TwitterStatus Update(string Status)
185- {
186- return Update(Status, null);
187- }
188-
189- /// <summary>
190- /// Updates the authenticating user's status.
191- /// </summary>
192- /// <param name="Status">Required. The text of your status update.</param>
193- /// <param name="InReplyToStatusID">Optional. The ID of an existing status that the status to be posted is in reply to.</param>
194- /// <returns></returns>
195- public TwitterStatus Update(string Status, int? InReplyToStatusID)
196- {
197- TwitterRequest Request = new TwitterRequest();
198- TwitterRequestData Data = new TwitterRequestData();
199- Data.UserName = userName;
200- Data.Password = password;
201-
202- Data.ActionUri = new Uri(
203- string.Format(Twitter.Urls.UpdateUrl, HttpUtility.UrlEncode(Status), InReplyToStatusID));
204-
205- Data = Request.PerformWebRequest(Data, "POST");
206-
207- return Data.Statuses[0];
208- }
209-
210- /// <summary>
211- /// Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status.
212- /// </summary>
213- /// <param name="ID">Required. The ID of the status to destroy.</param>
214- public void Destroy(int ID)
215- {
216- TwitterRequest Request = new TwitterRequest();
217- TwitterRequestData Data = new TwitterRequestData();
218- Data.UserName = userName;
219- Data.Password = password;
220-
221- Data.ActionUri = new Uri(
222- string.Format(Twitter.Urls.DestroyStatusUrl, ID));
223-
224- Request.PerformWebRequest(Data);
225- }
226-
227- /// <summary>
228- /// Returns a single status, specified by the id parameter
229- /// </summary>
230- /// <param name="ID">id. Required. The numerical ID of the status you're trying to retrieve.</param>
231- /// <returns></returns>
232- public TwitterUser Show(string ID)
233- {
234- TwitterRequest Request = new TwitterRequest();
235- TwitterRequestData Data = new TwitterRequestData();
236- Data.UserName = userName;
237- Data.Password = password;
238-
239- Data.ActionUri = new Uri(
240- string.Format(Twitter.Urls.ShowStatusUrl, ID));
241-
242- Data = Request.PerformWebRequest(Data, "GET");
243-
244- return Data.Users[0];
245- }
246-
247- /// <summary>
248- /// Returns the 20 most recent @replies (status updates prefixed with @username) for the authenticating user.
249- /// </summary>
250- /// <returns></returns>
251- public TwitterStatusCollection Replies()
252- {
253- return Replies(null);
254- }
255-
256- /// <summary>
257- /// Returns the 20 most recent @replies (status updates prefixed with @username) for the authenticating user.
258- /// </summary>
259- /// <param name="Parameters">Optional. Accepts Page, Since, and SinceID parameters.</param>
260- /// <returns></returns>
261- public TwitterStatusCollection Replies(TwitterParameters Parameters)
262- {
263- TwitterRequest Request = new TwitterRequest();
264- TwitterRequestData Data = new TwitterRequestData();
265- Data.UserName = userName;
266- Data.Password = password;
267-
268- string actionUri = (Parameters == null ? Twitter.Urls.RepliesUrl : Parameters.BuildActionUri(Twitter.Urls.RepliesUrl));
269- Data.ActionUri = new Uri(actionUri);
270-
271- Data = Request.PerformWebRequest(Data);
272-
273- return Data.Statuses;
274- }
275- }
276+ public class TwitterStatusMethods
277+ {
278+ private readonly string userName;
279+ private readonly string password;
280+ private readonly string source;
281+
282+ public TwitterStatusMethods(string UserName, string Password, string Source)
283+ {
284+ userName = UserName;
285+ password = Password;
286+ source = Source;
287+ }
288+
289+ /// <summary>
290+ /// Returns the 20 most recent statuses posted from the authenticating user.
291+ /// </summary>
292+ /// <returns></returns>
293+ public TwitterStatusCollection UserTimeline()
294+ {
295+ return UserTimeline(null);
296+ }
297+
298+ /// <summary>
299+ /// Returns the 20 most recent statuses posted from the authenticating user.
300+ /// </summary>
301+ /// <param name="Parameters">Accepts Count, Since, SinceID, and Page parameters.</param>
302+ /// <returns></returns>
303+ public TwitterStatusCollection UserTimeline(TwitterParameters Parameters)
304+ {
305+ TwitterRequest Request = new TwitterRequest();
306+ TwitterRequestData Data = new TwitterRequestData();
307+ Data.UserName = userName;
308+ Data.Password = password;
309+
310+ string actionUri = (Parameters == null ? Twitter.Urls.UserTimelineUrl : Parameters.BuildActionUri(Twitter.Urls.RootUrl));
311+ Data.ActionUri = new Uri(actionUri);
312+
313+ Data = Request.PerformWebRequest(Data);
314+
315+ return Data.Statuses;
316+ }
317+
318+ /// <summary>
319+ /// Returns the 20 most recent statuses from non-protected users who have set a custom user icon. Does not require authentication.
320+ /// </summary>
321+ /// <returns></returns>
322+ public TwitterStatusCollection PublicTimeline()
323+ {
324+ TwitterRequest Request = new TwitterRequest();
325+ TwitterRequestData Data = new TwitterRequestData();
326+
327+ Data.ActionUri = new Uri(Twitter.Urls.PublicTimelineUrl);
328+
329+ Data = Request.PerformWebRequest(Data);
330+
331+ return Data.Statuses;
332+ }
333+
334+ /// <summary>
335+ /// Returns the 20 most recent statuses posted by the authenticating user and that user's friends. This is the equivalent of /home on the Web.
336+ /// </summary>
337+ /// <returns></returns>
338+ public TwitterStatusCollection FriendsTimeline()
339+ {
340+ return FriendsTimeline(null);
341+ }
342+
343+ /// <summary>
344+ /// Returns the 20 most recent statuses posted by the authenticating user and that user's friends. This is the equivalent of /home on the Web.
345+ /// </summary>
346+ /// <param name="Parameters">Accepts Since, SinceID, Count, and Page parameters.</param>
347+ /// <returns></returns>
348+ public TwitterStatusCollection FriendsTimeline(TwitterParameters Parameters)
349+ {
350+ TwitterRequest Request = new TwitterRequest();
351+ TwitterRequestData Data = new TwitterRequestData();
352+ Data.UserName = userName;
353+ Data.Password = password;
354+
355+ string actionUri = (Parameters == null ? Twitter.Urls.FriendsTimelineUrl : Parameters.BuildActionUri(Twitter.Urls.FriendsTimelineUrl));
356+ Data.ActionUri = new Uri(actionUri);
357+
358+ Data = Request.PerformWebRequest(Data);
359+
360+ return Data.Statuses;
361+ }
362+
363+ /// <summary>
364+ /// Updates the authenticating user's status.
365+ /// </summary>
366+ /// <param name="Status">Required. The text of your status update.</param>
367+ /// <returns></returns>
368+ public TwitterStatus Update(string Status)
369+ {
370+ return Update(Status, null);
371+ }
372+
373+ /// <summary>
374+ /// Updates the authenticating user's status.
375+ /// </summary>
376+ /// <param name="Status">Required. The text of your status update.</param>
377+ /// <param name="InReplyToStatusID">Optional. The ID of an existing status that the status to be posted is in reply to.</param>
378+ /// <returns></returns>
379+ public TwitterStatus Update(string Status, int? InReplyToStatusID)
380+ {
381+ TwitterRequest Request = new TwitterRequest();
382+ TwitterRequestData Data = new TwitterRequestData();
383+ Data.UserName = userName;
384+ Data.Password = password;
385+ Data.Source = source;
386+
387+ Data.ActionUri = new Uri(
388+ string.Format(Twitter.Urls.UpdateUrl, HttpUtility.UrlEncode(Status), source,
389+ InReplyToStatusID.HasValue ? InReplyToStatusID.Value.ToString () : ""));
390+
391+ Data = Request.PerformWebRequest(Data, "POST");
392+
393+ return Data.Statuses[0];
394+ }
395+
396+ /// <summary>
397+ /// Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status.
398+ /// </summary>
399+ /// <param name="ID">Required. The ID of the status to destroy.</param>
400+ public void Destroy(int ID)
401+ {
402+ TwitterRequest Request = new TwitterRequest();
403+ TwitterRequestData Data = new TwitterRequestData();
404+ Data.UserName = userName;
405+ Data.Password = password;
406+
407+ Data.ActionUri = new Uri(
408+ string.Format(Twitter.Urls.DestroyStatusUrl, ID));
409+
410+ Request.PerformWebRequest(Data);
411+ }
412+
413+ /// <summary>
414+ /// Returns a single status, specified by the id parameter
415+ /// </summary>
416+ /// <param name="ID">id. Required. The numerical ID of the status you're trying to retrieve.</param>
417+ /// <returns></returns>
418+ public TwitterUser Show(string ID)
419+ {
420+ TwitterRequest Request = new TwitterRequest();
421+ TwitterRequestData Data = new TwitterRequestData();
422+ Data.UserName = userName;
423+ Data.Password = password;
424+
425+ Data.ActionUri = new Uri(
426+ string.Format(Twitter.Urls.ShowStatusUrl, ID));
427+
428+ Data = Request.PerformWebRequest(Data, "GET");
429+
430+ return Data.Users[0];
431+ }
432+
433+ /// <summary>
434+ /// Returns the 20 most recent @replies (status updates prefixed with @username) for the authenticating user.
435+ /// </summary>
436+ /// <returns></returns>
437+ public TwitterStatusCollection Replies()
438+ {
439+ return Replies(null);
440+ }
441+
442+ /// <summary>
443+ /// Returns the 20 most recent @replies (status updates prefixed with @username) for the authenticating user.
444+ /// </summary>
445+ /// <param name="Parameters">Optional. Accepts Page, Since, and SinceID parameters.</param>
446+ /// <returns></returns>
447+ public TwitterStatusCollection Replies(TwitterParameters Parameters)
448+ {
449+ TwitterRequest Request = new TwitterRequest();
450+ TwitterRequestData Data = new TwitterRequestData();
451+ Data.UserName = userName;
452+ Data.Password = password;
453+
454+ string actionUri = (Parameters == null ? Twitter.Urls.RepliesUrl : Parameters.BuildActionUri(Twitter.Urls.RepliesUrl));
455+ Data.ActionUri = new Uri(actionUri);
456+
457+ Data = Request.PerformWebRequest(Data);
458+
459+ return Data.Statuses;
460+ }
461+ }
462 }
463
464=== added file 'Microblogging/src/Twitterizer/Twitterizer.Framework/Service.cs'
465--- Microblogging/src/Twitterizer/Twitterizer.Framework/Service.cs 1970-01-01 00:00:00 +0000
466+++ Microblogging/src/Twitterizer/Twitterizer.Framework/Service.cs 2009-05-18 05:34:19 +0000
467@@ -0,0 +1,41 @@
468+/*
469+ * This file is part of the Twitterizer library <http://code.google.com/p/twitterizer/>
470+ *
471+ * Copyright (c) 2009, Alex Launi <alex.launi@gmail.com>
472+ * All rights reserved.
473+ *
474+ * Redistribution and use in source and binary forms, with or without modification, are
475+ * permitted provided that the following conditions are met:
476+ *
477+ * - Redistributions of source code must retain the above copyright notice, this list
478+ * of conditions and the following disclaimer.
479+ * - Redistributions in binary form must reproduce the above copyright notice, this list
480+ * of conditions and the following disclaimer in the documentation and/or other
481+ * materials provided with the distribution.
482+ * - Neither the name of the Twitterizer nor the names of its contributors may be
483+ * used to endorse or promote products derived from this software without specific
484+ * prior written permission.
485+ *
486+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
487+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
488+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
489+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
490+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
491+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
492+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
493+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
494+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
495+ * POSSIBILITY OF SUCH DAMAGE.
496+ */
497+
498+using System;
499+
500+namespace Twitterizer.Framework
501+{
502+
503+ public enum Service
504+ {
505+ Twitter = 0,
506+ Identica,
507+ }
508+}
509
510=== modified file 'Microblogging/src/Twitterizer/Twitterizer.Framework/Twitter.cs'
511--- Microblogging/src/Twitterizer/Twitterizer.Framework/Twitter.cs 2008-12-11 05:44:06 +0000
512+++ Microblogging/src/Twitterizer/Twitterizer.Framework/Twitter.cs 2009-05-18 05:34:19 +0000
513@@ -1,65 +1,93 @@
514-/*
515- * This file is part of the Twitterizer library <http://code.google.com/p/twitterizer/>
516- *
517- * Copyright (c) 2008, Patrick "Ricky" Smith <ricky@digitally-born.com>
518- * All rights reserved.
519- *
520- * Redistribution and use in source and binary forms, with or without modification, are
521- * permitted provided that the following conditions are met:
522- *
523- * - Redistributions of source code must retain the above copyright notice, this list
524- * of conditions and the following disclaimer.
525- * - Redistributions in binary form must reproduce the above copyright notice, this list
526- * of conditions and the following disclaimer in the documentation and/or other
527- * materials provided with the distribution.
528- * - Neither the name of the Twitterizer nor the names of its contributors may be
529- * used to endorse or promote products derived from this software without specific
530- * prior written permission.
531- *
532- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
533- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
534- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
535- * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
536- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
537- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
538- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
539- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
540- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
541- * POSSIBILITY OF SUCH DAMAGE.
542+/*
543+ * This file is part of the Twitterizer library <http://code.google.com/p/twitterizer/>
544+ *
545+ * Copyright (c) 2008, Patrick "Ricky" Smith <ricky@digitally-born.com>
546+ * All rights reserved.
547+ *
548+ * Redistribution and use in source and binary forms, with or without modification, are
549+ * permitted provided that the following conditions are met:
550+ *
551+ * - Redistributions of source code must retain the above copyright notice, this list
552+ * of conditions and the following disclaimer.
553+ * - Redistributions in binary form must reproduce the above copyright notice, this list
554+ * of conditions and the following disclaimer in the documentation and/or other
555+ * materials provided with the distribution.
556+ * - Neither the name of the Twitterizer nor the names of its contributors may be
557+ * used to endorse or promote products derived from this software without specific
558+ * prior written permission.
559+ *
560+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
561+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
562+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
563+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
564+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
565+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
566+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
567+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
568+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
569+ * POSSIBILITY OF SUCH DAMAGE.
570 */
571-
572-namespace Twitterizer.Framework
573+using System;
574+namespace Twitterizer.Framework
575 {
576- public enum Service {
577- Twitter = 0,
578- Identica,
579+ public class Twitter
580+ {
581+ public TwitterDirectMessageMethods DirectMessages;
582+ public TwitterStatusMethods Status;
583+ public TwitterUserMethods User;
584+
585+ internal static Urls Urls;
586+
587+ public Twitter(string UserName, string Password) :
588+ this(UserName, Password, Service.Twitter, "")
589+ {
590+ }
591+
592+ public Twitter(string UserName, string Password, string Source) :
593+ this(UserName, Password, Service.Twitter, Source)
594+ {
595+ }
596+
597+ public Twitter(string UserName, string Password, Service ServiceName) :
598+ this(UserName, Password, ServiceName, "")
599+ {
600+ }
601+
602+ public Twitter(string UserName, string Password, Service ServiceName , string Source)
603+ {
604+ DirectMessages = new TwitterDirectMessageMethods(UserName, Password);
605+ Status = new TwitterStatusMethods(UserName, Password, Source);
606+ User = new TwitterUserMethods(UserName, Password);
607+
608+ switch(ServiceName) {
609+ case Service.Twitter:
610+ Urls = new TwitterUrls();
611+ break;
612+ case Service.Identica:
613+ Urls = new IdenticaUrls();
614+ break;
615+ }
616+ }
617+
618+ public static bool VerifyCredentials(string username, string password)
619+ {
620+ TwitterRequest request = new TwitterRequest();
621+ TwitterRequestData data = new TwitterRequestData();
622+ data.UserName = username;
623+ data.Password = password;
624+ data.ActionUri = new Uri(Urls.VerifyCredentialsUrl);
625+
626+ try
627+ {
628+ data = request.PerformWebRequest(data, "GET");
629+ if (data.Users[0].ScreenName == username)
630+ {
631+ return true;
632+ }
633+ }
634+ catch { } // ignore exeptions - authentication failed
635+
636+ return false;
637+ }
638 }
639-
640- public class Twitter
641- {
642- public TwitterDirectMessageMethods DirectMessages;
643- public TwitterStatusMethods Status;
644- public TwitterUserMethods User;
645- internal static Urls Urls;
646-
647- public Twitter(string UserName, string Password) :
648 this (UserName, Password, Service.Twitter)
649- {
650- }
651-
652- public Twitter (string UserName, string Password, Service service)
653- {
654- DirectMessages = new TwitterDirectMessageMethods(UserName, Password);
655- Status = new TwitterStatusMethods(UserName, Password);
656- User = new TwitterUserMethods(UserName, Password);
657-
658- switch (service) {
659- case Service.Twitter:
660- Urls = new TwitterUrls ();
661- break;
662- case Service.Identica:
663- Urls = new IdenticaUrls ();
664- break;
665- }
666- }
667- }
668-}
669+}
670
671=== removed file 'Microblogging/src/Twitterizer/Twitterizer.Framework/Twitterizer.Framework.csproj'
672--- Microblogging/src/Twitterizer/Twitterizer.Framework/Twitterizer.Framework.csproj 2008-12-11 04:16:01 +0000
673+++ Microblogging/src/Twitterizer/Twitterizer.Framework/Twitterizer.Framework.csproj 1970-01-01 00:00:00 +0000
674@@ -1,60 +0,0 @@
675-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
676- <PropertyGroup>
677- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
678- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
679- <ProductVersion>8.0.50727</ProductVersion>
680- <SchemaVersion>2.0</SchemaVersion>
681- <ProjectGuid>{CE6E8A9A-565C-4823-BE7E-2CE8A4D5FE22}</ProjectGuid>
682- <OutputType>Library</OutputType>
683- <AppDesignerFolder>Properties</AppDesignerFolder>
684- <RootNamespace>Twitterizer.Framework</RootNamespace>
685- <AssemblyName>Twitterizer.Framework</AssemblyName>
686- </PropertyGroup>
687- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
688- <DebugSymbols>true</DebugSymbols>
689- <DebugType>full</DebugType>
690- <Optimize>false</Optimize>
691- <OutputPath>bin\Debug\</OutputPath>
692- <DefineConstants>DEBUG;TRACE</DefineConstants>
693- <ErrorReport>prompt</ErrorReport>
694- <WarningLevel>4</WarningLevel>
695- </PropertyGroup>
696- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
697- <DebugType>pdbonly</DebugType>
698- <Optimize>true</Optimize>
699- <OutputPath>bin\Release\</OutputPath>
700- <DefineConstants>TRACE</DefineConstants>
701- <ErrorReport>prompt</ErrorReport>
702- <WarningLevel>4</WarningLevel>
703- </PropertyGroup>
704- <ItemGroup>
705- <Reference Include="System" />
706- <Reference Include="System.configuration" />
707- <Reference Include="System.Data" />
708- <Reference Include="System.Web" />
709- <Reference Include="System.Xml" />
710- </ItemGroup>
711- <ItemGroup>
712- <Compile Include="Method Classes\TwitterDirectMessageMethods.cs" />
713- <Compile Include="Properties\AssemblyInfo.cs" />
714- <Compile Include="Twitter.cs" />
715- <Compile Include="TwitterizerException.cs" />
716- <Compile Include="Data Transfer Objects\TwitterParameters.cs" />
717- <Compile Include="TwitterRequest.cs" />
718- <Compile Include="Data Transfer Objects\TwitterRequestData.cs" />
719- <Compile Include="Data Transfer Objects\TwitterStatus.cs" />
720- <Compile Include="Data Transfer Objects\TwitterStatusCollection.cs" />
721- <Compile Include="Method Classes\TwitterStatusMethods.cs" />
722- <Compile Include="Data Transfer Objects\TwitterUser.cs" />
723- <Compile Include="Data Transfer Objects\TwitterUserCollection.cs" />
724- <Compile Include="Method Classes\TwitterUserMethods.cs" />
725- </ItemGroup>
726- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
727- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
728- Other similar extension points exist, see Microsoft.Common.targets.
729- <Target Name="BeforeBuild">
730- </Target>
731- <Target Name="AfterBuild">
732- </Target>
733- -->
734-</Project>
735\ No newline at end of file
736
737=== modified file 'Microblogging/src/Twitterizer/Twitterizer.Framework/Urls.cs'
738--- Microblogging/src/Twitterizer/Twitterizer.Framework/Urls.cs 2009-02-28 16:16:48 +0000
739+++ Microblogging/src/Twitterizer/Twitterizer.Framework/Urls.cs 2009-05-18 05:34:19 +0000
740@@ -1,21 +1,31 @@
741-/* HttpLocation.cs
742- *
743- * GNOME Do is the legal property of its developers. Please refer to the
744- * COPYRIGHT file distributed with this
745- * source distribution.
746- *
747- * This program is free software: you can redistribute it and/or modify
748- * it under the terms of the GNU General Public License as published by
749- * the Free Software Foundation, either version 3 of the License, or
750- * (at your option) any later version.
751- *
752- * This program is distributed in the hope that it will be useful,
753- * but WITHOUT ANY WARRANTY; without even the implied warranty of
754- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
755- * GNU General Public License for more details.
756- *
757- * You should have received a copy of the GNU General Public License
758- * along with this program. If not, see <http://www.gnu.org/licenses/>.
759+/*
760+ * This file is part of the Twitterizer library <http://code.google.com/p/twitterizer/>
761+ *
762+ * Copyright (c) 2009, Alex Launi <alex.launi@gmail.com>
763+ * All rights reserved.
764+ *
765+ * Redistribution and use in source and binary forms, with or without modification, are
766+ * permitted provided that the following conditions are met:
767+ *
768+ * - Redistributions of source code must retain the above copyright notice, this list
769+ * of conditions and the following disclaimer.
770+ * - Redistributions in binary form must reproduce the above copyright notice, this list
771+ * of conditions and the following disclaimer in the documentation and/or other
772+ * materials provided with the distribution.
773+ * - Neither the name of the Twitterizer nor the names of its contributors may be
774+ * used to endorse or promote products derived from this software without specific
775+ * prior written permission.
776+ *
777+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
778+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
779+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
780+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
781+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
782+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
783+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
784+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
785+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
786+ * POSSIBILITY OF SUCH DAMAGE.
787 */
788
789 using System;
790@@ -25,73 +35,68 @@
791
792 internal abstract class Urls
793 {
794- string rootUrl;
795-
796- public Urls (string rootUrl)
797- {
798- this.rootUrl = rootUrl;
799- }
800+ public abstract string RootUrl { get; }
801
802 public string UpdateUrl {
803- get { return rootUrl + "statuses/update.xml?status={0}&source=Do&in_reply_to_status_id={1}"; }
804+ get { return RootUrl + "statuses/update.xml?status={0}&source={1}&in_reply_to_status_id={2}"; }
805 }
806
807 public string RepliesUrl {
808- get { return rootUrl + "statuses/replies.xml"; }
809+ get { return RootUrl + "statuses/replies.xml"; }
810 }
811
812 public string DirectMessagesUrl {
813- get { return rootUrl + "direct_messages.xml"; }
814+ get { return RootUrl + "direct_messages.xml"; }
815 }
816
817 public string SentDirectMessagesUrl {
818- get { return rootUrl + "direct_messages/sent.xml"; }
819+ get { return RootUrl + "direct_messages/sent.xml"; }
820 }
821
822 public string FriendsUrl {
823- get { return rootUrl + "statuses/friends.xml"; }
824+ get { return RootUrl + "statuses/friends.xml"; }
825 }
826
827 public string FollowersUrl {
828- get { return rootUrl + "statuses/followers.xml"; }
829+ get { return RootUrl + "statuses/followers.xml"; }
830 }
831
832 public string ShowStatusUrl {
833- get { return rootUrl + "users/show/{0}.xml"; }
834+ get { return RootUrl + "users/show/{0}.xml"; }
835 }
836
837 public string DestroyStatusUrl {
838- get { return rootUrl + "statuses/destroy/{0}.xml"; }
839+ get { return RootUrl + "statuses/destroy/{0}.xml"; }
840 }
841
842 public string UserTimelineUrl {
843- get { return rootUrl + "statuses/user_timeline.xml"; }
844+ get { return RootUrl + "statuses/user_timeline.xml"; }
845 }
846
847 public string PublicTimelineUrl {
848- get { return rootUrl + "statuses/public_timeline.xml"; }
849+ get { return RootUrl + "statuses/public_timeline.xml"; }
850 }
851
852 public string FriendsTimelineUrl {
853- get { return rootUrl + "statuses/friends_timeline.xml"; }
854+ get { return RootUrl + "statuses/friends_timeline.xml"; }
855+ }
856+
857+ public string VerifyCredentialsUrl {
858+ get { return RootUrl + "account/verify_credentials.xml"; }
859 }
860 }
861
862 internal class TwitterUrls : Urls
863 {
864- const string RootUrl = "http://twitter.com/";
865-
866- public TwitterUrls () : base (RootUrl)
867- {
868+ public override string RootUrl {
869+ get { return "http://twitter.com/"; }
870 }
871 }
872
873 internal class IdenticaUrls : Urls
874 {
875- const string RootUrl = "http://identi.ca/api/";
876-
877- public IdenticaUrls () : base (RootUrl)
878- {
879+ public override string RootUrl {
880+ get { return "http://identi.ca/api/"; }
881 }
882 }
883 }

Subscribers

People subscribed via source and target branches