コード例 #1
0
ファイル: error.c プロジェクト: mingpen/OpenNT
void NEAR
displayBanner()
{
#ifdef LEADING_ZEROES
    char szRevisionNo[5];				      /* For '.nnn\0' */
    char szMinorVersion[3];				      /* For 'nn\0'   */
#endif
    if (bannerDisplayed)
	return;
    bannerDisplayed = TRUE;

#ifdef LEADING_ZEROES
    szMinorVersion[0] = '0';
    szMinorVersion[1] = '0';
    itoa(rmm, szMinorVersion + (rmm < 10 ? 1 : 0), 10);
    szRevisionNo[0] = rup ? '.' : '\0'; 	/* if 0 Revision is not shown */
    szRevisionNo[1] = '0';
    szRevisionNo[2] = '0';
    itoa(rup, szRevisionNo + (rup < 10 ? 3 : (rup < 100 ? 2 : 1)), 10);
    makeMessage(COPYRIGHT_MESSAGE_1, rmj, szMinorVersion, szRevisionNo);
#endif
    makeMessage(COPYRIGHT_MESSAGE_1, VERSION(rmj, rmm, rup));
    makeMessage(COPYRIGHT_MESSAGE_2, CopyRightYrs);
    fflush(stderr);
}
コード例 #2
0
ファイル: print.cpp プロジェクト: fstudio/nmake
void
showMacros(
    void
    )
{
    MACRODEF *p;
    STRINGLIST *q;
    int n = 0;

    makeMessage(MACROS_MESSAGE);

    for (n = 0; n < MAXMACRO; ++n) {
        for (p = macroTable[n]; p; p = p->next) {
            if (p->values && p->values->text) {
                makeMessage(MACRO_DEFINITION, p->name, p->values->text);
                for (q = p->values->next; q; q = q->next) {
                    if (q->text) {
                        printf("\t\t%s\n", q->text);
                    }
                }
            }
        }
    }

    putchar('\n');

    fflush(stdout);
}
コード例 #3
0
void __cdecl
makeError (
    unsigned lineNumber,
    unsigned msg,
    ...)
{
    unsigned exitCode = 2;          // general program err
    unsigned level;
    va_list args;                   // More arguments

    va_start(args, msg);            // Point 'args' at first extra arg

    if (ON(gFlags,F1_CRYPTIC_OUTPUT) && (msg / 1000) == WARNING) {
        return;
    }

    displayBanner();

    if (lineNumber) {
        fprintf(stderr, "%s(%u) : ", fName, lineNumber);
    } else {
        fprintf(stderr, "%s : ", NmakeStr);
    }

    switch (level = msg / 1000) {
        case FATAL:
            makeMessage(FATAL_ERROR_MESSAGE);
            if (msg == OUT_OF_MEMORY) {
                exitCode = 4;
            }
            break;

        case ERROR:
            makeMessage(ERROR_MESSAGE);
            break;

        case WARNING:
            makeMessage(WARNING_MESSAGE);
            break;
    }

    fprintf(stderr, " U%04d: ",msg);     // U for utilities
    vfprintf(stderr, get_err(msg), args);
    putc('\n', stderr);
    fflush(stderr);

    if (level == FATAL) {
        fprintf(stderr, "Stop.\n");
        delScriptFiles();

#if !defined(NDEBUG)
        printStats();
#endif
        exit(exitCode);
    }
}
コード例 #4
0
void
displayBanner()
{
    if (bannerDisplayed) {
        return;
    }

    bannerDisplayed = TRUE;

    makeMessage(COPYRIGHT_MESSAGE_1, VER_PRODUCTVERSION_STR);
    makeMessage(COPYRIGHT_MESSAGE_2);

    fflush(stderr);
}
コード例 #5
0
ファイル: Text.cpp プロジェクト: gostefan/imageSynthesis
	//-------------------------------------------------------------------------------
	// BITMAP TEXT ROUTINE: same as Text, but give 3D coordinates in modelspace.
	//-------------------------------------------------------------------------------
	void glText3D(float x, float y, float z, const char *format, ...) {
		va_list args;
		va_start(args, format);
    
		char* buffer;
		if (!(buffer = makeMessage(format, args)))
			return;

		va_end(args);

		glPushAttrib(GL_LIGHTING_BIT); {
			glDisable(GL_LIGHTING);
			glDisable(GL_COLOR_MATERIAL);
			glPushAttrib(GL_COLOR_BUFFER_BIT); {
				glDisable(GL_DITHER);
				glPushAttrib(GL_DEPTH_BUFFER_BIT); {
					glDisable(GL_DEPTH_TEST);
            
					int height = fontHeight(_currentFont);
            
					glRasterPos3f(x, y, z);
            
					for (char *p = buffer; *p; p++) {
						if (*p == '\n') {
							y -= height;
							glRasterPos3f(x, y, z);
						} else {
							glutBitmapCharacter(_currentFont, *p);
						}
					}
					delete[] buffer;
				} glPopAttrib();
			} glPopAttrib();
		} glPopAttrib();
	}
コード例 #6
0
void MsgEdit::spellDone(bool bResult)
{
    disconnect(edit, SIGNAL(spellDone(bool)), this, SLOT(spellDone(bool)));
    if (bResult){
        makeMessage();
    }
}
コード例 #7
0
ファイル: force.cpp プロジェクト: Xowap/Armdorande
void Force::processSaber(QDataStream *ds, QHostAddress *from) {
	Jedi *j;
	j = jediMap[*from];

	if(j) {
		double x, y, z;
		bool original;
		ForceMessageSaber msg;

		if(state & FightBit) {
			*ds >> original >> x >> y >> z;

			if(state == FightingServer) {
				msg.x = x;
				msg.y = y;
				msg.z = z;
				msg.original = false;

				QByteArray ba = makeMessage(SaberMoved, &msg);
				s_out.writeDatagram(ba, op->host(), udpPort);
			}

			emit gotSaberUpdate(original ? j : jediIndex[0], x, y, z);
		}
	}
コード例 #8
0
ファイル: message.c プロジェクト: gygy/asuswrt
/**
 * Creates a plain text (or html) email and 
 * specifies the necessary MIME types if needed
 * due to attaching base64 files.
 * when this function is done, it will rewind
 * the file position and return an open file
**/
static dstrbuf *
createPlainEmail(dstrbuf *msg) 
{
	dstrbuf *border=NULL;
	dstrbuf *buf=DSB_NEW;
	CharSetType cs;

	if (Mopts.attach) {
		border = mimeMakeBoundary();
	} else {
		border = DSB_NEW;
	}

	if (Mopts.encoding) {
		cs = getCharSet((u_char *)msg->str);
	} else {
		cs = IS_ASCII;
	}
	printHeaders(border->str, buf, cs);
	if (makeMessage(msg, buf, border->str, cs) < 0) {
		dsbDestroy(buf);
		buf=NULL;
	}
	dsbDestroy(border);
	return buf;
}
コード例 #9
0
void MsgView::addMessage(ICQMessage *msg, bool bUnread, bool bSet)
{
    if (msg->Id >= MSG_PROCESS_ID) return;
    int x = contentsX();
    int y = contentsY();
    QString s(makeMessage(msg, bUnread));
    if (bSet) curAnchor = QString::number(msg->getUin()) + "." + QString::number(msg->Id);
    unsigned long foreColor = 0;
    unsigned long backColor = 0;
    if (!pMain->UseOwnColors() && (msg->Type() == ICQ_MSGxMSG)){
        ICQMsg *m = static_cast<ICQMsg*>(msg);
        foreColor = m->ForeColor();
        backColor = m->BackColor();
    }
    if (bBack){
        setText(s + text(), curAnchor);
        if (foreColor != backColor)
            setMsgBgColor(msg->getUin(), msg->Id, backColor, 0);
    }else{
        int n = paragraphs();
        if (n > 0) n--;
        append(s);
        if (foreColor != backColor)
            setMsgBgColor(msg->getUin(), msg->Id, backColor, n);
    }
    if (bSet){
        scrollToBottom();
    }else{
        setContentsPos(x, y);
    }
}
コード例 #10
0
ファイル: message.cpp プロジェクト: AlexIssayev/simple_log
 char * Message::getMessage() {
     if (!messageProcessed()) {
         size_t size = BUF_SIZE;
         bool verbose = _name == NULL;
         const char * fstr = verbose ? 
             "%-5s [%02i:%02i:%02i] Function %s (File %s : Line %03d): %s\n" :
             "%-5s %s : %s\n";
         do {
             _buffer = new char[size];
             const char * msg = makeMessage();
             int res; 
             if (verbose) { 
                 time_t t = time(NULL);
                 tm * time_info = localtime(&t);
                 res = snprintf(_buffer, size, fstr, _lvl, 
                     time_info->tm_hour, time_info->tm_min, time_info->tm_sec,
                     _function, _file, _line, msg);
             } else {
                 res = snprintf(_buffer, size, fstr, _lvl, _name, msg);
             }
             if (res < 0) {
                 size *= 2;
                 delete[] _buffer;
             } else if (static_cast<size_t>(res) > size) {
                 size = res + 1;
                 delete[] _buffer;
             } else {
                 return _buffer;
             }
         } while (true);
     } else {
         return _buffer;
     }
 }
コード例 #11
0
void MsgView::messageRead(ICQMessage *msg)
{
    QString pat;
    pat.sprintf("<p><a name=\"%lu.%lu\"></a></p>", msg->Uin(), msg->Id);
    QString res;
    QString t = text();
    int pos = t.find(pat);
    if (pos < 0) return;
    bool isUpdates = viewport()->isUpdatesEnabled();
    viewport()->setUpdatesEnabled(false);
    res = t.left(pos);
    if (msg){
        bool bSaveBack = bBack;
        bBack = false;
        res += makeMessage(msg, false);
        bBack = bSaveBack;
    }
    t = t.mid(pos+1);
    pos = t.find("<p><a name=");
    if (pos >= 0) res += t.mid(pos);
    setText(res);
    curAnchor = QString::number(msg->Uin()) + "." + QString::number(msg->Id);
    scrollToAnchor(curAnchor);
    if (!isUpdates) return;
    viewport()->setUpdatesEnabled(true);
    viewport()->repaint();
}
コード例 #12
0
ファイル: exception.cpp プロジェクト: wesulee/mr
std::string ParserError::what() const {
	std::string str{"type "};
	switch (type) {
	case DataType::INI:
		str += "INI";
		break;
	case DataType::JSON:
		str += "JSON";
		break;
	default:
		assert(false);
		str += "???";
	}
	str += " file ";
	str += q(filePath);
	str += ' ';
	if (line != ExceptionHelper::defaultLine) {
		str += "(line " + std::to_string(line) + ") ";
	}
	else if (offset != ExceptionHelper::defaultOffset) {
		str += "(offset " + std::to_string(offset) + ") ";
	}
	str += message;
	return makeMessage("ParserError: ", str, details);
}
コード例 #13
0
void UserProfilPageTest::testConnexion()
{
    HomeWindow window;
    window.show();

    QVERIFY( window.isOnProfilPage() );

    window.newMessageArrive( makeMessage( 1 ) );
    window.newMessageArrive( makeMessage( 2 ) );
    window.newMessageArrive( makeMessage( 1, false, false, false, false, true ) );
    window.newMessageArrive( makeMessage( 2, false, false, false, false, true ) );

    QTimer::singleShot( 1000, qApp, SLOT( quit() ) );
    qApp->exec();

    QVERIFY( window.isOnGameSelectionPage() );
}
コード例 #14
0
ファイル: print.cpp プロジェクト: fstudio/nmake
void
printDate(
    unsigned spaces,        // spaces to print
    char *name,             // name of file whose date is to be printed
    time_t dateTime         // dateTime of file
    )
{
    if (dateTime == 0) {
        makeMessage(TARGET_DOESNT_EXIST, spaces, "", name);
    } else {
	char s[19]; // enough for 16-character time_t, plus "0x" and \0

	sprintf(s, "%p", (void *)dateTime);

        makeMessage(TIME_FORMAT, spaces, "", name, PAD1-spaces, s);
    }
}
コード例 #15
0
ファイル: Text.cpp プロジェクト: gostefan/imageSynthesis
	//-------------------------------------------------------------------------------
	// BITMAP TEXT ROUTINE: draws the printf style format string(with args) with
	// the bottom-left corner of the string at pixel position(x,y) in the current
	// window with the current color. The bottom-left corner of the window is at
	//(0,0). Many different fonts are available(see currentFont above):
	// The current raster position is updated to the end of the string; check with:
	//  float CurrentRasterPos[4];
	//  glGetFloatv(GL_CURRENT_RASTER_POSITION,CurrentRasterPos);
	//  x=CurrentRasterPos[0]+0.5;
	//  y=CurrentRasterPos[1]+0.5;
	// Setting negative values for x or y will avoid the update of the raster pos;
	// this is useful for continuing more text on the same line after a previous
	// call to Text(). Newline chars('\n') in the string advance the raster position
	// to the next line down(Newline chars are ignored in string continuing on same line).
	//-------------------------------------------------------------------------------
	void glText(int x, int y, const char *format, ...) {
		va_list args;
		va_start(args, format);
    
		char* buffer;
		if (!(buffer = makeMessage(format, args)))
			return;

		va_end(args);

		int WW = glutGet((GLenum)GLUT_WINDOW_WIDTH);
		int WH = glutGet((GLenum)GLUT_WINDOW_HEIGHT);

		glPushAttrib(GL_LIGHTING_BIT); {
			glDisable(GL_LIGHTING);
			glDisable(GL_COLOR_MATERIAL);
			glPushAttrib(GL_COLOR_BUFFER_BIT); {
				glDisable(GL_DITHER);
				glPushAttrib(GL_DEPTH_BUFFER_BIT); {
					glDisable(GL_DEPTH_TEST);
            
					glPushAttrib(GL_VIEWPORT_BIT); {
						glViewport(0, 0, WW, WH);
						glMatrixMode(GL_PROJECTION);
						glPushMatrix(); {
							glLoadIdentity();
							gluOrtho2D(0, WW, 0, WH);
							glMatrixMode(GL_MODELVIEW);
							glPushMatrix(); {
								glLoadIdentity();
                        
								int height = fontHeight(_currentFont);
                        
								if (x >= 0 && y >= 0)
									glRasterPos2i(x, y);
                        
								for (char *p = buffer; *p; p++) {
									if (*p == '\n') {
										if (x>=0 && y>=0) {
											y -= height;
											glRasterPos2i(x, y);
										}
									} else {
										glutBitmapCharacter(_currentFont, *p);
									}
								}
                            
								delete[] buffer;
                        
								glMatrixMode(GL_PROJECTION);
							} glPopMatrix();
							glMatrixMode(GL_MODELVIEW);
						} glPopMatrix();
					} glPopAttrib();
				} glPopAttrib();
			} glPopAttrib();
		} glPopAttrib();
	}
コード例 #16
0
ファイル: Assertions.cpp プロジェクト: Christewart/rapidcheck
std::string makeWrongExceptionMessage(const std::string &file,
                                      int line,
                                      const std::string &assertion,
                                      const std::string &expected) {
  return makeMessage(file,
                     line,
                     assertion,
                     "Thrown exception did not match " + expected + ".");
}
コード例 #17
0
ファイル: chessprotocol.cpp プロジェクト: junbinxu/chess
void ChessProtocol::sendChessMessgae(int fid, int tid, const QPoint &from, const QPoint &to, const QString &boardMap, bool isBlackTurn, int count)
{
    QString msg = makeChessMessage(fid, tid, from, to);
    QString data = makeMessage(QLatin1String("CHESS"), msg);
    char turn = isBlackTurn ? 'b' : 'w';
    QString engine = QString(" -ELEEYE %1 -TURN %2 -COUNT %3").arg(boardMap).arg(turn).arg(count);
    data.append(engine);
    ChessDispatch::instance()->send(data);
}
コード例 #18
0
ファイル: print.cpp プロジェクト: fstudio/nmake
void
showTargets(
    void
    )
{
    unsigned bit, i;
    STRINGLIST *q;
    BUILDLIST  *s;
    BUILDBLOCK *r;
    MAKEOBJECT *t;
    unsigned n;
    LOCAL char *flagLetters = "dinsb";

    makeMessage(TARGETS_MESSAGE);
    for (n = 0; n < MAXTARGET; ++n) {
        for (t = targetTable[n]; t; t = t->next, putchar('\n')) {
            printf("%s:%c", t->name,
                   ON(t->buildList->buildBlock->flags, F2_DOUBLECOLON)
                       ? ':' : ' ');
            dollarStar = dollarAt = dollarDollarAt = t->name;
            for (s = t->buildList; s; s = s->next) {
                r = s->buildBlock;
                makeMessage(FLAGS_MESSAGE);
                for (i = 0, bit = F2_DISPLAY_FILE_DATES;
                     bit < F2_FORCE_BUILD;
                     ++i, bit <<= 1)
                     if (ON(r->flags, bit))
                        printf("-%c ", flagLetters[i]);
                showDependents(r->dependents, r->dependentMacros);
                makeMessage(COMMANDS_MESSAGE);
                if ((q = r->buildCommands)) {
                    if (q->text) printf("%s\n", q->text);
                    while ((q = q->next))
                        if (q->text) printf("\t\t\t%s\n", q->text);
                }
                else putchar('\n');
            }
        }
    }
    dollarStar = dollarAt = dollarDollarAt = NULL;
    putchar('\n');
    fflush(stdout);
}
コード例 #19
0
void
usage(void)
{
    unsigned mesg;

    for (mesg = MESG_FIRST; mesg < MESG_A; ++mesg) {
        makeMessage(mesg, "NMAKE");
    }

    for (mesg = MESG_A; mesg <= MESG_LAST; mesg++) {
        if (mesg == MESG_M) {
            mesg++;
        }

        if (mesg == MESG_V) {
            mesg++;
        }
        makeMessage(mesg);
    }
}
コード例 #20
0
ファイル: messenger.cpp プロジェクト: nikhilm/qommunicate
/*
 * Sends a broadcast
 * and then also multicasts to all ips stored in the Settings
 */
bool Messenger::multicast(quint32 command, QByteArray payload)
{
    QByteArray data = makeMessage(command, payload).toAscii();

    socket->writeDatagram(data, QHostAddress::Broadcast, UDP_PORT);

    QString ip;
    foreach(ip, ips())
    {
        socket->writeDatagram(data, QHostAddress(ip), UDP_PORT);
    }
コード例 #21
0
ファイル: print.cpp プロジェクト: fstudio/nmake
void
showDependents(
    STRINGLIST *q,          // list of dependents
    STRINGLIST *macros      // macros in the dependents
    )
{
    char *u, *v;
    char *w;
    size_t i;
    struct _finddata_t finddata;
    NMHANDLE searchHandle;

    makeMessage(DEPENDENTS_MESSAGE);
    for (i = 0; q; q = q->next) {
        char *szFilename;

        if (_tcschr(q->text, '$')) {
            u = expandMacros(q->text, &macros);

            for (v = _tcstok(u, " \t"); v; v = _tcstok(NULL, " \t")) {
                if (_tcspbrk(v, "*?")) {
                    if ((szFilename = findFirst(v, &finddata, &searchHandle))) {
                        do {
                            w = prependPath(v, szFilename);
                            printf("%s ", w);
                            i = checkLineLength(i, w);
                            FREE(w);
                        }
                        while ((szFilename = findNext(&finddata, searchHandle)));
                    }
                } else {
                    printf("%s ", v);
                    i = checkLineLength(i, v);
                }
            }

            FREE(u);
        } else if (_tcspbrk(q->text, "*?")) {
            if ((szFilename = findFirst(q->text, &finddata, &searchHandle))) {
                do {
                    v = prependPath(q->text, szFilename);
                    printf("%s ", v);
                    i = checkLineLength(i, v);
                    FREE(v);
                }
                while ((szFilename = findNext(&finddata, searchHandle)));
            }
        } else {
            printf("%s ", q->text);
            i = checkLineLength(i, q->text);
        }
    }
}
コード例 #22
0
void HistoryView::fill()
{
    if (!bFill){
        bFill = true;
        u = pClient->getUser(m_nUin);
        if (u == NULL) return;
        h = new History(m_nUin);
        colors.clear();
        t = "";
        showProgress(0);
    }
    if ((u == NULL) || (h == NULL)) return;
    History::iterator &it = h->messages();
    list<unsigned long>::iterator unreadIt;
    ++it;
    if (*it){
        showProgress(it.progress());
        for (unreadIt = u->unreadMsgs.begin(); unreadIt != u->unreadMsgs.end(); unreadIt++)
            if ((*unreadIt) == (*it)->Id) break;
        t = makeMessage(*it, unreadIt != u->unreadMsgs.end()) + t;
        unsigned long foreColor = 0;
        unsigned long backColor = 0;
        if (!pMain->UseOwnColors() && ((*it)->Type() == ICQ_MSGxMSG)){
            ICQMsg *m = static_cast<ICQMsg*>(*it);
            foreColor = m->ForeColor();
            backColor = m->BackColor();
        }
        if (foreColor != backColor){
            MsgBgColor pc;
            pc.id = (*it)->Id;
            pc.rgb = backColor;
            colors.prepend(pc);
        }
        QTimer::singleShot(0, this, SLOT(fill()));
        return;
    }

    setText(t);
    t = "";
    int n = 0;
    for (QValueList<MsgBgColor>::Iterator itCol = colors.begin(); itCol != colors.end(); ++itCol){
        MsgBgColor pc = *itCol;
        n = setMsgBgColor(m_nUin, pc.id, pc.rgb, n);
    }
    colors.clear();
    delete h;
    h = NULL;
    u = NULL;
    showProgress(101);
}
コード例 #23
0
ファイル: print.cpp プロジェクト: fstudio/nmake
void
showRules(
    void
    )
{
    RULELIST *p;
    STRINGLIST *q;
    unsigned n;

    makeMessage(INFERENCE_MESSAGE);

    for (p = rules, n = 1; p; p = p->next, ++n)  {
        printf(p->fBatch? "%s::" : "%s:", p->name);

        makeMessage(COMMANDS_MESSAGE);

        if ((q = p->buildCommands)) {
            printf("%s\n", q->text);

            while ((q = q->next)) {
                printf("\t\t\t%s\n", q->text);
            }
        }

	putchar('\n');
    }

    printf("%s: ", suffixes);

    for (q = dotSuffixList; q; q = q->next) {
        printf("%s ", q->text);
    }

    putchar('\n');

    fflush(stdout);
}
コード例 #24
0
ファイル: Hub.cpp プロジェクト: project-zerus/sandbox
 void publish(
     const string& content,
     ProtobufCodecLite& codec,
     Counters& counters) {
     PubSubMessage message = makeMessage(content);
     muduo::net::Buffer buf;
     codec.fillEmptyBuffer(&buf, message);
     for (auto audience : audiences_) {
         TcpConnectionPtr tcpConnection = audience.lock();
         if (tcpConnection.get()) {
             tcpConnection->send(buf.peek(), buf.readableBytes());
             counters.addOutBoundTraffic(buf.readableBytes());
             counters.incrementOutBoundMessage();
         }
     }
 }
コード例 #25
0
int
SMSTPDUContainer::getMessageAsHex(char* hexData, size_t maxLength)
{
   char tempBuf[5]; // Put the two hexdigits here.
   // Make a TPDU in binary format
   makeMessage(m_payLoad, m_payLoadSize, m_recipientPhone, m_serviceCenter);
   /* Now data will contain the message that we want to send */
   hexData[0] = '\0';
   size_t pos = 0; /* Position in data */
   while ( pos < maxLength && pos < count() ) {
      sprintf(tempBuf, "%02X", data[pos]);
      strcat(hexData, tempBuf);
      pos++;
   }
   return strlen(hexData);
}
コード例 #26
0
void MsgView::addMessage(ICQMessage *msg, bool bUnread)
{
    if (msg->Id >= MSG_PROCESS_ID) return;
    bool bUpdates = viewport()->isUpdatesEnabled();
    viewport()->setUpdatesEnabled(false);
    QString s(makeMessage(msg, bUnread));
    if (bBack){
        setText(s + text());
    }else{
        setText(text() + s);
    }
    scrollToAnchor(curAnchor);
    if (!bUpdates) return;
    viewport()->setUpdatesEnabled(true);
    viewport()->repaint();
}
コード例 #27
0
ファイル: ecc.c プロジェクト: head1km/CMU-Coursework
/*
	In the main method the arrays that will hold the integers and later the binary 
	encoded messages are created. Other functions are called to perform the operations
	involved in changing an integer to an encoded binary number. 
*/
int main(int argc, char *argv[]) 
{	
	int maxnumbers = 500, codelength = 21, i, binlen;
	int numbers[maxnumbers];
	
	readMessage(numbers, maxnumbers);
	binlen = LengthOfFile(numbers);
	
	char binary[binlen][codelength];
	char encodedbinary[binlen][codelength];
	
	puts("The inputs in the file have been encoded with the Hamming code technique.");
	for(i = 0; i < binlen; i++) {
		extractMessage(numbers[i], binary[i]);
		makeMessage(binary[i], encodedbinary[i], binlen, codelength);
	}
}
コード例 #28
0
HistoryView::HistoryView(QWidget *p, unsigned long uin)
        : MsgView(p), m_nUin(uin)
{
    bBack = true;
    ICQUser *u = pClient->getUser(uin);
    if (u == NULL) return;
    History h(uin);
    History::iterator &it = h.messages();
    list<unsigned long>::iterator unreadIt;
    QString t;
    for (++it; *it; ++it){
        for (unreadIt = u->unreadMsgs.begin(); unreadIt != u->unreadMsgs.end(); unreadIt++)
            if ((*unreadIt) == (*it)->Id) break;
        t = makeMessage(*it, unreadIt != u->unreadMsgs.end()) + t;
    }
    setText(t);
    connect(pClient, SIGNAL(messageReceived(ICQMessage*)), this, SLOT(messageReceived(ICQMessage*)));
    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
}
コード例 #29
0
void MsgEdit::send()
{
    if (msg->Type() == ICQ_MSGxSMS){
        ICQUser *u = pClient->getUser(Uin);
        if (u){
            string msgPhone;
            msgPhone = phoneEdit->lineEdit()->text().local8Bit();
            PhoneBook::iterator it;
            for (it = u->Phones.begin(); it != u->Phones.end(); it++){
                PhoneInfo *phone = static_cast<PhoneInfo*>(*it);
                if (phone->Type != SMS) continue;
                if (phone->getNumber() == msgPhone) break;
            }
            if (it == u->Phones.end()){
                PhoneInfo *phone = new PhoneInfo;
                phone->setNumber(msgPhone.c_str(), SMS);
                phone->MyInfo = true;
                u->Phones.push_back(phone);
                ICQEvent e(EVENT_INFO_CHANGED, Uin);
                pClient->process_event(&e);
            }
        }
    }
    if (pMain->SpellOnSend){
        switch (msg->Type()){
        case ICQ_MSGxSMS:
        case ICQ_MSGxMSG:
        case ICQ_MSGxURL:
        case ICQ_MSGxFILE:
        case ICQ_MSGxCHAT:
            connect(edit, SIGNAL(spellDone(bool)), this, SLOT(spellDone(bool)));
            edit->spell();
            return;
        default:
            break;
        }
    }
    makeMessage();
}
コード例 #30
0
   void simpleTest()
      {
         // Create the SipUserAgent.
         SipUserAgent ua;

         // Create the SipDialogMonitor.
         UtlString domain("source-domain");
         SipDialogMonitor dm(&ua, domain, 5060, 100, FALSE);
         
         // Register a notifier.
         TestStateChangeNotifier notifier("notify", &eventLog);
         dm.addStateChangeNotifier("notify", &notifier);

         // Clear the event log.
         eventLog = "";

         // Start state-keeping for edh1.
         eventLog.append("createDialogState edh1\n");
         dm.createDialogState(new UtlString("edh1"));

         // Send a message.
         SipMessage* m1 = makeMessage(
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
            "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" "
            "version=\"1\" state=\"full\" entity=\"sip:333@source-domain\">"
            "</dialog-info>"
            );
         eventLog.append("notifyEventCallback edh1 dh1 m1\n");
         dm.notifyEventCallback("edh1", "dh1", (void*) &dm, m1);

         // Check that what we wanted happened.
         ASSERT_STR_EQUAL(eventLog.data(),
                          "createDialogState edh1\n"
                          "notifyEventCallback edh1 dh1 m1\n"
                          "notify ON_HOOK\n");
      }