home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 October / maximum-cd-2011-10.iso / DiscContents / digsby_setup.exe / lib / mail / hotmail / ajax.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-06-22  |  87.6 KB  |  1,755 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. import random
  5. import logging
  6. import digsbysite
  7. import common.asynchttp as asynchttp
  8. import re
  9. import util
  10. import util.net as net
  11. import util.primitives.funcs as funcs
  12. import util.callbacks as callbacks
  13. import weakref
  14. import uuid
  15.  
  16. def ntok():
  17.     return str(random.randint(0, 2147483647))
  18.  
  19. log = logging.getLogger('hotmail.ajax')
  20.  
  21. def Flags(*args):
  22.     return util.Storage(zip(args[::2], args[1::2]))
  23.  
  24. XMLPost = 0
  25. null = None
  26. import collections
  27. _versioned_classes = collections.defaultdict(dict)
  28.  
  29. def ForBuild(buildnum, clsname = None):
  30.     
  31.     def decorator(cls):
  32.         if not clsname:
  33.             pass
  34.         _versioned_classes[cls.__name__][buildnum] = cls
  35.         return cls
  36.  
  37.     return decorator
  38.  
  39.  
  40. class FppParamType(object):
  41.     String = ('_string',)
  42.     Date = ('_date',)
  43.     Array = ('_array',)
  44.     oArray = ('_oArray',)
  45.     Primitive = ('_primitive',)
  46.     Object = ('_object',)
  47.     Enum = ('_enum',)
  48.     Custom = '_custom'
  49.  
  50.  
  51. class TypeSystem(object):
  52.     _isFppObject = True
  53.     _default = None
  54.     
  55.     def __init__(self, name_or_type, name = None, val = None):
  56.         if name is not None:
  57.             type = name_or_type
  58.             name = name
  59.         else:
  60.             type = FppParamType.Custom
  61.             name = name_or_type
  62.         self.name = name
  63.         self.type = type
  64.         self.value = val
  65.  
  66.     
  67.     def escape(instance):
  68.         f = {
  69.             '_string': FppProxy.escape,
  70.             '_date': (lambda a: a),
  71.             '_array': FppProxy.arrayToString,
  72.             '_oArray': FppProxy.objToStringImpl,
  73.             '_object': FppProxy.objToStringImpl,
  74.             '_primitive': FppProxy.primitiveToString,
  75.             '_enum': (lambda a: str(a)) }.get(funcs.get(instance, 'type', None), FppProxy.objToString)
  76.         escaped_val = f(funcs.get(instance, 'value', None))
  77.         if escaped_val is None:
  78.             return 'null'
  79.         return escaped_val
  80.  
  81.     escape = staticmethod(escape)
  82.     
  83.     def __str__(self):
  84.         return '<TypeSystem %r>' % self.name
  85.  
  86.     
  87.     def toString(self):
  88.         return TypeSystem.escape(self)
  89.  
  90.     
  91.     def default(cls):
  92.         x = cls('')
  93.         if cls._default is None:
  94.             x.value = None
  95.         else:
  96.             x.value = type(cls._default)(cls._default)
  97.         return x
  98.  
  99.     default = classmethod(default)
  100.  
  101.  
  102. class NamedTypeSystem(TypeSystem):
  103.     
  104.     def __init__(self, name, val = None):
  105.         TypeSystem.__init__(self, type(self).__name__, name, val)
  106.  
  107.  
  108.  
  109. class _string(NamedTypeSystem):
  110.     _default = ''
  111.  
  112.  
  113. class _array(NamedTypeSystem):
  114.     _default = []
  115.  
  116.  
  117. class _enum(NamedTypeSystem):
  118.     _default = 0
  119.  
  120.  
  121. class _primitive(NamedTypeSystem):
  122.     _default = False
  123.  
  124.  
  125. class _oArray(NamedTypeSystem):
  126.     _default = { }
  127.  
  128.  
  129. class _object(NamedTypeSystem):
  130.     _default = { }
  131.  
  132. _custom = TypeSystem
  133.  
  134. class FppProperty(object):
  135.     
  136.     def __init__(self, name, typ, default = Sentinel):
  137.         self._name = name
  138.         self._type = typ
  139.         if default is not Sentinel:
  140.             self._default = FppMetaclass._classes[self._type](name)
  141.             self._default.value = default
  142.         
  143.  
  144.     
  145.     def __get__(self, obj, objtype):
  146.         default = getattr(self, '_default', FppMetaclass._classes[self._type].default())
  147.         if obj is None:
  148.             return default
  149.         if not hasattr(obj, '_field_%s' % self._name):
  150.             setattr(obj, '_field_%s' % self._name, default)
  151.         
  152.         val = getattr(obj, '_field_%s' % self._name)
  153.         if getattr(val, 'type', None) != self._type:
  154.             if val is None or val._isFppObject:
  155.                 return val
  156.             raise ValueError('%r has an invalid %r (with type = %r, value = %r)', obj, self._name, val.type, val.value)
  157.         getattr(val, 'type', None) != self._type
  158.         return val
  159.  
  160.     
  161.     def __set__(self, obj, val):
  162.         if (val is not None or getattr(val, 'value', None) is not None) and hasattr(val, 'type'):
  163.             if val.type != self._type:
  164.                 raise TypeError('%r must have type %r for the %r field. Got %r (value = %r) instead.', obj, self._type, self._name, val.type, val.value)
  165.             val.type != self._type
  166.         elif val is None or getattr(val, '_isFppObject', False):
  167.             pass
  168.         else:
  169.             x = FppMetaclass._classes[self._type].default()
  170.             x.value = val
  171.             val = x
  172.         setattr(obj, '_field_%s' % self._name, val)
  173.  
  174.  
  175.  
  176. class FppMetaclass(type):
  177.     _classes = {
  178.         '_enum': _enum,
  179.         '_string': _string,
  180.         '_array': _array,
  181.         '_primitive': _primitive,
  182.         '_object': _object,
  183.         '_oArray': _oArray,
  184.         '_custom': TypeSystem }
  185.     
  186.     def __init__(cls, name, bases, dict):
  187.         for field in cls._fields_:
  188.             setattr(cls, field[0], FppProperty(*field))
  189.         
  190.         
  191.         def default(_cls):
  192.             i = cls()
  193.             for _field in i._fields_:
  194.                 if len(_field) == 2:
  195.                     _default = FppMetaclass._classes[_field[1]].default()
  196.                 elif len(_field) == 3:
  197.                     if _field[2] is None:
  198.                         _default = None
  199.                     else:
  200.                         _default = FppMetaclass._classes[_field[1]](_field[2])
  201.                 
  202.                 setattr(i, _field[0], _default)
  203.             
  204.             return i
  205.  
  206.         default = (classmethod,)(default)
  207.         dict['default'] = default
  208.         FppMetaclass._classes[name] = cls
  209.         cls.default = default
  210.         cls._isFppObject = True
  211.         type.__init__(cls, name, bases, dict)
  212.  
  213.  
  214.  
  215. class FppClass(object):
  216.     _fields_ = []
  217.     __metaclass__ = FppMetaclass
  218.     
  219.     def __init__(self, *args, **kwds):
  220.         fieldnames = []
  221.         for field in self._fields_:
  222.             if len(field) == 3:
  223.                 setattr(self, field[0], field[2])
  224.             else:
  225.                 setattr(self, field[0], FppMetaclass._classes[field[1]].default())
  226.             fieldnames.append(field[0])
  227.         
  228.         for i in range(len(args)):
  229.             setattr(self, self._fields_[i][0], args[i])
  230.         
  231.         for key in kwds:
  232.             setattr(self, key, kwds[key])
  233.         
  234.  
  235.     
  236.     def __str__(self):
  237.         res = [
  238.             '{']
  239.         for field in self._fields_:
  240.             cls = FppMetaclass._classes[field[1]]
  241.             val = getattr(self, field[0])
  242.             if val is None:
  243.                 res.append('null')
  244.             else:
  245.                 res.append(cls.escape(val))
  246.             res.append(',')
  247.         
  248.         if res[-1] == ',':
  249.             res.pop(-1)
  250.         
  251.         res.append('}')
  252.         return ''.join(res)
  253.  
  254.     toString = escape = __str__
  255.     
  256.     def __repr__(self):
  257.         return '<%s %s>' % (type(self).__name__, (' '.join,)((lambda .0: for entry in .0:
  258. '%s=%r' % (entry[0], getattr(self, entry[0], None)))(self._fields_)))
  259.  
  260.  
  261.  
  262. class FppError(FppClass):
  263.     _fields_ = [
  264.         ('ErrorCode', '_string'),
  265.         ('Message', '_string'),
  266.         ('ErrorObj', '_object'),
  267.         ('StackTrace', '_string')]
  268.  
  269.  
  270. class FppReturnPackage(FppClass):
  271.     _fields_ = [
  272.         ('Status', '_enum'),
  273.         ('Value', '_object'),
  274.         ('OutRefParams', '_oArray'),
  275.         ('Error', 'FppError'),
  276.         ('ProfilingInfo', '_object')]
  277.  
  278. InboxUiData = ForBuild('1')(<NODE:12>)
  279. InboxUiData = ForBuild('13.3.3227.0707')(<NODE:12>)
  280. InboxUiData = ForBuild('15.3.2495.0616')(<NODE:12>)
  281. InboxUiData = ForBuild('16.0.1635.0608')(<NODE:12>)
  282.  
  283. class HmCandidacyInfo(FppClass):
  284.     _fields_ = [
  285.         ('Status', '_enum'),
  286.         ('Guid', '_string'),
  287.         ('ShowMakeLiveContact', '_enum')]
  288.  
  289. HmAuxData = ForBuild('1')(<NODE:12>)
  290. HmAuxData = ForBuild('15.1.3020.0910')(<NODE:12>)
  291. ItemResponseInfo = ForBuild('16.0.1635.0608')(<NODE:12>)
  292. MessageRenderingInfo = ForBuild('1')(<NODE:12>)
  293. MessageRenderingInfo = ForBuild('13.3.3227.0707')(<NODE:12>)
  294. MessageRenderingInfo = ForBuild('15.3.2495.0616')(<NODE:12>)
  295. AdvancedSearch = ForBuild('15.3.2495.0616')(<NODE:12>)
  296. MessageListRenderingInfo = ForBuild('1')(<NODE:12>)
  297. MessageListRenderingInfo = ForBuild('13.3.3227.0707')(<NODE:12>)
  298. MessageListRenderingInfo = ForBuild('15.3.2495.0616')(<NODE:12>)
  299. MessageListRenderingInfo = ForBuild('15.4.0317.0921')(<NODE:12>)
  300. MessageListRenderingInfo = ForBuild('16.0.1635.0608')(<NODE:12>)
  301.  
  302. class HmSimpleMsg(FppClass):
  303.     _fields_ = [
  304.         ('IsBlocking', '_primitive'),
  305.         ('YesCode', '_primitive'),
  306.         ('NoCode', '_primitive'),
  307.         ('Message', '_string')]
  308.  
  309.  
  310. class __2(FppClass):
  311.     _fields_ = [
  312.         ('IsBlocking', '_primitive'),
  313.         ('YesCode', '_primitive'),
  314.         ('NoCode', '_primitive'),
  315.         ('Message', '_string')]
  316.  
  317.  
  318. class __5(FppClass):
  319.     _fields_ = [
  320.         ('ExistingContacts', '_array'),
  321.         ('PotentialContacts', '_array'),
  322.         ('HasExistingContacts', '_primitive'),
  323.         ('HasPotentialContacts', '_primitive')]
  324.  
  325.  
  326. class __0(FppClass):
  327.     _fields_ = [
  328.         ('Url', '_string'),
  329.         ('CommandCode', '_primitive'),
  330.         ('Text', '_string')]
  331.  
  332.  
  333. class __1(FppClass):
  334.     _fields_ = [
  335.         ('MessageType', '_enum'),
  336.         ('InfoCode', '_primitive'),
  337.         ('Message', '_string'),
  338.         ('ExtendedMessage', '_string'),
  339.         ('PSValue', '_string')]
  340.  
  341.  
  342. class __3(FppClass):
  343.     _fields_ = [
  344.         ('FileName', '_string'),
  345.         ('FileId', '_string'),
  346.         ('Success', '_primitive'),
  347.         ('ShowMessage', '_primitive'),
  348.         ('ErrorCode', '_primitive')]
  349.  
  350.  
  351. class ABContact(FppClass):
  352.     _fields_ = [
  353.         ('DisplayName', '_string'),
  354.         ('PreferredEmail', '_string'),
  355.         ('ContactType', '_enum'),
  356.         ('PassportName', '_string'),
  357.         ('Guid', '_string'),
  358.         ('IsMessengerUser', '_primitive'),
  359.         ('IsFavorite', '_primitive'),
  360.         ('Cid', '_string'),
  361.         ('Emails', '_array'),
  362.         ('GleamState', '_enum')]
  363.  
  364.  
  365. class ABDetailedContact(FppClass):
  366.     _fields_ = [
  367.         ('ContactType', '_enum'),
  368.         ('FirstName', '_string'),
  369.         ('LastName', '_string'),
  370.         ('PassportName', '_string'),
  371.         ('NickName', '_string'),
  372.         ('Comment', '_string'),
  373.         ('IsMessengerUser', '_primitive'),
  374.         ('IsSmtpContact', '_primitive'),
  375.         ('IsFavorite', '_primitive'),
  376.         ('Emails', '_array'),
  377.         ('Phones', '_array'),
  378.         ('Locations', '_array'),
  379.         ('WebSites', '_array'),
  380.         ('Dates', '_array'),
  381.         ('Guid', '_string'),
  382.         ('Cid', '_string')]
  383.  
  384.  
  385. class ABGroup(FppClass):
  386.     _fields_ = [
  387.         ('Guid', '_string'),
  388.         ('QuickName', '_string')]
  389.  
  390.  
  391. class ABDetailedGroup(FppClass):
  392.     _fields_ = [
  393.         ('Guid', '_string'),
  394.         ('QuickName', '_string'),
  395.         ('Count', '_primitive')]
  396.  
  397.  
  398. class __4(FppClass):
  399.     _fields_ = [
  400.         ('Groups', '_array'),
  401.         ('Contacts', '_array'),
  402.         ('FileAs', '_enum'),
  403.         ('SelectedGuid', '_string'),
  404.         ('SelectedGroup', 'ABDetailedGroup'),
  405.         ('SelectedContact', 'ABDetailedContact'),
  406.         ('HasSelectedGuid', '_primitive'),
  407.         ('HasSelectedGroup', '_primitive')]
  408.  
  409.  
  410. class ABEmail(FppClass):
  411.     _fields_ = [
  412.         ('Type', '_enum'),
  413.         ('Email', '_string')]
  414.  
  415.  
  416. class ABPhone(FppClass):
  417.     _fields_ = [
  418.         ('Type', '_enum'),
  419.         ('Phone', '_string')]
  420.  
  421.  
  422. class ABLocation(FppClass):
  423.     _fields_ = [
  424.         ('Name', '_string'),
  425.         ('Street', '_string'),
  426.         ('City', '_string'),
  427.         ('State', '_string'),
  428.         ('Country', '_string'),
  429.         ('PostalCode', '_string')]
  430.  
  431.  
  432. class ABDate(FppClass):
  433.     _fields_ = [
  434.         ('Day', '_string'),
  435.         ('Month', '_string')]
  436.  
  437.  
  438. class ABWebSite(FppClass):
  439.     _fields_ = []
  440.  
  441.  
  442. class __6(FppClass):
  443.     _fields_ = [
  444.         ('MailboxSize', '_string'),
  445.         ('MailboxQuota', '_string')]
  446.  
  447.  
  448. class __7(FppClass):
  449.     _fields_ = [
  450.         ('FolderId', '_string'),
  451.         ('Name', '_string'),
  452.         ('Icon', '_string'),
  453.         ('UnreadMessagesCount', '_primitive'),
  454.         ('TotalMessagesCount', '_primitive'),
  455.         ('Size', '_string'),
  456.         ('IsSystem', '_primitive'),
  457.         ('IsHidden', '_primitive'),
  458.         ('FolderType', '_enum'),
  459.         ('SystemFolderType', '_enum')]
  460.  
  461.  
  462. class __8(FppClass):
  463.     _fields_ = [
  464.         ('Name', '_string'),
  465.         ('Address', '_string'),
  466.         ('EncodedName', '_string')]
  467.  
  468.  
  469. class __9(FppClass):
  470.     _fields_ = [
  471.         ('Name', '_string')]
  472.  
  473.  
  474. class __10(FppClass):
  475.     _fields_ = [
  476.         ('SenderIDResult', '_enum'),
  477.         ('SenderEmail', '__8'),
  478.         ('IsKnownSender', '_primitive'),
  479.         ('ListUnsubscribeEmail', '_string'),
  480.         ('IsSenderInContactList', '_primitive')]
  481.  
  482.  
  483. class __12(FppClass):
  484.     _fields_ = [
  485.         ('DidSenderIDPass', '_primitive'),
  486.         ('DidSenderIDFail', '_primitive'),
  487.         ('IsBlockAvailableInBL', '_primitive'),
  488.         ('IsSameDomainInBL', '_primitive'),
  489.         ('IsSafeListDomain', '_primitive'),
  490.         ('IsMailingList', '_primitive'),
  491.         ('IsSenderHeaderPresent', '_primitive'),
  492.         ('IsListUnsubscribePresent', '_primitive'),
  493.         ('IsListUnsubscribeInEmailFormat', '_primitive'),
  494.         ('HasReachedMaxFilterLimit', '_primitive'),
  495.         ('IsNeverAllowOrBlockDomain', '_primitive'),
  496.         ('IsBlockSenderException', '_primitive')]
  497.  
  498.  
  499. class __13(FppClass):
  500.     _fields_ = [
  501.         ('IsFromPRAOnBlockList', '_primitive'),
  502.         ('HasReachedSafeListLimit', '_primitive'),
  503.         ('HasEntriesFromSameDomainInSafeList', '_primitive'),
  504.         ('IsDomainSafe', '_primitive'),
  505.         ('IsSingleToAndNotRecipient', '_primitive'),
  506.         ('HasFilterToJunkToAddress', '_primitive'),
  507.         ('IsRecipientAddressRFCCompliant', '_primitive'),
  508.         ('HasReachedMailingListLimit', '_primitive'),
  509.         ('IsNeverAllowOrBlockDomain', '_primitive'),
  510.         ('IsInContacts', '_primitive')]
  511.  
  512.  
  513. class __14(FppClass):
  514.     _fields_ = [
  515.         ('Action', '_enum'),
  516.         ('Reason', '_string'),
  517.         ('CalendarEventUrl', '_string'),
  518.         ('Subject', '_string'),
  519.         ('To', '_string'),
  520.         ('Where', '_string'),
  521.         ('When', '_string')]
  522.  
  523.  
  524. class __16(FppClass):
  525.     _fields_ = [
  526.         ('Header', '__22'),
  527.         ('Body', '_string'),
  528.         ('Attachments', '_array'),
  529.         ('ToLineString', '_string'),
  530.         ('CCLineString', '_string'),
  531.         ('BccLineString', '_string'),
  532.         ('Rfc822References', '_string'),
  533.         ('Rfc822MessageId', '_string'),
  534.         ('Rfc822InReplyTo', '_string'),
  535.         ('DateSentLocal', '_string'),
  536.         ('DateReceivedLocal', '_string'),
  537.         ('SafetyLevel', '_enum'),
  538.         ('MailSenderInfo', '__10'),
  539.         ('MeetingResponseInfo', '__14'),
  540.         ('MeetingIcalId', '_string'),
  541.         ('ReplyFromAddress', '_string'),
  542.         ('HasPhishingLinks', '_primitive'),
  543.         ('IsVerifiedMail', '_primitive'),
  544.         ('AllowUnsafeContentOverride', '_primitive'),
  545.         ('UnsafeContentFiltered', '_primitive'),
  546.         ('UnsafeImagesFiltered', '_primitive'),
  547.         ('DetectedCodePages', '_array'),
  548.         ('CurrentCodePage', '_primitive'),
  549.         ('DraftId', '_string')]
  550.  
  551.  
  552. class __17(FppClass):
  553.     _fields_ = [
  554.         ('ContentType', '_string'),
  555.         ('Name', '_string'),
  556.         ('Size', '_string'),
  557.         ('BodyIndex', '_primitive'),
  558.         ('AttachmentIndex', '_primitive'),
  559.         ('ForwardId', '_string')]
  560.  
  561.  
  562. class __18(FppClass):
  563.     _fields_ = [
  564.         ('EOF', '_primitive')]
  565.  
  566.  
  567. class __19(FppClass):
  568.     _fields_ = [
  569.         ('Prefix', '_string'),
  570.         ('Text', '_string')]
  571.  
  572.  
  573. class __21(FppClass):
  574.     _fields_ = [
  575.         ('MessageId', '_string'),
  576.         ('IsRead', '_primitive'),
  577.         ('TimeStamp', '_string'),
  578.         ('IsDraft', '_primitive'),
  579.         ('CP', '_primitive'),
  580.         ('AllowUnsafeContent', '_primitive'),
  581.         ('IsVoicemail', '_primitive'),
  582.         ('IsCalllog', '_primitive'),
  583.         ('IsPrivateVoicemail', '_primitive'),
  584.         ('IsMeetingReq', '_primitive')]
  585.  
  586.  
  587. class __22(FppClass):
  588.     _fields_ = [
  589.         ('AuxData', 'HmAuxData'),
  590.         ('MessageId', '_string'),
  591.         ('OriginalMessageId', '_string'),
  592.         ('FolderId', '_string'),
  593.         ('ExtendedType', '_enum'),
  594.         ('TypeData', '_enum'),
  595.         ('IsRead', '_primitive'),
  596.         ('PopSettingIndex', '_primitive'),
  597.         ('OriginalReplyState', '_enum'),
  598.         ('IsInWhiteList', '_primitive'),
  599.         ('SentState', '_enum'),
  600.         ('MessageSize', '_string'),
  601.         ('HasAttachments', '_primitive'),
  602.         ('From', '__8'),
  603.         ('Subject', '__19'),
  604.         ('DateReceivedUTC', '_date'),
  605.         ('DateReceived', '_date'),
  606.         ('Importance', '_enum'),
  607.         ('IsDraft', '_primitive'),
  608.         ('Marker', '__18'),
  609.         ('MessageSizeString', '_string'),
  610.         ('DateReceivedLocal', '_string'),
  611.         ('TimeStamp', '_string')]
  612.  
  613.  
  614. class BootstrapSeed(FppClass):
  615.     _fields_ = [
  616.         ('Mode', '_enum'),
  617.         ('FolderId', '_string'),
  618.         ('messageId', '_string'),
  619.         ('count', '_primitive'),
  620.         ('ascendingOrder', '_primitive'),
  621.         ('pageSize', '_primitive'),
  622.         ('totalMessages', '_primitive'),
  623.         ('renderHtml', '_primitive'),
  624.         ('returnHeaders', '_primitive'),
  625.         ('sortBy', '_enum')]
  626.  
  627.  
  628. class __23(FppClass):
  629.     _fields_ = [
  630.         ('User', '_string'),
  631.         ('UserName', '_string'),
  632.         ('Timestamp', '_string'),
  633.         ('Configuration', '__26'),
  634.         ('Folders', '_array'),
  635.         ('MessageInfo', '__24'),
  636.         ('TodayPage', '_string')]
  637.  
  638.  
  639. class __24(FppClass):
  640.     _fields_ = [
  641.         ('MessageListHtml', '_string'),
  642.         ('Headers', '_array'),
  643.         ('HeaderTags', '_array'),
  644.         ('MessageHtml', '_string'),
  645.         ('SelectedFolderId', '_string'),
  646.         ('SelectedMessageIndex', '_primitive'),
  647.         ('IsPlainText', '_primitive'),
  648.         ('OverrideCodePage', '_primitive'),
  649.         ('AllowUnsafeContent', '_primitive')]
  650.  
  651.  
  652. class __25(FppClass):
  653.     _fields_ = [
  654.         ('Signature', '_string'),
  655.         ('FromAddresses', '_array')]
  656.  
  657.  
  658. class __26(FppClass):
  659.     _fields_ = [
  660.         ('DefaultMsgsInListView', '_primitive'),
  661.         ('KeyboardPressesDelay', '_primitive'),
  662.         ('CachePagesOfMessageHeaders', '_primitive'),
  663.         ('EnableReadingPane', '_primitive'),
  664.         ('HasAcceptedJunkReporting', '_primitive'),
  665.         ('JunkReportingUISeen', '_primitive'),
  666.         ('DefaultContactsInListview', '_primitive'),
  667.         ('SpacesContactBindingEnabled', '_primitive'),
  668.         ('DoSpellCheckAsYouType', '_primitive'),
  669.         ('SpellCheckEnabledInLocale', '_primitive'),
  670.         ('ReadingPaneConfiguration', '_enum'),
  671.         ('AutoSelectMessage', '_primitive'),
  672.         ('MinimumIntervalBetweenSpellChecks', '_primitive'),
  673.         ('UserThemeID', '_primitive'),
  674.         ('SaveSentMessages', '_primitive'),
  675.         ('BalloonTipsEnabled', '_primitive'),
  676.         ('BalloonTipUserPreference', '_primitive'),
  677.         ('IsBigInbox', '_primitive'),
  678.         ('IsAdsDown', '_primitive'),
  679.         ('ForwardingOn', '_primitive')]
  680.  
  681.  
  682. class __27(FppClass):
  683.     _fields_ = [
  684.         ('ErrorCode', '_string'),
  685.         ('Folders', '_array'),
  686.         ('Headers', '_array')]
  687.  
  688. BatchInfo = ForBuild('15.3.2495.0616')(<NODE:12>)
  689. ConversationRenderingInfo = ForBuild('15.3.2495.0616')(<NODE:12>)
  690. MessagePartsUiData = ForBuild('15.3.2495.0616')(<NODE:12>)
  691. HMLiveViewRequestObject = ForBuild('15.3.2495.0616')(<NODE:12>)
  692. HMLiveViewRequestObject = ForBuild('15.4.0317.0921')(<NODE:12>)
  693. HMLiveViewResponseObject = ForBuild('15.3.2495.0616')(<NODE:12>)
  694. SandboxRequest = ForBuild('15.3.2495.0616')(<NODE:12>)
  695. SandboxResponse = ForBuild('15.3.2495.0616')(<NODE:12>)
  696. MiniCalendarUiObject = ForBuild('16.0.1635.0608')(<NODE:12>)
  697. MiniCalendarOptions = ForBuild('16.0.1635.0608')(<NODE:12>)
  698. ComposeData = ForBuild('16.0.1635.0608')(<NODE:12>)
  699. MessagePrefetchData = ForBuild('16.0.1635.0608')(<NODE:12>)
  700.  
  701. class FppProxy(object):
  702.     
  703.     def escape(b):
  704.         if b is None:
  705.             return b
  706.         a = ''
  707.         
  708.         def slash_escape(m):
  709.             return '\\' + m.group(0)
  710.  
  711.         if isinstance(b, unicode):
  712.             _b = b
  713.             b = b.encode('utf-8')
  714.         
  715.         a = ''.join([
  716.             '"',
  717.             str(b),
  718.             '"'])
  719.         a = re.sub('([\\{|\\}\\[|\\]\\,\\\\:])', slash_escape, a).encode('url')
  720.         return a
  721.  
  722.     escape = staticmethod(escape)
  723.     
  724.     def objToStringImpl(a):
  725.         t = type(a)
  726.         if t is unicode:
  727.             a = a.encode('utf-8')
  728.             t = str
  729.         
  730.         if a is None:
  731.             return 'null'
  732.         if t is str:
  733.             return FppProxy.escape(a)
  734.         if t is list:
  735.             return FppProxy.arrayToString(a)
  736.         if t is dict and hasattr(a, 'toString') or getattr(a, '_isFppObject', False):
  737.             return a.toString()
  738.         return FppProxy.objToString(a)
  739.  
  740.     objToStringImpl = staticmethod(objToStringImpl)
  741.     
  742.     def primitiveToString(a):
  743.         if a in ('', None, null, Null):
  744.             return 'null'
  745.         return str(a).lower()
  746.  
  747.     primitiveToString = staticmethod(primitiveToString)
  748.     
  749.     def arrayToString(a):
  750.         res = [
  751.             '[']
  752.         for x in a:
  753.             res.append(FppProxy.objToStringImpl(x))
  754.             res.append(',')
  755.         
  756.         if a:
  757.             res.pop()
  758.         
  759.         res.append(']')
  760.         return ''.join(res)
  761.  
  762.     arrayToString = staticmethod(arrayToString)
  763.     
  764.     def objToString(c):
  765.         if c is None:
  766.             return 'null'
  767.         a = [
  768.             '{']
  769.         for field in getattr(c, '_fields_'):
  770.             a.append(FppProxy.objToStringImpl(getattr(c, field[0])))
  771.             a.append(',')
  772.         
  773.         a[-1] = '}'
  774.         return ''.join(a)
  775.  
  776.     objToString = staticmethod(objToString)
  777.  
  778.  
  779. class Network_Type(object):
  780.     configuration = None
  781.     
  782.     def __init__(self, b, opener = None, start_config = { }):
  783.         self._isIE = False
  784.         self._isMoz = True
  785.         self._requests = []
  786.         self.configuration = b
  787.         self.opener = opener
  788.         self.configuration.__dict__.update(start_config)
  789.         self.configuration.SessionId = self.configuration.SessionId.decode('url')
  790.         self.HM = None
  791.  
  792.     
  793.     def set_HM(self, hm):
  794.         self.HM = hm
  795.  
  796.     
  797.     def set_base_url(self, baseurl):
  798.         self.base_url = baseurl
  799.  
  800.     
  801.     def createRequest(self, url, callback, verb):
  802.         return HM_Request(url, callback, self, self.opener, verb)
  803.  
  804.     
  805.     def process_response(self, resp, callback):
  806.         data = resp.read()
  807.         log.info('Processing hotmail response: %r', data)
  808.         if resp.code // 100 != 2:
  809.             e = Exception('%r was not successful (code = %r)', resp, resp.code)
  810.             log.info('%r', e)
  811.             return callback.error(e)
  812.         result = None
  813.         
  814.         try:
  815.             data = data.replace('new HM.', ' HM.')
  816.             _data = data
  817.             d = dict(HM = self.HM, true = True, false = False, null = None)
  818.             exec 'result = ' + data in d, d
  819.             result = d['result']
  820.         except Exception:
  821.             resp.code // 100 != 2
  822.             e = resp.code // 100 != 2
  823.             log.info('Could not process javascript response: %r', _data)
  824.             log.info('\terror was: %r', e)
  825.             data = _data
  826.             return self._process_response_re(data, callback)
  827.  
  828.         if result.Status.value == 0:
  829.             return callback.success(result.Value)
  830.         log.error("Got a non-zero status code (%r). Here's the whole response: %r", result.Status.value, _data)
  831.         return callback.error(result.Error)
  832.  
  833.     process_response = util.callsback(process_response)
  834.     
  835.     def _process_response_re(self, data, callback):
  836.         match = re.search('new HM\\.FppReturnPackage\\((\\S+?),', data)
  837.         if match is None:
  838.             e = Exception('Response has unknown status code: %r', data)
  839.             log.info('%r', e)
  840.             return callback.error(e)
  841.         status = match.group(1)
  842.         log.info('Got status code %r for hotmail request. data was: %r', status, data)
  843.         
  844.         try:
  845.             status = int(status)
  846.         except (ValueError, TypeError):
  847.             match is None
  848.             match is None
  849.             e = Exception("Status code could not be int()'d. it was %r (the whole response was %r)", status, data)
  850.             log.info('%r', e)
  851.             return callback.error(e)
  852.  
  853.         if status != 0:
  854.             e = Exception("Got a non-zero status code (%r). Here's the whole response: %r", status, data)
  855.             log.info('%r', e)
  856.             return callback.error(e)
  857.         return callback.success(data)
  858.  
  859.  
  860.  
  861. class HM_Request(object):
  862.     
  863.     def __init__(self, url, cb, network, opener, verb = None):
  864.         self.url = url
  865.         self.callback = cb
  866.         if not verb:
  867.             pass
  868.         self.verb = 'GET'
  869.         self.postString = None
  870.         self.context = None
  871.         self.headers = { }
  872.         self.opener = weakref.ref(opener)
  873.         self.network = network
  874.  
  875.     
  876.     def send(self, context):
  877.         self.context = context
  878.         r = asynchttp.HTTPRequest(self.url, self.postString, self.headers, method = self.verb, adjust_headers = False)
  879.         log.debug('opening request: method=%r url=%r post_data=%r headers=%r', self.verb, self.url, self.postString, self.headers)
  880.         cbargs = dict(success = self.on_response, error = self.on_error)
  881.  
  882.     
  883.     def on_response(self, req_or_resp = None, resp = None):
  884.         network = getattr(self, 'network', None)
  885.         if not resp:
  886.             pass
  887.         resp = req_or_resp
  888.         if network is not None:
  889.             log.info('Got response for %r: %r', self, resp)
  890.             self.network.process_response(resp, callback = self.callback)
  891.             self.abort()
  892.         else:
  893.             log.warning('This request (%r) already got response, so not doing anything with this response: %r', self, resp)
  894.  
  895.     
  896.     def on_error(self, e = None, resp = None):
  897.         log.error('Error in hotmail request: %r', e)
  898.         if not resp:
  899.             pass
  900.         self.callback.error(e)
  901.         self.abort()
  902.  
  903.     
  904.     def abort(self):
  905.         self.__dict__.clear()
  906.         self.__getattr__ = Null
  907.  
  908.     
  909.     def __repr__(self):
  910.         return '<%s %s>' % (type(self).__name__, (' '.join,)((lambda .0: for x in .0:
  911. '%s=%r' % (x, getattr(self, x)))(('verb', 'url', 'postString'))))
  912.  
  913.  
  914.  
  915. class FPPConfig(object):
  916.     RequestHandler = 'mail.fpp'
  917.     FppVersion = '1'
  918.     SessionId = ''
  919.     AuthUser = ''
  920.     CanaryToken = 'mt'
  921.     Version = '1'
  922.     PartnerID = ''
  923.     
  924.     def __init__(self, hotmail):
  925.         self.hotmail = weakref.ref(hotmail)
  926.  
  927.     
  928.     def CanaryValue(self):
  929.         hm = self.hotmail()
  930.         if hm is None:
  931.             return None
  932.         return hm.get_cookie(self.CanaryToken, domain = '.mail.live.com')
  933.  
  934.     CanaryValue = property(CanaryValue)
  935.  
  936.  
  937. class PageInfo(object):
  938.     fppCfg = None
  939.     SELF_PATH = '/mail/InboxLight.aspx'
  940.     queryString = {
  941.         'nonce': '2122195423' }
  942.  
  943.  
  944. def get_build_for(my_build, builds):
  945.     build = None
  946.     for build in reversed(sorted(builds)):
  947.         if my_build >= build:
  948.             return build
  949.     
  950.     return build
  951.  
  952.  
  953. class FppMethod(object):
  954.     
  955.     def __init__(self, impls):
  956.         self.impls = impls
  957.  
  958.     
  959.     def __get__(self, obj, objtype):
  960.         my_build = obj.build
  961.         build = get_build_for(my_build, self.impls.keys())
  962.         details = self.impls.get(build)
  963.         if details is None:
  964.             raise AttributeError('not valid for build %r' % my_build)
  965.         details is None
  966.         return FppMethodImpl(obj, *details)
  967.  
  968.  
  969.  
  970. class FppMethodImpl(object):
  971.     
  972.     def __init__(self, HM, params, method_name, tm, g, namespace):
  973.         self.HM = HM
  974.         self.method_name = self.name = method_name
  975.         new_params = []
  976.         for param in params:
  977.             if isinstance(param, tuple):
  978.                 (name, typ) = param
  979.                 cls = FppMetaclass._classes[typ]
  980.                 if type(cls) is FppMetaclass:
  981.                     new_params.append(_custom(name))
  982.                 else:
  983.                     new_params.append(cls(name))
  984.             type(cls) is FppMetaclass
  985.             new_params.append(param)
  986.         
  987.         self.params = new_params
  988.         self.tm = tm
  989.         self.g = g
  990.         self.namespace = namespace
  991.  
  992.     
  993.     def __call__(self, *args, **kwargs):
  994.         arg_names = [ x.name for x in self.params ]
  995.         arg_names.extend(('cb', 'ctx', 'cbError'))
  996.         vals = dict(zip(arg_names, args))
  997.         vals.update(kwargs)
  998.         cb = None
  999.         ctx = None
  1000.         cbError = None
  1001.         if 'cbError' in kwargs:
  1002.             cbError = kwargs.get('cbError')
  1003.         
  1004.         if 'ctx' in kwargs:
  1005.             ctx = kwargs.get('ctx')
  1006.         
  1007.         for remaining in args[len(vals):]:
  1008.             if cb is None:
  1009.                 cb = remaining
  1010.                 continue
  1011.             
  1012.             if ctx is None:
  1013.                 ctx = remaining
  1014.                 continue
  1015.             
  1016.             if cbError is None:
  1017.                 cbError = remaining
  1018.                 continue
  1019.                 continue
  1020.         
  1021.         Network = self.HM.Network
  1022.         prev = getattr(Network, '_fppPrevious', None)
  1023.         if prev is not None and prev._request is not None:
  1024.             prev._request.abort()
  1025.         
  1026.         f = FppMethodInvocation(self.namespace, self.method_name, cb, cbError, self.HM.build)
  1027.         f.Network = self.HM.Network
  1028.         f.Network._fppPrevious = f
  1029.         for param in self.params:
  1030.             if param.name not in vals:
  1031.                 vals[param.name] = FppMetaclass._classes[param.type].default().value
  1032.             
  1033.             f.addParameter(param.type, vals[param.name])
  1034.         
  1035.         f.invoke(ctx)
  1036.  
  1037.  
  1038.  
  1039. class FppMethodInvocation(object):
  1040.     _HTTP_HEADERS = {
  1041.         'X-FPP-Command': '0',
  1042.         'Accept': 'text/html,application/xhtml+xml,application/xml,application/x-javascript',
  1043.         'Accept-Charset': 'utf-8',
  1044.         'Accept-Encoding': 'gzip,identity',
  1045.         'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }
  1046.     
  1047.     def __init__(self, className, methodName, cb, cbError, build):
  1048.         self.className = className
  1049.         self.methodName = methodName
  1050.         self.callback = cb
  1051.         self.callbackError = cbError
  1052.         self.context = None
  1053.         self._request = None
  1054.         self._isInvoked = False
  1055.         self._params = []
  1056.         self.build = build
  1057.  
  1058.     
  1059.     def addParameter(self, a, b):
  1060.         self._params.append({
  1061.             'fppType': a,
  1062.             'value': b })
  1063.  
  1064.     
  1065.     def invoke(self, context):
  1066.         self.context = context
  1067.         if not self.Network.configuration:
  1068.             raise Exception('Network is not configured')
  1069.         self.Network.configuration
  1070.         if self._isInvoked:
  1071.             raise Exception('FppMethod %r already used', self)
  1072.         self._isInvoked
  1073.         self._isInvoked = True
  1074.         argstring = ''
  1075.         netconfig = self.Network.configuration
  1076.         if self._params:
  1077.             param_buffer = []
  1078.             escape = TypeSystem.escape
  1079.             for param in self._params:
  1080.                 escaped = escape({
  1081.                     'type': param['fppType'],
  1082.                     'value': param['value'] })
  1083.                 param_buffer.append(escaped)
  1084.                 param_buffer.append(',')
  1085.             
  1086.             argstring = ''.join(param_buffer[:-1])
  1087.         
  1088.         if not netconfig.PartnerID:
  1089.             pass
  1090.         url = net.UrlQuery(util.httpjoin(self.Network.base_url, netconfig.RequestHandler), cnmn = self.className + '.' + self.methodName, a = netconfig.SessionId, au = netconfig.AuthUser, ptid = '0')
  1091.         post_data = dict(cn = self.className, mn = self.methodName, d = argstring, v = netconfig.FppVersion)
  1092.         hdrs = self._HTTP_HEADERS.copy()
  1093.         if self.build >= '15.3.2506.0629':
  1094.             hdrs[netconfig.CanaryToken] = netconfig.CanaryValue
  1095.         else:
  1096.             post_data[netconfig.CanaryToken] = netconfig.CanaryValue
  1097.         
  1098.         def clear_request(resp):
  1099.             self._request = None
  1100.             self._isInvoked = False
  1101.  
  1102.         if self.callback is not None:
  1103.             self.callback.error.append(clear_request)
  1104.             self.callback.success.append(clear_request)
  1105.         
  1106.         b = self._request = self.Network.createRequest(url, self.callback, 'POST')
  1107.         b.headers = hdrs
  1108.         b.postString = '&'.join((lambda .0: for i in .0:
  1109. '%s=%s' % i)(post_data.items()))
  1110.         b.send(self)
  1111.         del self.Network
  1112.         del self._params
  1113.  
  1114.  
  1115.  
  1116. class HM_Type(FppProxy):
  1117.     namespace = 'HM'
  1118.     SortBy = Flags('Sender', 0, 'Subject', 1, 'Size', 2, 'Type', 3, 'Date', 4)
  1119.     FppStatus = Flags('SUCCESS', 0, 'ERR_HTTP_MISCONFIGURATION', -7, 'ERR_HTTP_PARSE_FAILURE', -6, 'ERR_HTTP_CONNECT_FAILURE', -5, 'ERR_HTTP_TIMEOUT', -4, 'ERR_SERVER_UNCAUGHT', -3, 'ERR_APP_SPECIFIC', -2, 'ERR_FPP_PROTOCOL', -1)
  1120.     ListNavigateDirection = Flags('FirstPage', 0, 'LastPage', 1, 'NextPage', 2, 'PreviousPage', 3, 'CurrentPage', 4)
  1121.     MessageBodyType = Flags('Part', 0, 'Full', 1)
  1122.     ItemView = Flags('Normal', 0, 'Deleted', 1, 'Junk', 2, 'Delayed', 3)
  1123.     PsaType = Flags('None', 0, 'Upsell', 1, 'Fre', 2, 'Auth', 3)
  1124.     FilterType = Flags('None', 0, 'Unread', 1, 'Contacts', 2, 'Flagged', 3, 'Photos', 4, 'Social', 5, 'Video', 6, 'File', 7, 'MailingList', 8, 'Shipping', 9, 'Other', 10, 'ResponsesToMe', 11, 'DocumentPlus', 12)
  1125.     JmrType = Flags('Junk', 0, 'NotJunk', 1, 'AV', 2, 'SVMOptInOptOut', 3, 'SVMClassification', 4, 'Phish', 5, 'Unsubscribe', 6, 'Compromised', 7, 'Unknown', -1)
  1126.     ReadMessageOperation = Flags('GetMessage', 0, 'NextMessage', 1, 'PreviousMessage', 2, 'MarkAsNotJunk', 3, 'Unsubscribe', 4, 'AddContact', 5, 'None', 6)
  1127.     RemoveSenderFromListOption = Flags('None', 0, 'KeepContact', 1, 'RemoveContact', 2, 'KeepSafeSender', 3, 'RemoveSafeSender', 4)
  1128.     ImportanceType = Flags('NORMAL', 0, 'LOW', 1, 'HIGH', 2)
  1129.     MessageSentStateType = Flags('NOACTION', 0, 'REPLIED', 1, 'FORWARDED', 2)
  1130.     MiniCalendarUiType = Flags('Month', 0, 'Day', 1)
  1131.     MessageActionType = Flags('ViewMessage', 0, 'Reply', 1, 'ReplyAll', 2, 'Forward', 3, 'ResumeDraft', 4, 'GetAttachment', 5, 'MarkAsJunkOrNotJunk', 6, 'Accept', 7, 'Decline', 8, 'Tentative', 9, 'AcceptExchangeSharing', 10, 'DeclineExchangeSharing', 11, 'Prefetch', 12, 'None', 13)
  1132.     NounEnum = Flags('SendersEmailAddress', 97, 'SendersName', 110, 'Subject', 115, 'ToOrCCHeader', 116, 'HasAttachments', 104)
  1133.     MessagePartDataType = Flags('Body', 0, 'ToList', 1, 'Message', 2)
  1134.     HMLiveViewResultCode = Flags('Success', 0, 'Failure', 1)
  1135.     SandboxAuthenticationOption = Flags('None', 0, 'Oauth', 1)
  1136.     ReadingPaneLocation = Flags('None', 0, 'Off', 1, 'Right', 2, 'Bottom', 3)
  1137.     __11 = Flags('Passed', 0, 'Failed', 1, 'Unknown', 2, 'SoftFail', 3)
  1138.     __15 = Flags('Ok', 0, 'OverQuota', 1, 'DoesntExist', 2, 'Error', 3, 'AccountDoesntExist', 4, 'AccountError', 5)
  1139.     __20 = Flags('Unknown', 0, 'MakeLiveContact', 1, 'AddLiveContact', 2, 'DontShow', 3)
  1140.     
  1141.     def FppReturnPackage(self):
  1142.         return self.GetFppTypeConstructor('FppReturnPackage')
  1143.  
  1144.     FppReturnPackage = property(FppReturnPackage)
  1145.     
  1146.     def FppError(self):
  1147.         return self.GetFppTypeConstructor('FppError')
  1148.  
  1149.     FppError = property(FppError)
  1150.     
  1151.     def HmSimpleMsg(self):
  1152.         return self.GetFppTypeConstructor('HmSimpleMsg')
  1153.  
  1154.     HmSimpleMsg = property(HmSimpleMsg)
  1155.     
  1156.     def InboxUiData(self):
  1157.         return self.GetFppTypeConstructor('InboxUiData')
  1158.  
  1159.     InboxUiData = property(InboxUiData)
  1160.     
  1161.     def build(self):
  1162.         return self.app_info.get('BUILD')
  1163.  
  1164.     build = property(build)
  1165.     
  1166.     def GetFppTypeConstructor(self, clsname):
  1167.         if clsname not in _versioned_classes:
  1168.             return globals()[clsname]
  1169.         
  1170.         try:
  1171.             cls_impls = _versioned_classes.get(clsname, None)
  1172.             if not cls_impls:
  1173.                 raise Exception("Class %r not found for build %r. here's known classes: %r", clsname, self.build, _versioned_classes)
  1174.             cls_impls
  1175.             build = get_build_for(self.build, cls_impls.keys())
  1176.             if build is None:
  1177.                 raise Exception("Build %r not found for cls = %r. here's known classes: %r", self.build, clsname, _versioned_classes)
  1178.             build is None
  1179.             cls = cls_impls[build]
  1180.             log.debug('Found class %r for version %r (my version is %r)', clsname, build, self.build)
  1181.             return cls
  1182.         except KeyError:
  1183.             clsname not in _versioned_classes
  1184.             e2 = clsname not in _versioned_classes
  1185.             log.error('Error looking for versioned class %r: %r', clsname, e2)
  1186.             raise e
  1187.         except:
  1188.             clsname not in _versioned_classes
  1189.  
  1190.  
  1191.     
  1192.     def __init__(self, network, base_url, app_info):
  1193.         self.Network = network
  1194.         self.app_info = app_info
  1195.         self.set_base_url(base_url)
  1196.         self.Network.set_HM(self)
  1197.  
  1198.     
  1199.     def set_base_url(self, hostname):
  1200.         self.base_url = 'https://%s/mail/' % hostname
  1201.         self.Network.set_base_url(self.base_url)
  1202.  
  1203.     AddContactFromMessagePart = FppMethod({
  1204.         '15.3.2506.0629': ([
  1205.             ('conversationId', '_string'),
  1206.             ('folderId', '_string'),
  1207.             ('startingMid', '_string'),
  1208.             ('numParts', '_primitive'),
  1209.             ('mpIndexMap', '_object'),
  1210.             ('messageRenderingInfo', 'MessageRenderingInfo'),
  1211.             ('contactName', '_string'),
  1212.             ('contactEmail', '_string'),
  1213.             ('demandLoadContentValues', '_array')], 'AddContactFromMessagePart', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1214.     GetInboxData = FppMethod({
  1215.         '1': ([
  1216.             _primitive('fetchFolderList'),
  1217.             _primitive('fetchMessageList'),
  1218.             _custom('messageListRenderingInfo'),
  1219.             _primitive('fetchMessage'),
  1220.             _custom('messageRenderingInfo')], 'GetInboxData', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox'),
  1221.         '15.1.3020.0910': ([
  1222.             ('fetchFolderList', '_primitive'),
  1223.             ('renderUrlsInFolderList', '_primitive'),
  1224.             ('fetchMessageList', '_primitive'),
  1225.             ('messageListRenderingInfo', '_custom'),
  1226.             ('fetchMessage', '_primitive'),
  1227.             ('messageRenderingInfo', '_custom')], 'GetInboxData', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1228.     ClearFolder = FppMethod({
  1229.         '1': ([
  1230.             _string('clearFolderId'),
  1231.             _custom('messageListRenderingInfo')], 'ClearFolder', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1232.     MoveMessagesToFolder = FppMethod({
  1233.         '1': ([
  1234.             _string('fromFolderId'),
  1235.             _string('toFolderId'),
  1236.             _array('messageList'),
  1237.             _array('messageAuxData'),
  1238.             _custom('messageListRenderingInfo'),
  1239.             _custom('messageRenderingInfo')], 'MoveMessagesToFolder', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox'),
  1240.         '13.3.3227.0707': ([
  1241.             _string('fromFolderId'),
  1242.             _string('toFolderId'),
  1243.             _array('messageList'),
  1244.             _array('messageAuxData'),
  1245.             _custom('messageListRenderingInfo')], 'MoveMessagesToFolder', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox'),
  1246.         '15.3.2495.0616': ([
  1247.             ('fromFolderId', '_string'),
  1248.             ('toFolderId', '_string'),
  1249.             ('messageList', '_array'),
  1250.             ('messageAuxData', '_array'),
  1251.             ('batchInfo', '_custom'),
  1252.             ('messageListRenderingInfo', '_custom'),
  1253.             ('fetchMessageList', '_primitive'),
  1254.             ('refreshFolderAndQuickViewLists', '_primitive'),
  1255.             ('folderNameForRuleSuggestion', '_string'),
  1256.             ('messageRenderingInfo', '_custom'),
  1257.             ('conversationRenderingInfo', '_custom'),
  1258.             ('fetchItem', '_primitive')], 'MoveMessagesToFolder', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox'),
  1259.         '15.4.0317.0921': ([
  1260.             ('fromFolderId', '_string'),
  1261.             ('toFolderId', '_string'),
  1262.             ('messageList', '_array'),
  1263.             ('messageAuxData', '_array'),
  1264.             ('batchInfo', 'BatchInfo'),
  1265.             ('messageListRenderingInfo', 'MessageListRenderingInfo'),
  1266.             ('fetchMessageList', '_primitive'),
  1267.             ('refreshFolderAndQuickViewLists', '_primitive'),
  1268.             ('folderNameForRuleSuggestion', '_string'),
  1269.             ('messageRenderingInfo', 'MessageRenderingInfo'),
  1270.             ('conversationRenderingInfo', 'ConversationRenderingInfo'),
  1271.             ('fetchItem', '_primitive'),
  1272.             ('blockIfDelete', '_primitive')], 'MoveMessagesToFolder', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1273.     ViewAllFromSender = FppMethod({
  1274.         '15.3.2495.0616': ([
  1275.             ('messageListRenderingInfo', 'MessageListRenderingInfo'),
  1276.             ('senderEmail', '_string')], 'ViewAllFromSender', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1277.     RestoreHiddenTrash = FppMethod({
  1278.         '16.0.1635.0608': ([
  1279.             ('messageListRenderingInfo', 'messageListRenderingInfo')], 'RestoreHiddenTrash', XMLPost, None, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1280.     MarkMessagesForJmr = FppMethod({
  1281.         '1': ([
  1282.             _string('folderId'),
  1283.             _array('messages'),
  1284.             _array('auxData'),
  1285.             _enum('jmrType'),
  1286.             _primitive('reportToJunk'),
  1287.             _custom('messageListRenderingInfo'),
  1288.             _custom('messageRenderingInfo')], 'MarkMessagesForJmr', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox'),
  1289.         '15.3.2495.0616': ([
  1290.             ('folderId', '_string'),
  1291.             ('messages', '_array'),
  1292.             ('auxData', '_array'),
  1293.             ('BatchInfo', 'BatchInfo'),
  1294.             ('jmrType', '_enum'),
  1295.             ('setReportToJunkOK', '_primitive'),
  1296.             ('messageListRenderingInfo', 'MessageListRenderingInfo'),
  1297.             ('messageRenderingInfo', 'MessageRenderingInfo'),
  1298.             ('refreshFolderAndQuickViewLists', '_primitive'),
  1299.             ('removeFromList', '_enum'),
  1300.             ('suppressListTransition', '_primitive'),
  1301.             ('markSenderAsSafe', '_primitive')], 'MarkMessagesForJmr', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox'),
  1302.         '16.0.1635.0608': ([
  1303.             ('folderId', '_string'),
  1304.             ('messagesParam', '_array'),
  1305.             ('auxData', '_array'),
  1306.             ('BatchInfo', 'BatchInfo'),
  1307.             ('jmrType', '_enum'),
  1308.             ('setReportToJunkOK', '_primitive'),
  1309.             ('messageListRenderingInfo', 'MessageListRenderingInfo'),
  1310.             ('messageRenderingInfo', 'MessageRenderingInfo'),
  1311.             ('refreshMessagesList', '_primitive'),
  1312.             ('refreshFolderAndQuickViewLists', '_primitive'),
  1313.             ('removeFromList', '_enum'),
  1314.             ('suppressListTransition', '_primitive'),
  1315.             ('markSenderAsSafe', '_primitive')], 'MarkMessagesForJmr', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1316.     ReportError = FppMethod({
  1317.         '1': ([
  1318.             _string('message')], 'ReportError', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1319.     AddContactFromMessage = FppMethod({
  1320.         '1': ([
  1321.             _custom('messageRenderingInfo'),
  1322.             _string('contactName'),
  1323.             _string('contactEmail')], 'AddContactFromMessage', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox'),
  1324.         '15.3.2495.0616': ([
  1325.             ('messageRenderingInfo', 'MessageRenderingInfo'),
  1326.             ('messageListRenderingInfo', 'MessageListRenderingInfo'),
  1327.             ('contactName', '_string'),
  1328.             ('contactEmail', '_string'),
  1329.             ('demandLoadContentValues', '_array')], 'AddContactFromMessage', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1330.     SvmFeedback = FppMethod({
  1331.         '1': ([
  1332.             _string('svmUrl'),
  1333.             _custom('messageRenderingInfo'),
  1334.             _custom('messageListRenderingInfo')], 'SvmFeedback', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1335.     MarkMessagesReadState = FppMethod({
  1336.         '1': ([
  1337.             _primitive('readState'),
  1338.             _array('messages'),
  1339.             _custom('messageListRenderingInfo')], 'MarkMessagesReadState', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox'),
  1340.         '15.1.3020.0910': ([
  1341.             _primitive('readState'),
  1342.             _array('messages'),
  1343.             _array('HmAuxData'),
  1344.             _custom('messageListRenderingInfo')], 'MarkMessagesReadState', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox'),
  1345.         '15.3.2495.0616': ([
  1346.             ('readState', '_primitive'),
  1347.             ('messages', '_array'),
  1348.             ('auxData', '_array'),
  1349.             ('batchInfo', '_custom'),
  1350.             ('messageListRenderingInfo', '_custom'),
  1351.             ('refreshFolderAndQuickViewLists', '_primitive')], 'MarkMessagesReadState', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1352.     MarkMessagesFlagState = FppMethod({
  1353.         '15.3.2495.0616': ([
  1354.             ('flagState', '_primitive'),
  1355.             ('messages', '_array'),
  1356.             ('auxData', '_array'),
  1357.             ('batchInfo', 'BatchInfo'),
  1358.             ('messageListRenderingInfo', 'MessageListRenderingInfo'),
  1359.             ('refreshFolderAndQuickViewLists', '_primitive')], 'MarkMessagesFlagState', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1360.     MarkMessagesFlagState = FppMethod({
  1361.         '15.3.2495.0616': ([
  1362.             ('flagState', '_primitive'),
  1363.             ('messages', '_array'),
  1364.             ('auxData', '_array'),
  1365.             ('batchInfo', 'BatchInfo'),
  1366.             ('messageListRenderingInfo', 'MessageListRenderingInfo'),
  1367.             ('refreshFolderAndQuickViewLists', '_primitive')], 'MarkMessagesFlagState', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1368.     SaveVoicemailOnPhone = FppMethod({
  1369.         '15.3.2495.0616': ([
  1370.             ('messageIdList', '_array')], 'SaveVoicemailOnPhone', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1371.     DeleteVoicemailOnPhone = FppMethod({
  1372.         '15.3.2495.0616': ([
  1373.             ('messageIdList', '_array')], 'DeleteVoicemailOnPhone', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1374.     GetConversationInboxData = FppMethod({
  1375.         '15.3.2495.0616': ([
  1376.             ('fetchFolderList', '_primitive'),
  1377.             ('renderUrlsInFolderList', '_primitive'),
  1378.             ('fetchConversationList', '_primitive'),
  1379.             ('conversationListRenderingInfo', 'conversationListRenderingInfo'),
  1380.             ('fetchConversation', '_primitive'),
  1381.             ('conversationRenderingInfo', 'ConversationRenderingInfo')], 'GetConversationInboxData', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1382.     GetSingleMessagePart = FppMethod({
  1383.         '15.3.2495.0616': ([
  1384.             ('conversationId', '_string'),
  1385.             ('folderId', '_string'),
  1386.             ('messageRenderingInfo', 'MessageRenderingInfo'),
  1387.             ('messagePartIndex', '_primitive'),
  1388.             ('showUnsubscribeLink', '_primitive')], 'GetSingleMessagePart', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1389.     GetManyMessageParts = FppMethod({
  1390.         '15.3.2495.0616': ([
  1391.             ('conversationId', '_string'),
  1392.             ('folderId', '_string'),
  1393.             ('startingMessageId', '_string'),
  1394.             ('numParts', '_primitive'),
  1395.             ('messageIdToIndexMap', '_object'),
  1396.             ('showUnsubscribeLink', '_primitive')], 'GetManyMessageParts', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1397.     GetFullMessagePart = FppMethod({
  1398.         '15.3.2495.0616': ([
  1399.             ('messageRenderingInfo', 'MessageRenderingInfo'),
  1400.             ('messagePartIndex', '_primitive'),
  1401.             ('showUnsubscribeLink', '_primitive')], 'GetFullMessagePart', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1402.     MarkMessagePartForJmr = FppMethod({
  1403.         '15.3.2495.0616': ([
  1404.             ('fetchConversation', '_primitive'),
  1405.             ('cid', '_string'),
  1406.             ('fid', '_string'),
  1407.             ('startingMid', '_string'),
  1408.             ('numParts', '_primitive'),
  1409.             ('mpIndexMap', '_object'),
  1410.             ('messageListRenderingInfo', 'MessageListRenderingInfo'),
  1411.             ('mpMids', '_array'),
  1412.             ('mpAuxDatas', '_array'),
  1413.             ('mpFid', '_string'),
  1414.             ('jmrType', '_enum'),
  1415.             ('setReportToJunkOK', '_primitive'),
  1416.             ('removeFromList', '_enum'),
  1417.             ('markSenderAsSafe', '_primitive')], 'MarkMessagePartForJmr', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1418.     CreateMoveRule = FppMethod({
  1419.         '15.3.2495.0616': ([
  1420.             ('ruleNoun', '_enum'),
  1421.             ('matchingString', '_string'),
  1422.             ('fid', '_string')], 'CreateMoveRule', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1423.     CreateSendersMoveRules = FppMethod({
  1424.         '15.3.2495.0616': ([
  1425.             ('emails', '_array'),
  1426.             ('fid', '_string')], 'CreateSendersMoveRules', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1427.     CreateRecipientMoveRule = FppMethod({
  1428.         '15.4.0317.0921': ([
  1429.             ('recipientEmail', '_string'),
  1430.             ('folderId', '_string'),
  1431.             ('folderName', '_string')], 'CreateRecipientMoveRule', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1432.     BlockSenders = FppMethod({
  1433.         '15.3.2495.0616': ([
  1434.             ('emails', '_array')], 'BlockSenders', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1435.     DemandLoad = FppMethod({
  1436.         '15.3.2495.0616': ([
  1437.             ('demandLoadContentValues', '_array')], 'DemandLoad', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1438.     UndoSenderMoveToBlockList = FppMethod({
  1439.         '15.3.2495.0616': ([
  1440.             ('senderAddress', '_string')], 'UndoSenderMoveToBlockList', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1441.     GetHMLiveViews = FppMethod({
  1442.         '15.3.2495.0616': ([
  1443.             ('requests', '_array')], 'GetHMLiveViews', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1444.     DispatchSandboxRequests = FppMethod({
  1445.         '15.3.2495.0616': ([
  1446.             ('requests', '_array')], 'DispatchSandboxRequests', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1447.     SendMessage_ec = FppMethod({
  1448.         '1': ([
  1449.             _string('to'),
  1450.             _string('from'),
  1451.             _string('cc'),
  1452.             _string('bcc'),
  1453.             _enum('priority'),
  1454.             _string('subject'),
  1455.             _string('message'),
  1456.             _array('attachments'),
  1457.             _string('draftId'),
  1458.             _string('draftFolderId'),
  1459.             _string('originalMessageId'),
  1460.             _string('rfc822MessageId'),
  1461.             _string('rfc822References'),
  1462.             _string('rfc822InReplyTo'),
  1463.             _enum('sentState'),
  1464.             _primitive('sendByPlainTextFormat'),
  1465.             _array('ignoredWordsFromSpellCheck'),
  1466.             _string('hipAnswer'),
  1467.             _string('hipMode'),
  1468.             _string('meetingIcalId')], 'SendMessage_ec', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox'),
  1469.         '15.1.3020.0910': None,
  1470.         '15.4.0317.0921': ([
  1471.             ('to', '_string'),
  1472.             ('from', '_string'),
  1473.             ('cc', '_string'),
  1474.             ('bcc', '_string'),
  1475.             ('ImportanceType', '_enum'),
  1476.             ('subject', '_string'),
  1477.             ('message', '_string'),
  1478.             ('messageForPlainTextConversion', '_string'),
  1479.             ('attachments', '_array'),
  1480.             ('draftId', '_string'),
  1481.             ('draftFolderId', '_string'),
  1482.             ('originalMessageId', '_string'),
  1483.             ('rfc822MessageId', '_string'),
  1484.             ('rfc822References', '_string'),
  1485.             ('rfc822InReplyTo', '_string'),
  1486.             ('MessageSentStateType', '_enum'),
  1487.             ('sendByPlainTextFormat', '_primitive'),
  1488.             ('ignoredWordsFromSpellCheck', '_array'),
  1489.             ('hipAnswer', '_string'),
  1490.             ('hipMode', '_string'),
  1491.             ('meetingIcalId', '_string')], 'SendMessage_ec', XMLPost, None, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox') })
  1492.  
  1493.  
  1494. class MailFolder(list):
  1495.     
  1496.     def __init__(self, account):
  1497.         list.__init__(self)
  1498.         self.account = account
  1499.         self.cur_page = 0
  1500.         self.more_pages = True
  1501.  
  1502.     
  1503.     def open(self):
  1504.         log.info('you clicked the inbox too soon')
  1505.  
  1506.     
  1507.     def __repr__(self):
  1508.         return '<%s %s>' % (type(self).__name__, list.__repr__(self))
  1509.  
  1510.  
  1511.  
  1512. class LivemaiLFolderBase(MailFolder):
  1513.     domain = 'mail.live.com'
  1514.     PAGECOUNT = 25
  1515.     
  1516.     def __init__(self, account, **k):
  1517.         MailFolder.__init__(self, account)
  1518.         self.count = 0
  1519.         util.autoassign(self, k)
  1520.         if getattr(self, 'link', None) is None:
  1521.             self.link = self.link_from_fid(str(uuid.UUID(int = folderids[self.name])))
  1522.         
  1523.         self.link = self.link + '&InboxSortAscending=False&InboxSortBy=Date'
  1524.  
  1525.     
  1526.     def link_from_fid(self, fid):
  1527.         return util.UrlQuery(util.httpjoin(self.account.base_url, 'InboxLight.aspx'), FolderID = fid)
  1528.  
  1529.     
  1530.     def from_doc(cls, doc, account):
  1531.         li = doc
  1532.         id = uuid.UUID(li.get('id'))
  1533.         
  1534.         try:
  1535.             count = int(li.get('count'))
  1536.         except Exception:
  1537.             _e = None
  1538.  
  1539.         if not doc.base_url:
  1540.             pass
  1541.         link = util.UrlQuery(account.base_url, FolderID = id)
  1542.         caption_span = doc.find('.//span[@class="Caption"]')
  1543.         if caption_span is not None:
  1544.             name = caption_span.text.strip()
  1545.         
  1546.         log.info('Folder %r for %s has %d new messages', name, account.name, count)
  1547.         return cls(account, id = id, name = name, link = link, count = count)
  1548.  
  1549.     from_doc = classmethod(from_doc)
  1550.     
  1551.     def link_for_page(self, pagenum):
  1552.         return util.UrlQuery(self.link, InboxPage = 'Next', Page = pagenum, InboxPageAnchor = getattr(self, 'last_seen_message', ''), NotAutoSelect = '', n = ntok())
  1553.  
  1554.     
  1555.     def open(self, callback = None):
  1556.         return callback.error('deprecated')
  1557.  
  1558.     open = util.callsback(open)
  1559.     
  1560.     def process_one_page(self, doc):
  1561.         max_ = self.count
  1562.         if not self.get_num_pages(doc):
  1563.             pass
  1564.         num_pages = max_ // self.PAGECOUNT + 1
  1565.         self.more_pages = self.cur_page < num_pages
  1566.         log.info('Parsing page %d of %d of folder %s', self.cur_page, num_pages, self.name)
  1567.         last_id_on_page = ''
  1568.         unreadcount = 0
  1569.         all_msgs = doc.findall('.//tr[@id]')
  1570.         for msg in all_msgs:
  1571.             msg = self.account.HM.GetFppTypeConstructor('LivemailMessage').from_doc(msg, self)
  1572.             unread = self.process_message(msg)
  1573.             if unread:
  1574.                 unreadcount += 1
  1575.                 self.append(msg)
  1576.             
  1577.             msgid = msg.id
  1578.             if msgid is not None:
  1579.                 if not msgid:
  1580.                     pass
  1581.                 last_id_on_page = last_id_on_page
  1582.                 continue
  1583.         
  1584.         self.last_seen_message = last_id_on_page
  1585.         return unreadcount
  1586.  
  1587.     
  1588.     def process_message(self, msg):
  1589.         return not (msg.opened)
  1590.  
  1591.     
  1592.     def get_num_pages(self, doc):
  1593.         num_pages = None
  1594.         
  1595.         try:
  1596.             lastpage_li = doc.find('.//*[@pndir="LastPage"]')
  1597.             if lastpage_li is not None:
  1598.                 lastpage_num_str = lastpage_li.get('pncur', None)
  1599.                 
  1600.                 try:
  1601.                     num_pages = int(lastpage_num_str)
  1602.                 except (TypeError, ValueError):
  1603.                     pass
  1604.                 except:
  1605.                     None<EXCEPTION MATCH>(TypeError, ValueError)
  1606.                 
  1607.  
  1608.             None<EXCEPTION MATCH>(TypeError, ValueError)
  1609.         except Exception:
  1610.             traceback.print_exc()
  1611.  
  1612.         return num_pages
  1613.  
  1614.  
  1615. LivemailFolder = ForBuild('1')(<NODE:12>)
  1616. import mail
  1617.  
  1618. class LivemailMessageBase(mail.emailobj.Email):
  1619.     
  1620.     def parsedate(self, datestring):
  1621.         return datestring
  1622.  
  1623.     
  1624.     def from_doc(cls, doc, folder):
  1625.         raise NotImplementedError
  1626.  
  1627.     from_doc = classmethod(from_doc)
  1628.     
  1629.     def __init__(self, folder, **k):
  1630.         self.folder = folder
  1631.         self.account = folder.account
  1632.         util.autoassign(self, k)
  1633.         mail.emailobj.Email.__init__(self, id = self.id, fromname = self.sender, sendtime = self.parsedate(self.date), subject = self.subject, attachments = self.attach)
  1634.         self.set_link()
  1635.         self.opened = False
  1636.  
  1637.     
  1638.     def set_link(self):
  1639.         self.link = util.UrlQuery(util.httpjoin(self.account.base_url, 'InboxLight.aspx'), Aux = self._mad, ReadMessageId = self.id, n = ntok())
  1640.  
  1641.     
  1642.     def mark_as_read(self):
  1643.         self.open()
  1644.  
  1645.     
  1646.     def open(self):
  1647.         log.info('Opening %r for %s', self, self.account.name)
  1648.         if self.opened:
  1649.             return None
  1650.         
  1651.         try:
  1652.             response = self.account.http.open(self.link)
  1653.             response.read()
  1654.             response.close()
  1655.         except Exception:
  1656.             self.opened
  1657.             self.opened
  1658.         except:
  1659.             self.opened
  1660.  
  1661.         self.opened = True
  1662.         log.info('Done opening %r for %s', self, self.account.name)
  1663.         return self.link
  1664.  
  1665.     
  1666.     def delete(self):
  1667.         log.info('Deleting %r', self)
  1668.         self.mark_as_read()
  1669.  
  1670.     
  1671.     def spam(self):
  1672.         log.info('Marking %r as spam', self)
  1673.         self.open()
  1674.  
  1675.     
  1676.     def Messages_remove(self, messageList, messageAuxData, callback = None):
  1677.         self.Messages_move(messageList, messageAuxData, self.folder.id, self.account.trash.id, callback = callback)
  1678.  
  1679.     Messages_remove = callbacks.callsback(Messages_remove)
  1680.     
  1681.     def Messages_move(self, messageList, messageAuxData, fromFolderId, toFolderId, callback = None):
  1682.         messageIds = [
  1683.             str(self.id)]
  1684.         messageListRenderingInfo = self.make_mlri()
  1685.         messageRenderingInfo = None
  1686.         kwargs = dict(fromFolderId = fromFolderId, toFolderId = toFolderId, messageList = messageList, messageAuxData = messageAuxData, messageListRenderingInfo = messageListRenderingInfo, messageRenderingInfo = messageRenderingInfo, callback = callback)
  1687.         self.account.HM.MoveMessagesToFolder(**kwargs)
  1688.  
  1689.     Messages_move = callbacks.callsback(Messages_move)
  1690.     
  1691.     def MarkMessagesReadState(self, callback = None):
  1692.         messageListRenderingInfo = self.make_mlri()
  1693.         mad = self.make_message_aux_data()
  1694.         self.account.HM.MarkMessagesReadState(readState = True, messages = [
  1695.             str(self.id)], HmAuxData = [
  1696.             mad], messageListRenderingInfo = messageListRenderingInfo, callback = callback)
  1697.  
  1698.     MarkMessagesReadState = callbacks.callsback(MarkMessagesReadState)
  1699.     
  1700.     def login_link(self):
  1701.         return '/cgi-bin/getmsg?msg=%s' % str(self.id).upper()
  1702.  
  1703.  
  1704. LivemailMessageOld = ForBuild('1', 'LivemailMessage')(<NODE:12>)
  1705. LivemailMessage = ForBuild('15.3.2495.0616')(<NODE:12>)
  1706. __BuildVersionDummy = ForBuild('15.4.3079.0223')(<NODE:12>)
  1707.  
  1708. def get_classname(js):
  1709.     return re.search('HM\\.registerFppClass\\("(.+?)",', js).group(1)
  1710.  
  1711.  
  1712. def get_fields(js):
  1713.     fields_re = re.compile('Web\\.Network\\.FppProxy\\._(_(?:.+?))\\("(.+?)"\\),')
  1714.     return [ x[::-1] for x in fields_re.findall(js) ]
  1715.  
  1716.  
  1717. def fppclass_to_python(js):
  1718.     pformat = pformat
  1719.     import pprint
  1720.     cname = get_classname(js)
  1721.     fields = get_fields(js)
  1722.     return 'class %s(FppClass):\n    _fields_ = %s\n' % (cname, pformat(fields))
  1723.  
  1724.  
  1725. def main():
  1726.     print str(HmAuxData('10\\|0\\|8CA6DDB632DFE40\\|', null))
  1727.  
  1728.  
  1729. def main2():
  1730.     testapp = testapp
  1731.     import tests.testapp
  1732.     a = testapp()
  1733.     Page = PageInfo()
  1734.     Page.fppCfg = FPPConfig(None)
  1735.     Network = Network_Type(Page.fppCfg)
  1736.     HM = HM_Type(Network)
  1737.     
  1738.     def doit(callback = (None,)):
  1739.         HM.GetInboxData(True, True, None, True, None, Null, None, None)
  1740.  
  1741.     doit = util.callsback(doit)
  1742.     
  1743.     def success(resp):
  1744.         print 'success', resp
  1745.  
  1746.     
  1747.     def error(e):
  1748.         print 'error', e
  1749.  
  1750.     doit(success = success, error = error)
  1751.  
  1752. if __name__ == '__main__':
  1753.     main()
  1754.  
  1755.