/** * Synchronize invite, ban, except, and G-Line lists between servers. * * @param Client New server. * @return CONNECTED or DISCONNECTED. */ static bool Synchronize_Lists(CLIENT * Client) { CHANNEL *c; struct list_head *head; struct list_elem *elem; time_t t; assert(Client != NULL); /* g-lines */ head = Class_GetList(CLASS_GLINE); elem = Lists_GetFirst(head); while (elem) { t = Lists_GetValidity(elem) - time(NULL); if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s", Lists_GetMask(elem), t > 0 ? (long)t : 0, Lists_GetReason(elem))) return DISCONNECTED; elem = Lists_GetNext(elem); } c = Channel_First(); while (c) { if (!Send_List(Client, c, Channel_GetListExcepts(c), 'e')) return DISCONNECTED; if (!Send_List(Client, c, Channel_GetListBans(c), 'b')) return DISCONNECTED; if (!Send_List(Client, c, Channel_GetListInvites(c), 'I')) return DISCONNECTED; c = Channel_Next(c); } return CONNECTED; }
/** * Send a specific list to a remote server. */ static bool Send_List(CLIENT *Client, CHANNEL *Chan, struct list_head *Head, char Type) { struct list_elem *elem; elem = Lists_GetFirst(Head); while (elem) { if (!IRC_WriteStrClient(Client, "MODE %s +%c %s", Channel_Name(Chan), Type, Lists_GetMask(elem))) { return DISCONNECTED; } elem = Lists_GetNext(elem); } return CONNECTED; }
static bool ShowChannelList(struct list_head *head, CLIENT *Client, CHANNEL *Channel, char *msg, char *msg_end) { struct list_elem *e; assert (Client != NULL); assert (Channel != NULL); e = Lists_GetFirst(head); while (e) { if (!IRC_WriteStrClient(Client, msg, Client_ID(Client), Channel_Name(Channel), Lists_GetMask(e))) return DISCONNECTED; e = Lists_GetNext(e); } return IRC_WriteStrClient(Client, msg_end, Client_ID(Client), Channel_Name(Channel)); }
void CMsnProto::MSN_GoOffline(void) { if (m_iStatus == ID_STATUS_OFFLINE) return; msnLoggedIn = false; if (mStatusMsgTS) ForkThread(&CMsnProto::msn_storeProfileThread, NULL); mir_free(msnPreviousUUX); msnPreviousUUX = NULL; msnSearchId = NULL; if (!Miranda_Terminated()) MSN_EnableMenuItems(false); MSN_FreeGroups(); MsgQueue_Clear(); clearCachedMsg(); if (!Miranda_Terminated()) { int msnOldStatus = m_iStatus; m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)msnOldStatus, ID_STATUS_OFFLINE); isIdle = false; int count = -1; for (;;) { MsnContact *msc = Lists_GetNext(count); if (msc == NULL) break; if (ID_STATUS_OFFLINE != getWord(msc->hContact, "Status", ID_STATUS_OFFLINE)) { setWord(msc->hContact, "Status", ID_STATUS_OFFLINE); setDword(msc->hContact, "IdleTS", 0); } } } }