Changeset ff72b8b in Renga
- Timestamp:
- Jun 19, 2019, 8:51:32 PM (5 years ago)
- Branches:
- main
- Children:
- 04c164a
- Parents:
- f7960fb
- Location:
- jabber
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
jabber/JabberSpeak.cpp
rf7960fb rff72b8b 1239 1239 JabberSpeak::handleItemUpdated(const gloox::JID& jid) 1240 1240 { 1241 printf("%s(%s)\n", __PRETTY_FUNCTION__, jid.full().c_str()); 1241 gloox::RosterItem* item = fClient->rosterManager()->getRosterItem(jid); 1242 UserID* roster_user = JRoster::Instance()->FindUser(JRoster::HANDLE, jid.full()); 1243 if (roster_user) { 1244 roster_user->SetSubscriptionStatus(item->subscription()); 1245 printf("%s(%s)\n", __PRETTY_FUNCTION__, jid.full().c_str()); 1246 printf(" name %s\n", item->name().c_str()); 1247 printf(" onln %d\n", item->online()); 1248 } else { 1249 printf("%s(%s) user not found\n", __PRETTY_FUNCTION__, jid.full().c_str()); 1250 } 1242 1251 } 1243 1252 … … 1376 1385 1377 1386 void 1378 JabberSpeak::handleSelfPresence(const gloox::RosterItem&, const string&, gloox::Presence::PresenceType, const string&) 1379 { 1380 printf("%s\n", __PRETTY_FUNCTION__); 1387 JabberSpeak::handleSelfPresence(const gloox::RosterItem&, const string& resource, gloox::Presence::PresenceType, const string& msg) 1388 { 1389 // TODO this gets called for giving us our current presence and message, 1390 // and also for all other resources, so we can know that the same user 1391 // is also online elsewhere 1392 printf("%s(%s, %s)\n", __PRETTY_FUNCTION__, resource.c_str(), msg.c_str()); 1381 1393 } 1382 1394 -
jabber/UserID.cpp
rf7960fb rff72b8b 25 25 // bare defaults 26 26 SetOnlineStatus(UserID::UNKNOWN); 27 SetAsk("");28 27 SetExactOnlineStatus("chat"); 29 28 SetSubscriptionStatus(gloox::S10nNone); … … 34 33 SetFriendlyName(copied_userid.FriendlyName()); 35 34 36 SetAsk(copied_userid.Ask());37 35 SetSubscriptionStatus(copied_userid.SubscriptionStatus()); 38 36 SetOnlineStatus(copied_userid.OnlineStatus()); … … 48 46 SetFriendlyName(rhs.FriendlyName()); 49 47 50 SetAsk(rhs.Ask());51 48 SetSubscriptionStatus(rhs.SubscriptionStatus()); 52 49 … … 66 63 } 67 64 68 const std::string UserID::Ask() const {69 return _ask;70 }71 72 65 UserID::online_status UserID::OnlineStatus() const { 73 if (_status == UNKNOWN && Ask() == "subscribe") {66 if (_status == UNKNOWN && (SubscriptionStatus() == gloox::S10nNoneOut || SubscriptionStatus() == gloox::S10nNoneOutIn || SubscriptionStatus() == gloox::S10nFromOut)) { 74 67 return UNACCEPTED; 75 68 } else { … … 232 225 } 233 226 234 void UserID::SetAsk(std::string status) {235 _ask = status;236 }237 238 227 void UserID::SetOnlineStatus(online_status status) { 239 228 // special value -
jabber/UserID.h
rf7960fb rff72b8b 28 28 const std::string FriendlyName() const; 29 29 30 const std::string Ask() const;31 30 online_status OnlineStatus() const; 32 31 const std::string ExactOnlineStatus() const; … … 55 54 void SetFriendlyName(std::string friendly_name); 56 55 57 void SetAsk(std::string status);58 56 void SetOnlineStatus(online_status status); 59 57 void SetExactOnlineStatus(std::string exact_status); … … 69 67 std::string _service; 70 68 71 std::string _ask;72 69 online_status _status; 73 70 std::string _exact_status;
Note:
See TracChangeset
for help on using the changeset viewer.