[subscriber] Update the current_bts field on imsi detach and LOC accept

When sending LOCATION UPDATING REQUEST Accept or when getting
a IMSI Detach update the gsm_bts of the gsm_subscriber.
diff --git a/src/gsm_subscriber.c b/src/gsm_subscriber.c
index d4dfea4..e3cd5eb 100644
--- a/src/gsm_subscriber.c
+++ b/src/gsm_subscriber.c
@@ -90,8 +90,23 @@
 	return db_get_subscriber(GSM_SUBSCRIBER_EXTENSION, ext);
 }
 
-int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts)
+int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason)
 {
+	/* FIXME: Migrate pending requests from one BSC to another */
+	switch (reason) {
+	case GSM_SUBSCRIBER_UPDATE_ATTACHED:
+		s->current_bts = bts;
+		break;
+	case GSM_SUBSCRIBER_UPDATE_DETACHED:
+		/* Only detach if we are currently attached to this bts */
+		if (bts == s->current_bts)
+			s->current_bts = NULL;
+		break;
+	default:
+		fprintf(stderr, "subscr_update with unknown reason: %d\n",
+			reason);
+		break;
+	};
 	return db_sync_subscriber(s);
 }