void JabberClient::updateInfo(Contact *contact, void *data) { if (getState() != Connected){ Client::updateInfo(contact, data); return; } info_request((JabberUserData*)data); }
void JabberClient::updateInfo(Contact *contact, void *data) { if (getState() != Connected){ Client::updateInfo(contact, data); return; } if (data == NULL) data = &this->data.owner; info_request((JabberUserData*)data); }
void JabberClient::auth_ok() { if (getRegister()){ setRegister(false); setClientStatus(STATUS_OFFLINE); TCPClient::setStatus(getManualStatus(), getCommonStatus()); return; } setState(Connected); rosters_request(); info_request(NULL); setStatus(m_logonStatus); QTimer::singleShot(PING_TIMEOUT * 1000, this, SLOT(ping())); }
static void info_resp_handler(int err, const struct sip_msg *msg, void *arg, void *user_data) { struct sipsess_request *req = arg; if (err || sip_request_loops(&req->ls, msg->scode)) goto out; if (msg->scode < 200) { return; } else if (msg->scode < 300) { ; } else { if (req->sess->terminated) goto out; switch (msg->scode) { case 401: case 407: err = sip_auth_authenticate(req->sess->auth, msg); if (err) { err = (err == EAUTH) ? 0 : err; break; } err = info_request(req); if (err) break; return; case 408: case 481: sipsess_terminate(req->sess, 0, msg); break; } } out: if (!req->sess->terminated) { if (err == ETIMEDOUT) sipsess_terminate(req->sess, err, NULL); else req->resph(err, msg, req->arg, NULL); } mem_deref(req); }
/** * Send a SIP INFO request in the SIP Session * * @param sess SIP Session * @param ctype Content-type * @param body Content description (e.g. SDP) * @param resph Response handler * @param arg Handler argument * * @return 0 if success, otherwise errorcode */ int sipsess_info(struct sipsess *sess, const char *ctype, struct mbuf *body, sip_resp_h *resph, void *arg) { struct sipsess_request *req; int err; if (!sess || sess->terminated || !ctype || !body) return EINVAL; err = sipsess_request_alloc(&req, sess, ctype, body, resph, arg); if (err) return err; err = info_request(req); if (err) mem_deref(req); return err; }
JabberUserData *JabberClient::findContact(const char *alias, const char *name, bool bCreate, Contact *&contact) { char *resource = NULL; char *p = strchr((char*)alias, '@'); if (p){ p = strchr(p, '/'); if (p){ *p = 0; resource = p + 1; } } ContactList::ContactIterator it; while ((contact = ++it) != NULL){ JabberUserData *data; ClientDataIterator it(contact->clientData, this); while ((data = (JabberUserData*)(++it)) != NULL){ if (strcmp(data->ID, alias)) continue; if (resource) set_str(&data->Resource, resource); if (name) set_str(&data->Name, name); return data; } } if (!bCreate) return NULL; it.reset(); QString sname; if (name && *name){ sname = QString::fromUtf8(name).lower(); }else{ sname = QString::fromUtf8(alias).lower(); int pos = sname.find('@'); if (pos > 0) sname = sname.left(pos); } while ((contact = ++it) != NULL){ if (contact->getName().lower() == sname.lower()){ JabberUserData *data = (JabberUserData*)(contact->clientData.createData(this)); set_str(&data->ID, alias); if (resource) set_str(&data->Resource, resource); if (name) set_str(&data->Name, name); info_request(data); Event e(EventContactChanged, contact); e.process(); return data; } } contact = getContacts()->contact(0, true); JabberUserData *data = (JabberUserData*)(contact->clientData.createData(this)); set_str(&data->ID, alias); if (resource) set_str(&data->Resource, resource); if (name) set_str(&data->Name, name); contact->setName(sname); info_request(data); Event e(EventContactChanged, contact); e.process(); return data; }
JabberUserData *JabberClient::findContact(const char *alias, const char *host, const char *name, bool bCreate, Contact *&contact) { char *resource = NULL; char *p = strchr((char*)alias, '@'); if (p){ *p = 0; host = p + 1; p = strchr((char*)host, '/'); if (p){ *p = 0; resource = p + 1; } } if (host == NULL) host = data.owner.VHost; ContactList::ContactIterator it; while ((contact = ++it) != NULL){ JabberUserData *data; ClientDataIterator it(contact->clientData, this); while ((data = (JabberUserData*)(++it)) != NULL){ if (strcmp(data->ID, alias) || strcmp(data->VHost, host)) continue; if (resource) set_str(&data->Resource, resource); if (name) set_str(&data->Name, name); return data; } } if (!bCreate) return NULL; it.reset(); while ((contact = ++it) != NULL){ QString name = QString::fromUtf8(alias).lower(); if (name && *name) name = QString::fromUtf8(name).lower(); QString cname = contact->getName().lower(); if (contact->getName().lower() == name){ JabberUserData *data = (JabberUserData*)(contact->clientData.createData(this)); set_str(&data->ID, alias); set_str(&data->VHost, host); if (resource) set_str(&data->Resource, resource); if (name) set_str(&data->Name, name); info_request(data); Event e(EventContactChanged, contact); e.process(); return data; } } contact = getContacts()->contact(0, true); JabberUserData *data = (JabberUserData*)(contact->clientData.createData(this)); set_str(&data->ID, alias); set_str(&data->VHost, host); if (resource) set_str(&data->Resource, resource); if (name) set_str(&data->Name, name); contact->setName(QString::fromUtf8(alias)); if (name && *name) contact->setName(QString::fromUtf8(name)); info_request(data); Event e(EventContactChanged, contact); e.process(); return data; }
void cRadioCheck::Action(void) { if ((S_Verbose && 0x0f) >= 2) printf("vdr-radio: background-checking starts\n"); while (Running()) { #ifdef REELVDR //RC: in old radio 0.2.0 it was patched to cCondWait::SleepMs(100); // don't see any reason any more for this with vdr 1.7 #endif cCondWait::SleepMs(2000); // check Live-Radio if (IsRadioOrReplay == 1 && chan != NULL) { if (chan->Vpid()) { isyslog("radio: channnel '%s' got Vpid= %d", chan->Name(), chan->Vpid()); IsRadioOrReplay = 0; Channels.SwitchTo(cDevice::CurrentChannel()); //cDevice::PrimaryDevice()->SwitchChannel(chan, true); } else { if ((InfoTimeout-=2) <= 0) { InfoTimeout = 20; int chtid = chan->Tid(); // Kanal-EPG PresentEvent if (chan->Apid(0) > 0 && (chtid == PREMIERERADIO_TID || chtid == KDRADIO_TID || chtid == UMRADIO_TID1 || chtid == UMRADIO_TID2)) { cSchedulesLock schedLock; const cSchedules *scheds = cSchedules::Schedules(schedLock); if (scheds != NULL) { const cSchedule *sched = scheds->GetSchedule(chan->GetChannelID()); if (sched != NULL) { const cEvent *present = sched->GetPresentEvent(); if (present != NULL) { if (chtid == PREMIERERADIO_TID) // Premiere InfoTimeout = epg_premiere(present->Title(), present->Description(), present->StartTime(), present->EndTime()); else if (chtid == KDRADIO_TID) // Kabel Deutschland InfoTimeout = epg_kdg(present->Description(), present->StartTime(), present->EndTime()); else // Unity Media Kabel InfoTimeout = epg_unitymedia(present->Title(), present->Description(), present->StartTime(), present->EndTime()); InfoRequest = true; } else dsyslog("radio: no event.present (Tid= %d, Apid= %d)", chtid, chan->Apid(0)); } else dsyslog("radio: no schedule (Tid= %d, Apid= %d)", chtid, chan->Apid(0)); } } // Artist/Title with external script? else if (chan->Apid(0) > 0 && DoInfoReq) { InfoTimeout = info_request(chtid, chan->Apid(0)); InfoRequest = (InfoTimeout > 0); } } } } // temp. OSD-CloseTimeout #ifdef REELVDR RT_OsdTOTemp = (RT_OsdTOTemp > 0) ? RT_OsdTOTemp - 2 : 0; // in sec like this cycletime // TB: "-="?! doesn't make sense... #else (RT_OsdTOTemp > 0) ? RT_OsdTOTemp -= 2 : RT_OsdTOTemp = 0; // in sec like this cycletime #endif // Radiotext-Autodisplay if ((S_RtDispl == 2) && (RT_Info >= 0) && !RT_OsdTO && (RT_OsdTOTemp == 0) && RT_ReOpen && !Skins.IsOpen() && !cOsd::IsOpen()) cRemote::CallPlugin("radio"); } if ((S_Verbose && 0x0f) >= 2) printf("vdr-radio: background-checking ends\n"); }