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