Пример #1
0
/*!
  \internal
  Constructs a DialerControl object and attaches it to \a parent.
*/
DialerControl::DialerControl( )
    : QObject( 0 ), mCallList(50), mCallManager(0), aaTid(0),
      mProfiles(0), missedCalls(0), phoneValueSpace("/Communications/Calls"),
      activeCallCount(-1)
{
    mCallManager = new QPhoneCallManager( this );
    connect( mCallManager, SIGNAL(newCall(QPhoneCall)),
             this, SLOT(newCall(QPhoneCall)) );

    connect( this, SIGNAL(callIncoming(QPhoneCall)),
            this, SLOT(cacheCall(QPhoneCall)) );
    connect( this, SIGNAL(callDropped(QPhoneCall)),
                                        this, SLOT(recordCall(QPhoneCall)) );
    mProfiles = new QPhoneProfileManager(this);

    QSettings setting("Trolltech", "qpe");
    setting.beginGroup("CallControl");
    missedCalls = setting.value("MissedCalls", 0).toInt();
    phoneValueSpace.setAttribute("MissedCalls", QVariant(missedCalls));
    doActiveCalls();
    QTimer::singleShot( 0, this, SLOT(readCachedCall()) );
}
Пример #2
0
Object * parseCall(Collector * c, Tokenizer * tt) {
	String * func = NULL;
	List * args = NULL;
	Object * call;

	func = newStringN(c, tt->c.len, tt->c.value);	if (!func) goto fail;
	args = parseValueList(c, tt); if (!args) goto fail;

	call = (Object *) newCall(c, func, args);
	if (!call) goto fail;
	return call;

fail:
	return NULL;
}
Пример #3
0
void Phone::newTCPConnection(int socket)
{
//	qWarning(QString("Phone::newTCPConnection(%1)").arg(socket));
	connections++;
	int callId = newCall();
	if (callId >= 0)
	{
		calls[callId]->start(socket, IHU_TCP);
		receivedCall(callId);
	}
	else
	{
		close(socket);
	}
}
Пример #4
0
void Phone::newUDPConnection(int socket)
{
//	qWarning(QString("Phone::newUDPConnection(%1)").arg(socket));
	connections++;
	delete notifier;
	notifier = NULL;
	int callId = newCall();
	if (callId >= 0)
	{
		calls[callId]->start(socket, IHU_UDP);
		receivedCall(callId);
	}
	else
	{
		close(socket);
	}
	waitCalls(inport, true, false);
}
Пример #5
0
PExpr MakeAccuAssign (DefTableKey compKey) {
/* on entry:
     compKey is a computation key; its AccuLhs property must be set
   on exit:
     an expression of type AssignKind is returned, constructed from the 
     three accu properties of compKey
*/
  PExpr lhs      = GetAccuLhs (compKey, NULLPExpr);
  PExprList exec = GetAccuExecList (compKey, NULLPExprList);
  PExprList deps = GetAccuDepList (compKey, NULLPExprList);
  PExpr res; 
  CoordPtr coord;

#ifdef ACCUTEST
  printf ("MakeAccuAssign begin lhs ok %d\n", lhs != NULLPExpr);
#endif
  if (lhs == NULLPExpr) return wrongExpr;

  coord = lhs->coord;

#ifdef ACCUTEST
  printf ("  line %d\n", LineOf (*coord));
#endif

  if (exec == NULLPExprList) 
     res = ex42;
  else if (TailPExprList (exec) == NULLPExprList)
     res = HeadPExprList (exec);
  else 
     res = newCall (ORDERsym, exec, coord);

  if (deps == NULLPExprList)
     res = newAssign (lhs, res, coord);
  else 
     res = newAssign (lhs, newDepend (res, deps, coord), coord);
#ifdef ACCUTEST
  printf ("MakeAccuAssign end\n");
#endif
  return res;
}/* MakeAccuAssign */
bool PhoneMonitorVoiceReportBase::event(QEvent *e)
{
	//printf("PhoneReport::event===%d\n",e->type());

	switch((int)(e->type()))
	{
		case NEW_CALL_EVENT:
		{
			PhoneMonitorNewCallEventC *phoneEvent =(PhoneMonitorNewCallEventC*)e;
			newCall(phoneEvent->cPhoneNumber);
			return TRUE;
		}
		case CALL_CONNECTED_EVENT:
		{
			PhoneMonitorCallConnectEventC *phoneEvent =(PhoneMonitorCallConnectEventC*)e;
			callConnect();
			return TRUE;
		}
		case CALL_HANG_UP_EVENT:
		{
			PhoneMonitorCallHangUpEventC *phoneEvent =(PhoneMonitorCallHangUpEventC*)e;
			callHangUp(phoneEvent->reason);
			return TRUE;
		}
		case CALL_HANG_UP_BY_SELF_EVENT:
		{
			PhoneMonitorHangupBySelfEventC *phoneEvent = (PhoneMonitorHangupBySelfEventC *)e;
			hangupBySelf();
			return TRUE;
		}
		case MISS_CALL_EVENT:
		{
			PhoneMonitorMissCallEventC *phoneEvent =(PhoneMonitorMissCallEventC*)e;
			missCall(phoneEvent->cPhoneNumber);
			return TRUE;
		}
		case NEW_SMS_EVENT:
		{
			PhoneMonitorNewSMSEventC *phoneEvent =(PhoneMonitorNewSMSEventC*)e;
			newSMS(phoneEvent->SMSData);
			return TRUE;
		}
		case SMS_SEND_RESULT_EVENT:
		{
			PhoneMonitorSmsSendResultEventC *phoneEvent =(PhoneMonitorSmsSendResultEventC*)e;
			smsSendResult(phoneEvent->result);
			return TRUE;
		}
		case SMS_SEND_WITH_ID_RESULT_EVENT:
		{
			PhoneMonitorSmsSendWithIdResultEventC *phoneEvent =(PhoneMonitorSmsSendWithIdResultEventC*)e;
			smsSendWithIdResult(phoneEvent->id, phoneEvent->result);
			return TRUE;
		}
		case SIGNAL_NETWORK_TYPE_NOTIFY_EVENT:
		{
			PhoneMonitorSignalAndNetworkTypeNotifyEventC *phoneEvent =(PhoneMonitorSignalAndNetworkTypeNotifyEventC*)e;
			signalAndNetworkType(phoneEvent->signal,phoneEvent->networkType);
			return TRUE;
		}
		case SIGNAL_NETWORK_SERVICE_TYPE_NOTIFY_EVENT:
		{
			PhoneMonitorSignalAndNetworkTypeAndServiceTypeNotifyEventC *phoneEvent =(PhoneMonitorSignalAndNetworkTypeAndServiceTypeNotifyEventC*)e;

			IBD_PRINTF(DEBUG_INFOMATION, "update signal network type and service type (main thread)\n")

			signalAndNetworkTypeAndServiceType(phoneEvent->signal,phoneEvent->network,phoneEvent->service,phoneEvent->signal_strength);
			int signal;
			if( Strength_0 == phoneEvent->signal )
				signal = 0;
			else if( Strength_1 == phoneEvent->signal )
				signal = 1;
			else if( Strength_2 == phoneEvent->signal )
				signal = 2;
			else if( Strength_3 == phoneEvent->signal )
				signal = 3;
			else if( Strength_4 == phoneEvent->signal )
				signal = 4;
			else if( Strength_5 == phoneEvent->signal )
				signal = 5;
			else
				signal = -1;
			int networkType;
			if( Network_3G == phoneEvent->network )
				networkType = 3;
			else if( Network_2G == phoneEvent->network )
				networkType = 2;
			else
				networkType = 0;
			signalAndNetworkType(signal,networkType);
			return TRUE;
		}
		case RING_EVENT:
		{
			PhoneMonitorRingEventC *phoneEvent =(PhoneMonitorRingEventC*)e;
			ring(phoneEvent->cPhoneNumber);
			return TRUE;
		}
		case NEW_FACE_TIME_CALL_EVENT:
		{
			PhoneMonitorNewFaceTimeCallEventC *phoneEvent =(PhoneMonitorNewFaceTimeCallEventC*)e;
			newFaceTimeCall(phoneEvent->cPhoneNumber);
			return TRUE;
		}
		case END_FACE_TIME_CALL_EVENT:
		{
			PhoneMonitorEndFaceTimeCallEventC *phoneEvent =(PhoneMonitorEndFaceTimeCallEventC*)e;
			endFaceTimeCall(phoneEvent->reason);
			return TRUE;
		}
		case FACE_TIME_CALL_CONNECTED_EVENT:
		{
			PhoneMonitorFaceTimeCallConnectEventC *phoneEvent =(PhoneMonitorFaceTimeCallConnectEventC*)e;
			connectFaceTimeCall();
			return TRUE;
		}
		case MISS_FACE_TIME_CALL_EVENT:
		{
			PhoneMonitorMissFaceTimeCallEventC *phoneEvent =(PhoneMonitorMissFaceTimeCallEventC*)e;
			missFaceTimeCall(phoneEvent->cPhoneNumber);
			return TRUE;
		}
		default:
			return QObject::event(e);
	}
}
Пример #7
0
void Skype::skypeMessage(const QString &message) {
	kdDebug(14311) << k_funcinfo << endl;//some debug info

	QString messageType = message.section(' ', 0, 0).stripWhiteSpace().upper();//get the first part of the message
	if (messageType == "CONNSTATUS") {//the connection status
		QString value = message.section(' ', 1, 1).stripWhiteSpace().upper();//get the second part of the message
		if (value == "OFFLINE")
			d->connStatus = csOffline;
		else if (value == "CONNECTING")
			d->connStatus = csConnecting;
		else if (value == "PAUSING")
			d->connStatus = csPausing;
		else if (value == "ONLINE")
			d->connStatus = csOnline;
		else if (value == "LOGGEDOUT")
			d->connStatus = csLoggedOut;

		resetStatus();//set new status
	} else if (messageType == "USERSTATUS") {//Status of this user
		QString value = message.section(' ', 1, 1).stripWhiteSpace().upper();//get the second part
		if (value == "UNKNOWN")
			d->onlineStatus = usUnknown;
		else if (value == "OFFLINE")
			d->onlineStatus = usOffline;
		else if (value == "ONLINE")
			d->onlineStatus = usOnline;
		else if (value == "SKYPEME")
			d->onlineStatus = usSkypeMe;
		else if (value == "AWAY")
			d->onlineStatus = usAway;
		else if (value == "NA")
			d->onlineStatus = usNA;
		else if (value == "DND")
			d->onlineStatus = usDND;
		else if (value == "INVISIBLE")
			d->onlineStatus = usInvisible;

		resetStatus();
	} else if (messageType == "USERS") {//some user info
		QString theRest = message.section(' ', 1).stripWhiteSpace();//take the rest
		if (d->searchFor == "FRIENDS") {//it was initial search for al users
			QStringList names = QStringList::split(",", theRest);//divide it into names by comas
			kdDebug(14311) << "Names: " << names << endl;//write what you have done with that
			for (QStringList::iterator it = names.begin(); it != names.end(); ++it) {//run trough the names
				QString name = (*it).stripWhiteSpace();//get the name only
				if (name.isEmpty())
					continue;//just skip the empty names
				emit newUser(name);//add the user to list
			}
			if (d->scanForUnread)
				search("MISSEDMESSAGES");
		}
	} else if (messageType == "USER") {//This is for some contact
		const QString &contactId = message.section(' ', 1, 1);//take the second part, it is the user name
		const QString &type = message.section(' ', 2, 2).stripWhiteSpace().upper();//get what it is
		if ((type == "FULLNAME") || (type == "DISPLAYNAME") || (type == "SEX") ||
			(type == "PHONE_HOME") || (type == "PHONE_OFFICE") ||
			(type == "PHONE_MOBILE") ||
			(type == "ONLINESTATUS") || (type == "BUDDYSTATUS") || (type == "HOMEPAGE")) {
			const QString &info = message.section(' ', 2);//and the rest is just the message for that contact
			emit contactInfo(contactId, info);//and let the contact know
		} else kdDebug(14311) << "Unknown message for contact, ignored" << endl;
	} else if (messageType == "CHATMESSAGE") {//something with message, maebe incoming/sent
		QString messageId = message.section(' ', 1, 1).stripWhiteSpace();//get the second part of message - it is the message ID
		QString type = message.section(' ', 2, 2).stripWhiteSpace().upper();//This part significates what about the message are we talking about (status, body, etc..)
		QString chatMessageType = (d->connection % QString("GET CHATMESSAGE %1 TYPE").arg(messageId)).section(' ', 3, 3).stripWhiteSpace().upper();
		if (chatMessageType == "ADDEDMEMBERS") {
			QString status = message.section(' ', 3, 3).stripWhiteSpace().upper();
			if (d->recvMessages.find(messageId) != d->recvMessages.end())
				return;
			d->recvMessages << messageId;
			const QString &users = (d->connection % QString("GET CHATMESSAGE %1 USERS").arg(messageId)).section(' ', 3).stripWhiteSpace();
			QStringList splitUsers = QStringList::split(' ', users);
			const QString &chatId = (d->connection % QString("GET CHATMESSAGE %1 CHATNAME").arg(messageId)).section(' ', 3, 3).stripWhiteSpace();
			for (QStringList::iterator it = splitUsers.begin(); it != splitUsers.end(); ++it) {
				if ((*it).upper() == getMyself().upper())
					continue;
				emit joinUser(chatId, *it);
			}
			return;
		} else if (chatMessageType == "LEFT") {
			QString status = message.section(' ', 3, 3).stripWhiteSpace().upper();
			if (d->recvMessages.find(messageId) != d->recvMessages.end())
				return;
			d->recvMessages << messageId;
			const QString &chatId = (d->connection % QString("GET CHATMESSAGE %1 CHATNAME").arg(messageId)).section(' ', 3, 3).stripWhiteSpace();
			const QString &chatType = (d->connection % QString("GET CHAT %1 STATUS").arg(chatId)).section(' ', 3, 3).stripWhiteSpace().upper();
			if ((chatType == "DIALOG") || (chatType == "LEGACY_DIALOG"))
				return;
			const QString &user = (d->connection % QString("GET CHATMESSAGE %1 FROM_HANDLE").arg(messageId)).section(' ', 3, 3).stripWhiteSpace();
			const QString &reason = (d->connection % QString("GET CHATMESSAGE %1 LEAVEREASON").arg(messageId)).section(' ', 3, 3).stripWhiteSpace().upper();
			QString showReason = i18n("Unknown");
			if (reason == "USER_NOT_FOUND") {
				showReason = i18n("User not found");
			} else if (reason == "USER_INCAPABLE") {
				showReason = i18n("Does not have multi-user chat capability");
			} else if ((reason == "ADDER_MUST_BE_FRIEND") || ("ADDER_MUST_BE_AUTHORIZED")) {
				showReason = i18n("Chat denied");
			} else if (reason == "UNSUBSCRIBE") {
				showReason = "";
			}
			if (user.upper() == getMyself().upper())
				return;
			emit leftUser(chatId, user, showReason);
			return;
		}
		if (type == "STATUS") {//OK, status of some message has changed, check what is it
			QString value = message.section(' ', 3, 3).stripWhiteSpace().upper();//get the last part, what status it is
			if (value == "RECEIVED") {//OK, received new message, possibly read it
				if (chatMessageType == "SAID") {//OK, it is some IM
					hitchHike(messageId);//receive the message
				}
			} else if (value == "SENDING") {
				if ((d->connection % QString("GET CHATMESSAGE %1 TYPE").arg(messageId)).section(' ', 3, 3).stripWhiteSpace().upper() == "SAID") {
					emit gotMessageId(messageId);
				}
			} else if (value == "SENT") {//Sendign out some message, that means it is a new one
				if ((d->connection % QString("GET CHATMESSAGE %1 TYPE").arg(messageId)).section(' ', 3, 3).stripWhiteSpace().upper() == "SAID")//it is some message I'm interested in
					emit gotMessageId(messageId);//Someone may be interested in its ID
					if (d->recvMessages.find(messageId) != d->recvMessages.end())
						return;//we already got this one
					d->recvMessages << messageId;
					const QString &chat = (d->connection % QString("GET CHATMESSAGE %1 CHATNAME").arg(messageId)).section(' ', 3, 3).stripWhiteSpace();
					const QString &body = (d->connection % QString("GET CHATMESSAGE %1 BODY").arg(messageId)).section(' ', 3);
					if (!body.isEmpty())//sometimes skype shows empty messages, just ignore them
						emit outgoingMessage(body, chat);
			}
		}
	} else if (messageType == "CHATMESSAGES") {
		if (d->searchFor == "MISSEDMESSAGES") {//Theese are messages we did not read yet
			QStringList messages = QStringList::split(' ', message.section(' ', 1));//get the meassage IDs
			for (QStringList::iterator it = messages.begin(); it != messages.end(); ++it) {
				QString Id = (*it).stripWhiteSpace();
				if (Id.isEmpty())
					continue;
				skypeMessage(QString("CHATMESSAGE %1 STATUS RECEIVED").arg(Id));//simulate incoming message notification
			}
		}
	} else if (messageType == "CALL") {
		const QString &callId = message.section(' ', 1, 1).stripWhiteSpace();
		if (message.section(' ', 2, 2).stripWhiteSpace().upper() == "CONF_ID") {
			if (d->knownCalls.findIndex(callId) == -1) {//new call
				d->knownCalls << callId;
				const QString &userId = (d->connection % QString("GET CALL %1 PARTNER_HANDLE").arg(callId)).section(' ', 3, 3).stripWhiteSpace();
				emit newCall(callId, userId);
			}
			const QString &confId = message.section(' ', 3, 3).stripWhiteSpace().upper();
			if (confId != "0") {//It is an conference
				emit groupCall(callId, confId);
			}
		}
		if (message.section(' ', 2, 2).stripWhiteSpace().upper() == "STATUS") {
			if (d->knownCalls.findIndex(callId) == -1) {//new call
				d->knownCalls << callId;
				const QString &userId = (d->connection % QString("GET CALL %1 PARTNER_HANDLE").arg(callId)).section(' ', 3, 3).stripWhiteSpace();
				emit newCall(callId, userId);
			}
			const QString &status = message.section(' ', 3, 3).stripWhiteSpace().upper();
			if (status == "FAILED") {
				int reason = (d->connection % QString("GET CALL %1 FAILUREREASON").arg(callId)).section(' ', 3, 3).stripWhiteSpace().toInt();
				QString errorText = i18n("Unknown error");
				switch (reason) {
					case 1:
						errorText = i18n("Misc error");
						break;
					case 2:
						errorText = i18n("User or phone number does not exist");
						break;
					case 3:
						errorText = i18n("User is offline");
						break;
					case 4:
						errorText = i18n("No proxy found");
						break;
					case 5:
						errorText = i18n("Session terminated");
						break;
					case 6:
						errorText = i18n("No common codec found");
						break;
					case 7:
						errorText = i18n("Sound I/O error");
						break;
					case 8:
						errorText = i18n("Problem with remote sound device");
						break;
					case 9:
						errorText = i18n("Call blocked by recipient");
						break;
					case 10:
						errorText = i18n("Recipient not a friend");
						break;
					case 11:
						errorText = i18n("User not authorized by recipient");
						break;
					case 12:
						errorText = i18n("Sound recording error");
						break;
				}
				emit callError(callId, errorText);
			}
			emit callStatus(callId, status);
		}
	} else if (messageType == "CURRENTUSERHANDLE") {
		QString user = message.section(' ', 1, 1).stripWhiteSpace();
		QString name = (d->connection % QString("GET USER %1 DISPLAYNAME").arg(user)).section(' ', 3).stripWhiteSpace();
		if (name.isEmpty())
			name = (d->connection % QString("GET USER %1 FULLNAME").arg(user)).section(' ', 3).stripWhiteSpace();
		if (name.isEmpty())
			name = user;
		emit setMyselfName(name);
	}
}
Пример #8
0
X86CallNode* X86Compiler::addCall(const Operand& o0, const FuncPrototype& p) {
  X86CallNode* node = newCall(o0, p);
  if (node == NULL)
    return NULL;
  return static_cast<X86CallNode*>(addNode(node));
}
Пример #9
0
X86CallNode* X86Compiler::addCall(const Operand& o0, const FuncPrototype& p) noexcept {
  X86CallNode* node = newCall(o0, p);
  if (node == nullptr)
    return nullptr;
  return static_cast<X86CallNode*>(addNode(node));
}