comparison libpurple/protocols/msn/msnutils.c @ 31292:47b6eda87723

propagate from branch 'im.pidgin.pidgin' (head 07d0765c444a097af45c2650f54323afb900a07b) to branch 'im.pidgin.soc.2010.msn-tlc' (head f3998422a4724ab424e4e2328f58fc0504856557)
author masca@cpw.pidgin.im
date Mon, 19 Jul 2010 21:11:32 +0000
parents 230caecf5435
children 23be655cc688
comparison
equal deleted inserted replaced
30698:e874875a74a7 31292:47b6eda87723
19 * 19 *
20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 */ 23 */
24
25 #include "internal.h"
26
24 #include "msn.h" 27 #include "msn.h"
25 #include "msnutils.h" 28 #include "msnutils.h"
26 29
27 #include "cipher.h" 30 #include "cipher.h"
28
29 char *rand_guid(void);
30 31
31 /************************************************************************** 32 /**************************************************************************
32 * Util 33 * Util
33 **************************************************************************/ 34 **************************************************************************/
34 char * 35 char *
35 rand_guid() 36 rand_guid(void)
36 { 37 {
37 return g_strdup_printf("%4X%4X-%4X-%4X-%4X-%4X%4X%4X", 38 return g_strdup_printf("%4X%4X-%4X-%4X-%4X-%4X%4X%4X",
38 rand() % 0xAAFF + 0x1111, 39 rand() % 0xAAFF + 0x1111,
39 rand() % 0xAAFF + 0x1111, 40 rand() % 0xAAFF + 0x1111,
40 rand() % 0xAAFF + 0x1111, 41 rand() % 0xAAFF + 0x1111,
474 475
475 *ret_host = host; 476 *ret_host = host;
476 *ret_port = port; 477 *ret_port = port;
477 } 478 }
478 479
480 gboolean
481 msn_email_is_valid(const char *passport)
482 {
483 if (purple_email_is_valid(passport)) {
484 /* Special characters aren't allowed in domains, so only go to '@' */
485 while (*passport != '@') {
486 if (*passport == '/')
487 return FALSE;
488 else if (*passport == '?')
489 return FALSE;
490 else if (*passport == '=')
491 return FALSE;
492 /* MSN also doesn't like colons, but that's checked already */
493
494 passport++;
495 }
496
497 return TRUE;
498 }
499
500 return FALSE;
501 }
502
479 /*************************************************************************** 503 /***************************************************************************
480 * MSN Challenge Computing Function 504 * MSN Challenge Computing Function
481 ***************************************************************************/ 505 ***************************************************************************/
482 506
483 /* 507 /*