1 '''Current user profile.
2 '''
3
4 from utils import *
5 import weakref
6
7
9 '''Represents the profile of currently logged in user. Access using L{ISkype.CurrentUserProfile<skype.ISkype.CurrentUserProfile>}.
10 '''
11
13 '''__init__.
14
15 @param Skype: Skype object.
16 @type Skype: L{ISkype}
17 '''
18 self._SkypeRef = weakref.ref(Skype)
19
21 return self._Skype._Property('PROFILE', '', PropName, Set)
22
24 skype = self._SkypeRef()
25 if skype:
26 return skype
27 raise Exception()
28
29 _Skype = property(_Get_Skype)
30
32 return self._Property('ABOUT')
33
35 self._Property('ABOUT', value)
36
37 About = property(_GetAbout, _SetAbout,
38 doc='''"About" field of the profile.
39
40 @type: unicode
41 ''')
42
44 return int(self._Property('PSTN_BALANCE'))
45
46 Balance = property(_GetBalance,
47 doc='''Skype credit balance. Note that the precision of profile balance value is currently
48 fixed at 2 decimal places, regardless of currency or any other settings. Use L{BalanceValue}
49 to get the balance expressed in currency.
50
51 @type: int
52 @see: L{BalanceCurrency}, L{BalanceToText}, L{BalanceValue}
53 ''')
54
56 return self._Property('PSTN_BALANCE_CURRENCY')
57
58 BalanceCurrency = property(_GetBalanceCurrency,
59 doc='''Skype credit balance currency.
60
61 @type: unicode
62 @see: L{Balance}, L{BalanceToText}, L{BalanceValue}
63 ''')
64
66 return (u'%s %.2f' % (self.BalanceCurrency, self.BalanceValue)).strip()
67
68 BalanceToText = property(_GetBalanceToText,
69 doc='''Skype credit balance as properly formatted text with currency.
70
71 @type: unicode
72 @see: L{Balance}, L{BalanceCurrency}, L{BalanceValue}
73 ''')
74
76 return float(self._Property('PSTN_BALANCE')) / 100
77
78 BalanceValue = property(_GetBalanceValue,
79 doc='''Skype credit balance expressed in currency.
80
81 @type: float
82 @see: L{Balance}, L{BalanceCurrency}, L{BalanceToText}
83 ''')
84
86 value = self._Property('BIRTHDAY')
87 if len(value) == 8:
88 from datetime import date
89 from time import strptime
90 return date(*strptime(value, '%Y%m%d')[:3])
91
93 if value:
94 self._Property('BIRTHDAY', value.strftime('%Y%m%d'))
95 else:
96 self._Property('BIRTHDAY', 0)
97
98 Birthday = property(_GetBirthday, _SetBirthday,
99 doc='''"Birthday" field of the profile.
100
101 @type: datetime.date
102 ''')
103
105 return self._Property('CALL_APPLY_CF') == 'TRUE'
106
108 self._Property('CALL_APPLY_CF', cndexp(value, 'TRUE', 'FALSE'))
109
110 CallApplyCF = property(_GetCallApplyCF, _SetCallApplyCF,
111 doc='''Tells if call forwarding is enabled in the profile.
112
113 @type: bool
114 ''')
115
117 return self._Property('CALL_FORWARD_RULES')
118
120 self._Property('CALL_FORWARD_RULES', value)
121
122 CallForwardRules = property(_GetCallForwardRules, _SetCallForwardRules,
123 doc='''Call forwarding rules of the profile.
124
125 @type: unicode
126 ''')
127
129 return int(self._Property('CALL_NOANSWER_TIMEOUT'))
130
132 self._Property('CALL_NOANSWER_TIMEOUT', value)
133
134 CallNoAnswerTimeout = property(_GetCallNoAnswerTimeout, _SetCallNoAnswerTimeout,
135 doc='''Number of seconds a call will ring without being answered before it stops ringing.
136
137 @type: int
138 ''')
139
141 return self._Property('CALL_SEND_TO_VM') == 'TRUE'
142
144 self._Property('CALL_SEND_TO_VM', cndexp(value, 'TRUE', 'FALSE'))
145
146 CallSendToVM = property(_GetCallSendToVM, _SetCallSendToVM,
147 doc='''Tells whether calls will be sent to the voicemail.
148
149 @type: bool
150 ''')
151
153 return self._Property('CITY')
154
156 self._Property('CITY', value)
157
158 City = property(_GetCity, _SetCity,
159 doc='''"City" field of the profile.
160
161 @type: unicode
162 ''')
163
165 return chop(self._Property('COUNTRY'))[0]
166
168 self._Property('COUNTRY', value)
169
170 Country = property(_GetCountry, _SetCountry,
171 doc='''"Country" field of the profile.
172
173 @type: unicode
174 ''')
175
177 return self._Property('FULLNAME')
178
180 self._Property('FULLNAME', value)
181
182 FullName = property(_GetFullName, _SetFullName,
183 doc='''"Full name" field of the profile.
184
185 @type: unicode
186 ''')
187
188 - def _GetHomepage(self):
189 return self._Property('HOMEPAGE')
190
191 - def _SetHomepage(self, value):
192 self._Property('HOMEPAGE', value)
193
194 Homepage = property(_GetHomepage, _SetHomepage,
195 doc='''"Homepage" field of the profile.
196
197 @type: unicode
198 ''')
199
201 return self._Property('IPCOUNTRY')
202
203 IPCountry = property(_GetIPCountry,
204 doc='''ISO country code queried by IP address.
205
206 @type: unicode
207 ''')
208
210 return tuple(esplit(self._Property('LANGUAGES')))
211
213 self._Property('LANGUAGES', ' '.join(value))
214
215 Languages = property(_GetLanguages, _SetLanguages,
216 doc='''"ISO language codes of the profile.
217
218 @type: tuple of unicode
219 ''')
220
221 - def _GetMoodText(self):
222 return self._Property('MOOD_TEXT')
223
224 - def _SetMoodText(self, value):
225 self._Property('MOOD_TEXT', value)
226
227 MoodText = property(_GetMoodText, _SetMoodText,
228 doc='''"Mood text" field of the profile.
229
230 @type: unicode
231 ''')
232
234 return self._Property('PHONE_HOME')
235
237 self._Property('PHONE_HOME', value)
238
239 PhoneHome = property(_GetPhoneHome, _SetPhoneHome,
240 doc='''"Phone home" field of the profile.
241
242 @type: unicode
243 ''')
244
246 return self._Property('PHONE_MOBILE')
247
249 self._Property('PHONE_MOBILE', value)
250
251 PhoneMobile = property(_GetPhoneMobile, _SetPhoneMobile,
252 doc='''"Phone mobile" field of the profile.
253
254 @type: unicode
255 ''')
256
258 return self._Property('PHONE_OFFICE')
259
261 self._Property('PHONE_OFFICE', value)
262
263 PhoneOffice = property(_GetPhoneOffice, _SetPhoneOffice,
264 doc='''"Phone office" field of the profile.
265
266 @type: unicode
267 ''')
268
270 return self._Property('PROVINCE')
271
273 self._Property('PROVINCE', value)
274
275 Province = property(_GetProvince, _SetProvince,
276 doc='''"Province" field of the profile.
277
278 @type: unicode
279 ''')
280
282 return self._Property('RICH_MOOD_TEXT')
283
284 - def _SetRichMoodText(self, value):
285 self._Property('RICH_MOOD_TEXT', value)
286
287 RichMoodText = property(_GetRichMoodText, _SetRichMoodText,
288 doc='''Rich mood text of the profile.
289
290 @type: unicode
291 @see: U{https://developer.skype.com/Docs/ApiDoc/SET_PROFILE_RICH_MOOD_TEXT}
292 ''')
293
295 return self._Property('SEX')
296
298 self._Property('SEX', value)
299
300 Sex = property(_GetSex, _SetSex,
301 doc='''"Sex" field of the profile.
302
303 @type: L{User sex<enums.usexUnknown>}
304 ''')
305
307 return int(self._Property('TIMEZONE'))
308
310 self._Property('TIMEZONE', value)
311
312 Timezone = property(_GetTimezone, _SetTimezone,
313 doc='''Timezone of the current profile in minutes from GMT.
314
315 @type: int
316 ''')
317
319 return tuple(esplit(self._Property('SMS_VALIDATED_NUMBERS'), ', '))
320
321 ValidatedSmsNumbers = property(_GetValidatedSmsNumbers,
322 doc='''List of phone numbers the user has registered for usage in reply-to field of SMS messages.
323
324 @type: tuple of unicode
325 ''')
326