1 //------------------------------------------------------------------------------ 2 // Copyright (c) 2001-2002, OpenBeOS 3 // 4 // Permission is hereby granted, free of charge, to any person obtaining a 5 // copy of this software and associated documentation files (the "Software"), 6 // to deal in the Software without restriction, including without limitation 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 // and/or sell copies of the Software, and to permit persons to whom the 9 // Software is furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be included in 12 // all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 // DEALINGS IN THE SOFTWARE. 21 // 22 // File Name: RosterAppInfo.cpp 23 // Author: Ingo Weinhold (bonefish@users.sf.net) 24 // Description: An extended app_info. 25 //------------------------------------------------------------------------------ 26 27 #include <new> 28 29 #include <string.h> 30 31 #include "RosterAppInfo.h" 32 33 using std::nothrow; 34 35 // constructor 36 RosterAppInfo::RosterAppInfo() 37 : app_info(), 38 state(APP_STATE_UNREGISTERED), 39 token(0), 40 registration_time(0) 41 { 42 } 43 44 // Init 45 void 46 RosterAppInfo::Init(thread_id thread, team_id team, port_id port, uint32 flags, 47 const entry_ref *ref, const char *signature) 48 { 49 this->thread = thread; 50 this->team = team; 51 this->port = port; 52 this->flags = flags; 53 this->ref = *ref; 54 if (signature) { 55 strncpy(this->signature, signature, B_MIME_TYPE_LENGTH - 1); 56 this->signature[B_MIME_TYPE_LENGTH - 1] = '\0'; 57 } else 58 this->signature[0] = '\0'; 59 } 60 61 // Clone 62 RosterAppInfo * 63 RosterAppInfo::Clone() const 64 { 65 RosterAppInfo *clone = new(nothrow) RosterAppInfo; 66 if (!clone) 67 return NULL; 68 69 clone->Init(thread, team, port, flags, &ref, signature); 70 clone->registration_time = registration_time; 71 return clone; 72 } 73